Skip to content

Commit

Permalink
changed diary editor and pixel rendering
Browse files Browse the repository at this point in the history
- changed rating theme
- simplified diary editor ui
- simplified main menu ui
- removed more redundant code
- updated readme images
- closed #17
- closed #21
- incremented patch version
  • Loading branch information
someretical committed Jan 20, 2022
1 parent 80544c2 commit 80f0704
Show file tree
Hide file tree
Showing 22 changed files with 563 additions and 660 deletions.
Binary file modified images/readme/editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/readme/entry_list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/readme/main_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/readme/pixels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/readme/statistics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions src/core/internalmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,21 @@ void InternalManager::start_update_theme()
void InternalManager::set_light_palette()
{
set_colour(td::ColourRole::Unknown, QStringLiteral("#C9C9CF"));
set_colour(td::ColourRole::VeryBad, QStringLiteral("#7b1fa2"));
set_colour(td::ColourRole::Bad, QStringLiteral("#5e35b1"));
set_colour(td::ColourRole::Ok, QStringLiteral("#1976d2"));
set_colour(td::ColourRole::Good, QStringLiteral("#0097a7"));
set_colour(td::ColourRole::VeryGood, QStringLiteral("#4caf50"));
set_colour(td::ColourRole::VeryBad, QStringLiteral("#C43F31"));
set_colour(td::ColourRole::Bad, QStringLiteral("#E07F16"));
set_colour(td::ColourRole::Ok, QStringLiteral("#FFD30F"));
set_colour(td::ColourRole::Good, QStringLiteral("#5EA10E"));
set_colour(td::ColourRole::VeryGood, QStringLiteral("#118f17"));
set_colour(td::ColourRole::Text, QStringLiteral("#1D1D20"));
}

void InternalManager::set_dark_palette()
{
set_colour(td::ColourRole::Unknown, QStringLiteral("#2F2F32"));
set_colour(td::ColourRole::VeryBad, QStringLiteral("#7b1fa2"));
set_colour(td::ColourRole::Bad, QStringLiteral("#5e35b1"));
set_colour(td::ColourRole::Ok, QStringLiteral("#1976d2"));
set_colour(td::ColourRole::Good, QStringLiteral("#0097a7"));
set_colour(td::ColourRole::VeryGood, QStringLiteral("#4caf50"));
set_colour(td::ColourRole::VeryBad, QStringLiteral("#C43F31"));
set_colour(td::ColourRole::Bad, QStringLiteral("#DB9837"));
set_colour(td::ColourRole::Ok, QStringLiteral("#F0C400"));
set_colour(td::ColourRole::Good, QStringLiteral("#608A22"));
set_colour(td::ColourRole::VeryGood, QStringLiteral("#1F8023"));
set_colour(td::ColourRole::Text, QStringLiteral("#CACBCE"));
}
280 changes: 143 additions & 137 deletions src/gui/diaryeditor.cpp

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions src/gui/diaryeditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,20 @@ class DiaryEditor;
class DiaryEditor : public QWidget {
Q_OBJECT

signals:
void sig_re_render_buttons(td::CalendarButtonData const &data);
void sig_re_render(QDate const &date, bool const ignore_month_check);

public:
explicit DiaryEditor(QDate const &date, QWidget *parent = nullptr);
~DiaryEditor();

QDate current_date;
int current_month_offset;
int last_selected_day;
QShortcut *save_shortcut;
// Saves the state of the entry when it was first loaded. Used to decide if the save prompt needs showing.
td::Entry last_entry_snapshot;

public slots:
void update_theme();

// Calendar widget.
void render_month(QDate const &date, std::optional<td::YearMap::iterator> const &iter);
void setup_buttons();
void render_month(std::optional<td::YearMap::iterator> const &iter);
void change_month(QDate const &date);
void render_day(td::CalendarButtonData const &d, bool const set_info_pane);
void next_month();
Expand All @@ -62,14 +57,13 @@ public slots:

// Info pane.
void update_info_pane(QDate const &date, td::Entry const &entry);
void update_day(bool const suppress_error);
bool update_day(bool const suppress_error = false);
void delete_day();
void reset_day();

private:
Ui::DiaryEditor *ui;

DiaryCalendarButton *create_button(td::CalendarButtonData const &&d);
bool compare_snapshots();
};

