Qt: Add light fusion and blue dark fusion themes

This commit is contained in:
Connor McLaughlin 2020-09-24 00:19:54 +10:00
parent 692c2d4aff
commit 03b55efea6
3 changed files with 64 additions and 1 deletions

View File

@ -695,6 +695,7 @@ void MainWindow::connectSignals()
connect(m_ui.actionAbout, &QAction::triggered, this, &MainWindow::onAboutActionTriggered);
connect(m_ui.actionCheckForUpdates, &QAction::triggered, this, &MainWindow::onCheckForUpdatesActionTriggered);
connect(m_ui.actionMemory_Card_Editor, &QAction::triggered, this, &MainWindow::onToolsMemoryCardEditorTriggered);
connect(m_ui.actionOpenDataDirectory, &QAction::triggered, this, &MainWindow::onToolsOpenDataDirectoryTriggered);
connect(m_ui.actionGridViewShowTitles, &QAction::triggered, m_game_list_widget, &GameListWidget::setShowCoverTitles);
connect(m_ui.actionGridViewZoomIn, &QAction::triggered, m_game_list_widget, [this]() {
if (isShowingGameList())
@ -766,7 +767,9 @@ void MainWindow::connectSignals()
"ShowMDECState");
addThemeToMenu(tr("Default"), QStringLiteral("default"));
addThemeToMenu(tr("DarkFusion"), QStringLiteral("darkfusion"));
addThemeToMenu(tr("Fusion"), QStringLiteral("fusion"));
addThemeToMenu(tr("Dark Fusion (Gray)"), QStringLiteral("darkfusion"));
addThemeToMenu(tr("Dark Fusion (Blue)"), QStringLiteral("darkfusionblue"));
addThemeToMenu(tr("QDarkStyle"), QStringLiteral("qdarkstyle"));
}
@ -796,6 +799,12 @@ void MainWindow::updateTheme()
if (f.open(QFile::ReadOnly | QFile::Text))
qApp->setStyleSheet(f.readAll());
}
else if (theme == QStringLiteral("fusion"))
{
qApp->setPalette(QApplication::style()->standardPalette());
qApp->setStyleSheet(QString());
qApp->setStyle(QStyleFactory::create("Fusion"));
}
else if (theme == QStringLiteral("darkfusion"))
{
// adapted from https://gist.github.com/QuantumCD/6245215
@ -831,6 +840,42 @@ void MainWindow::updateTheme()
qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }");
}
else if (theme == QStringLiteral("darkfusionblue"))
{
// adapted from https://gist.github.com/QuantumCD/6245215
qApp->setStyle(QStyleFactory::create("Fusion"));
const QColor lighterGray(75, 75, 75);
const QColor darkGray(53, 53, 53);
const QColor gray(128, 128, 128);
const QColor black(25, 25, 25);
const QColor blue(198, 238, 255);
const QColor blue2(0, 88, 208);
QPalette darkPalette;
darkPalette.setColor(QPalette::Window, darkGray);
darkPalette.setColor(QPalette::WindowText, Qt::white);
darkPalette.setColor(QPalette::Base, black);
darkPalette.setColor(QPalette::AlternateBase, darkGray);
darkPalette.setColor(QPalette::ToolTipBase, blue2);
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
darkPalette.setColor(QPalette::Text, Qt::white);
darkPalette.setColor(QPalette::Button, darkGray);
darkPalette.setColor(QPalette::ButtonText, Qt::white);
darkPalette.setColor(QPalette::Link, blue);
darkPalette.setColor(QPalette::Highlight, blue2);
darkPalette.setColor(QPalette::HighlightedText, Qt::white);
darkPalette.setColor(QPalette::Active, QPalette::Button, gray.darker());
darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, gray);
darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, gray);
darkPalette.setColor(QPalette::Disabled, QPalette::Text, gray);
darkPalette.setColor(QPalette::Disabled, QPalette::Light, darkGray);
qApp->setPalette(darkPalette);
qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }");
}
else
{
qApp->setPalette(QApplication::style()->standardPalette());
@ -1001,6 +1046,11 @@ void MainWindow::onToolsMemoryCardEditorTriggered()
m_memory_card_editor_dialog->show();
}
void MainWindow::onToolsOpenDataDirectoryTriggered()
{
QtUtils::OpenURL(this, QUrl::fromLocalFile(m_host_interface->getUserDirectoryRelativePath(QString())));
}
void MainWindow::checkForUpdates(bool display_message)
{
if (!AutoUpdaterDialog::isSupported())

View File

@ -75,6 +75,7 @@ private Q_SLOTS:
void onAboutActionTriggered();
void onCheckForUpdatesActionTriggered();
void onToolsMemoryCardEditorTriggered();
void onToolsOpenDataDirectoryTriggered();
void onGameListEntrySelected(const GameListEntry* entry);
void onGameListEntryDoubleClicked(const GameListEntry* entry);

View File

@ -196,6 +196,8 @@
<string>&amp;Tools</string>
</property>
<addaction name="actionMemory_Card_Editor"/>
<addaction name="separator"/>
<addaction name="actionOpenDataDirectory"/>
</widget>
<addaction name="menuSystem"/>
<addaction name="menuSettings"/>
@ -712,6 +714,16 @@
<string>Refresh &amp;Covers (Grid View)</string>
</property>
</action>
<action name="actionOpen_Memory_Card_Directory">
<property name="text">
<string>Open Memory Card Directory...</string>
</property>
</action>
<action name="actionOpenDataDirectory">
<property name="text">
<string>Open Data Directory...</string>
</property>
</action>
</widget>
<resources>
<include location="resources/resources.qrc"/>