Skip to content

Commit

Permalink
finished implementing keepass xc theme
Browse files Browse the repository at this point in the history
- removed util widget cpp files (moved all the content to the header files)
- replace $GITHUB_SHA with ${{github.sha}} in windows build
- swap the directories of the image files
- add additional scope to gwrapper
- fix bug where gwrapper would ignore files of type x-gzip
- removed statecolorpalette class
- updated readme images
- incremented patch version
  • Loading branch information
someretical committed Jan 16, 2022
1 parent 526817d commit fffc413
Show file tree
Hide file tree
Showing 40 changed files with 665 additions and 783 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: qmake and nmake
run: |
echo $(git rev-parse --short "$GITHUB_SHA") > text\\REVISION.txt
echo $(git rev-parse --short "${{github.sha}}") > text\\REVISION.txt
type text\\REVISION.txt
qmake theoreticaldiary.pro CONFIG+=release
set CL=/MP
Expand Down
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/settings.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.
2 changes: 1 addition & 1 deletion images/themes/dark/eye_off.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/themes/dark/eye_on.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/themes/dark/star.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/themes/light/eye_off.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/themes/light/eye_on.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/themes/light/star.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/core/googlewrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

char const *CLIENT_ID = "71530390003-2fr89p1c0unpd1n169munqajeepnhdco.apps.googleusercontent.com";
char const *CLIENT_SECRET = "zuyjH1Cd_8pL4Q-OFNLjNCJ7";
char const *SCOPE = "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/drive.appdata";
char const *SCOPE = "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/drive.appdata "
"https://www.googleapis.com/auth/drive.file";
char const *REPLY_CONTENT =
"<HTML><body><h1 style=\"text-align: center\">Authorization flow completed. Feel free to close "
"this window.</h1></body></HTML>";
Expand Down Expand Up @@ -303,7 +304,7 @@ std::pair<QString, QString> GoogleWrapper::get_file_ids(QByteArray const &data)
}

for (auto const &file : json["files"]) {
if ("drive#file" == file["kind"] && "application/octet-stream" == file["mimeType"]) {
if ("drive#file" == file["kind"]) {
if ("diary.dat" == file["name"]) {
primary_backup_id = QString::fromStdString(file["id"]);
}
Expand Down
46 changes: 39 additions & 7 deletions src/core/internalmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,25 @@ void InternalManager::init_settings(const bool force_reset)
settings->setValue("lock_timeout", static_cast<qint64>(300000 /* 5 minutes */));
}

td::Theme InternalManager::get_theme()
td::Theme InternalManager::get_theme(bool const opposite)
{
return static_cast<td::Theme>(settings->value("theme").toInt());
if (opposite) {
return static_cast<td::Theme>(settings->value("theme").toInt()) == td::Theme::Dark ? td::Theme::Light
: td::Theme::Dark;
}
else {
return static_cast<td::Theme>(settings->value("theme").toInt());
}
}

QString InternalManager::get_theme_str()
QString InternalManager::get_theme_str(bool const opposite)
{
return QString(td::Theme::Light == get_theme() ? "light" : "dark");
if (opposite) {
return td::Theme::Light == get_theme() ? "dark" : "light";
}
else {
return td::Theme::Light == get_theme() ? "light" : "dark";
}
}

QString InternalManager::data_location()
Expand Down Expand Up @@ -104,20 +115,41 @@ void InternalManager::end_busy_mode(int const line, std::string const &func, std
void InternalManager::start_update_theme()
{
QPixmapCache::clear();
state_color_palette = StateColorPalette();

if (get_theme() == td::Theme::Dark) {
state_color_palette.initDefaultPaletteDark();
set_dark_palette();
auto s = new DarkStyle;
QApplication::setPalette(s->standardPalette());
QApplication::setStyle(s);
}
else {
state_color_palette.initDefaultPaletteLight();
set_light_palette();
auto s = new LightStyle;
QApplication::setPalette(s->standardPalette());
QApplication::setStyle(s);
}

emit 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::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::Text, QStringLiteral("#CACBCE"));
}
35 changes: 31 additions & 4 deletions src/core/internalmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <map>
#include <string>

#include "../gui/styles/statecolorpalette.h"
#include "../util/eventfilters.h"
#include "asyncfuture.h"
#include "json.hpp"
Expand Down Expand Up @@ -127,6 +126,22 @@ enum class Window { Main, Editor, Options };
enum class LinkingResponse { Fail, ScopeMismatch, OK };

using NRO = AsyncFuture::Observable<NR>;

struct CalendarButtonData {
std::optional<int> day;
std::optional<bool> important;
std::optional<td::Rating> rating;
std::optional<bool> selected;
std::optional<bool> current_day;
};

struct DiaryEntryIconData {
std::optional<int> day;
std::optional<td::Rating> rating;
std::optional<bool> important;
};

enum class ColourRole { Text, Unknown, VeryBad, Bad, Ok, Good, VeryGood };
} // namespace td

// The reason why this class exists is to redirect #include statements away from theoreticaldiary.h
Expand All @@ -149,18 +164,30 @@ class InternalManager : public QObject {
~InternalManager();
static InternalManager *instance();

QString get_theme_str();
td::Theme get_theme();
QString get_theme_str(bool const opposite = false);
td::Theme get_theme(bool const opposite = false);
QString data_location();
void start_busy_mode(int const line, std::string const &func, std::string const &file);
void end_busy_mode(int const line, std::string const &func, std::string const &file);
void init_settings(bool const force_reset);
void start_update_theme();
void set_dark_palette();
void set_light_palette();

inline void set_colour(td::ColourRole role, const QColor &colour)
{
colourmap[static_cast<int>(role)] = colour;
}

inline QColor colour(td::ColourRole role) const
{
return colourmap.value(static_cast<int>(role));
}

QHash<int, QColor> colourmap;
QSettings *settings;
InactiveFilter *inactive_filter;
BusyFilter busy_filter;
StateColorPalette state_color_palette;
bool app_busy;
bool internal_diary_changed;
bool diary_file_changed;
Expand Down
102 changes: 0 additions & 102 deletions src/gui/calendarbutton.cpp

This file was deleted.

56 changes: 0 additions & 56 deletions src/gui/calendarbutton.h

This file was deleted.

Loading

0 comments on commit fffc413

Please sign in to comment.