Skip to content

Commit

Permalink
Use Fusion style
Browse files Browse the repository at this point in the history
  • Loading branch information
Admiral-Fish committed Oct 12, 2024
1 parent e873165 commit 9cbcd67
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI - macOS
on:
push:
branches:
- 'master'
- "master"
tags:
- '*'
- "v[0-9]+\.[0-9]+\.[0-9]+"
pull_request:

jobs:
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: "6.7.1"
version: "6.8.0"
archives: qtbase qtsvg qttools
cache: true

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI - Ubuntu
on:
push:
branches:
- 'master'
- "master"
tags:
- '*'
- "v[0-9]+\.[0-9]+\.[0-9]+"
pull_request:

jobs:
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: "6.7.1"
version: "6.8.0"
archives: icu qtbase qtsvg qttools
cache: true

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI - Windows
on:
push:
branches:
- 'master'
- "master"
tags:
- '*'
- "v[0-9]+\.[0-9]+\.[0-9]+"
pull_request:

jobs:
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: "6.7.1"
version: "6.8.0"
archives: qtbase qtsvg qttools
tools: tools_opensslv3_x64
cache: true
Expand Down
5 changes: 1 addition & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "External/bzip2"]
[submodule "Source/Core/External/bzip2"]
path = Source/Core/External/bzip2
url = https://gitlab.com/bzip2/bzip2
[submodule "External/QDarkStyleSheet"]
path = Source/Form/External/QDarkStyleSheet
url = https://github.com/ColinDuquesnoy/QDarkStyleSheet
[submodule "Source/Core/Resources/EncounterTables"]
path = Source/Core/Resources/EncounterTables
url = https://github.com/Admiral-Fish/EncounterTableGenerator
2 changes: 0 additions & 2 deletions Source/Form/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ set(PROJECT_TS
)

set(PROJECT_QRC
External/QDarkStyleSheet/qdarkstyle/dark/darkstyle.qrc
External/QDarkStyleSheet/qdarkstyle/light/lightstyle.qrc
resources.qrc
)

Expand Down
1 change: 0 additions & 1 deletion Source/Form/External/QDarkStyleSheet
Submodule QDarkStyleSheet deleted from 969fd6
2 changes: 1 addition & 1 deletion Source/Form/Util/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Settings::Settings(QWidget *parent) : QWidget(parent), ui(new Ui::Settings)

// Style
QString style = setting.value("style").toString();
QStringList styles = { "dark", "light" };
QStringList styles = { "auto", "dark", "light" };
for (int i = 0; i < styles.size(); i++)
{
const QString &sty = styles[i];
Expand Down
5 changes: 5 additions & 0 deletions Source/Form/Util/Settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBoxStyle">
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
<item>
<property name="text">
<string>Dark</string>
Expand Down
41 changes: 23 additions & 18 deletions Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <QHeaderView>
#include <QSettings>
#include <QStandardPaths>
#include <QStyleHints>
#include <QThread>
#include <QTranslator>

Expand All @@ -35,7 +36,7 @@
*/
void validateSettings(QSettings &setting)
{
if (!setting.contains("settings/profiles"))
if (!setting.contains("profiles"))
{
QString profilePath = QString("%1/profiles.json").arg(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));

Expand All @@ -45,27 +46,27 @@ void validateSettings(QSettings &setting)
f.write("{}");
}

setting.setValue("settings/profiles", profilePath);
setting.setValue("profiles", profilePath);
}

if (!setting.contains("settings/style"))
if (!setting.contains("style"))
{
setting.setValue("settings/style", "dark");
setting.setValue("style", "auto");
}

if (!setting.contains("settings/locale"))
if (!setting.contains("locale"))
{
setting.setValue("settings/locale", "en");
setting.setValue("locale", "en");
}

if (!setting.contains("settings/headerSize"))
if (!setting.contains("headerSize"))
{
setting.setValue("settings/headerSize", QHeaderView::ResizeToContents);
setting.setValue("headerSize", QHeaderView::ResizeToContents);
}

if (!setting.contains("settings/threads") || (setting.value("settings/threads").toInt() > QThread::idealThreadCount()))
if (!setting.contains("threads") || (setting.value("threads").toInt() > QThread::idealThreadCount()))
{
setting.setValue("settings/threads", QThread::idealThreadCount());
setting.setValue("threads", QThread::idealThreadCount());
}
}

Expand All @@ -83,25 +84,29 @@ int main(int argc, char *argv[])
a.setApplicationName("PokeFinder");
a.setOrganizationName("PokeFinder Team");

Q_INIT_RESOURCE(darkstyle);
Q_INIT_RESOURCE(i18n);
Q_INIT_RESOURCE(lightstyle);
Q_INIT_RESOURCE(resources);

QSettings setting;
setting.beginGroup("settings");
validateSettings(setting);

QString profilePath = setting.value("settings/profiles").toString();
QString profilePath = setting.value("profiles").toString();
bool profile = ProfileLoader::init(profilePath.toStdWString());

QFile file(QString(":/qdarkstyle/%1/%1style.qss").arg(setting.value("settings/style").toString()));
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
a.setStyle("fusion");
if (setting.value("style").toString() == "dark")
{
QTextStream ts(&file);
a.setStyleSheet(ts.readAll());
auto hints = a.styleHints();
hints->setColorScheme(Qt::ColorScheme::Dark);
}
else if (setting.value("style").toString() == "light")
{
auto hints = a.styleHints();
hints->setColorScheme(Qt::ColorScheme::Light);
}

QString locale = setting.value("settings/locale").toString();
QString locale = setting.value("locale").toString();
Translator::init(locale.toStdString());

QTranslator translator;
Expand Down

0 comments on commit 9cbcd67

Please sign in to comment.