Expand Down
237 changes: 79 additions & 158 deletions src/gui/diaryeditor.ui
Original file line number Diff line number Diff line change
Expand Up @@ -58,148 +58,16 @@
</property>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_7">
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>20</number>
</property>
<property name="verticalSpacing">
<number>10</number>
</property>
<item row="2" column="1">
<widget class="QPlainTextEdit" name="entry_edit">
<property name="toolTip">
<string>Message for this entry.</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Rating</string>
</property>
</widget>
</item>
<item row="2" column="0" alignment="Qt::AlignTop">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Entry</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="gridLayout_11">
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="special_box">
<property name="toolTip">
<string>Whether or not to mark this entry with a star.</string>
</property>
<property name="text">
<string>Important?</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_10">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QComboBox" name="rating_dropdown">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Determines the colour associated with this entry.</string>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Very bad</string>
</property>
</item>
<item>
<property name="text">
<string>Bad</string>
</property>
</item>
<item>
<property name="text">
<string>OK</string>
</property>
</item>
<item>
<property name="text">
<string>Good</string>
</property>
</item>
<item>
<property name="text">
<string>Very good</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="1">
<layout class="QGridLayout" name="gridLayout_13">
<property name="topMargin">
<number>15</number>
</property>
<property name="bottomMargin">
<number>15</number>
</property>
<property name="horizontalSpacing">
<number>15</number>
</property>
<property name="verticalSpacing">
<number>0</number>
<number>8</number>
</property>
<item row="0" column="3">
<spacer name="horizontalSpacer_7">
Expand Down Expand Up @@ -267,6 +135,66 @@
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="special_box">
<property name="toolTip">
<string>Whether or not to mark this entry with a star.</string>
</property>
<property name="text">
<string>Important?</string>
</property>
</widget>
</item>
<item row="2" column="0" alignment="Qt::AlignTop">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Entry</string>
</property>
</widget>
</item>
<item row="0" column="1" alignment="Qt::AlignLeft">
<widget class="QComboBox" name="rating_dropdown">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Determines the colour associated with this entry.</string>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Very bad</string>
</property>
</item>
<item>
<property name="text">
<string>Bad</string>
</property>
</item>
<item>
<property name="text">
<string>OK</string>
</property>
</item>
<item>
<property name="text">
<string>Good</string>
</property>
</item>
<item>
<property name="text">
<string>Very good</string>
</property>
</item>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="alert_text">
<property name="font">
Expand All @@ -279,17 +207,28 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPlainTextEdit" name="entry_edit">
<property name="toolTip">
<string>Message for this entry.</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Rating</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<property name="rightMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<property name="bottomMargin">
<number>10</number>
</property>
<item row="0" column="0">
Expand All @@ -316,22 +255,6 @@
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
Expand Down Expand Up @@ -772,8 +695,6 @@
<tabstop>month_dropdown</tabstop>
<tabstop>year_edit</tabstop>
<tabstop>next_month</tabstop>
<tabstop>rating_dropdown</tabstop>
<tabstop>special_box</tabstop>
<tabstop>entry_edit</tabstop>
<tabstop>update_button</tabstop>
<tabstop>delete_button</tabstop>
Expand Down
10 changes: 7 additions & 3 deletions src/gui/diaryentryviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ DiaryEntryViewer::DiaryEntryViewer(QWidget *parent) : QWidget(parent), ui(new Ui
Qt::QueuedConnection);
connect(InternalManager::instance(), &InternalManager::update_theme, this, &DiaryEntryViewer::update_theme,
Qt::QueuedConnection);
update_theme();

// current_date is initialised by &InternalManager::change_month signal.
}
Expand Down Expand Up @@ -122,6 +121,11 @@ void DiaryEntryViewer::change_month(QDate const &date)
.arg(generate_base64_icon(i.first, rating, important),
last_edited.toString("dddd MMMM d%1 yyyy 'at' h:mm:ss ap").arg(misc::get_day_suffix(i.first)),
misc::sanitise_html(misc::trim(copy))));
// html.append(
// QString(SINGLE_ROW)
// .arg(generate_base64_icon(i.first, rating, important),
// last_edited.toString("dddd MMMM d%1 yyyy 'at' h:mm:ss
// ap").arg(misc::get_day_suffix(i.first)), "PLACEHOLDER"));
html.append(HR_ROW);

++row_counter;
Expand Down Expand Up @@ -202,8 +206,8 @@ QPixmap DiaryEntryViewer::generate_background(td::Rating const rating)
QPainter p(&pixmap);
p.setRenderHint(QPainter::Antialiasing);

if (InternalManager::instance()->get_theme() == td::Theme::Light)
p.setOpacity(0.8);
// if (InternalManager::instance()->get_theme() == td::Theme::Light)
// p.setOpacity(0.8);

p.setPen(Qt::transparent);
p.setBrush(QBrush(colour));
Expand Down
Loading

0 comments on commit 80f0704

Please sign in to comment.