mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-19 09:41:32 +08:00
Merge pull request #1788 from cg2121/rename-default-theme
UI: Rename Default theme to System
This commit is contained in:
@@ -86,6 +86,7 @@ ShowInMultiview="Show in Multiview"
|
||||
VerticalLayout="Vertical Layout"
|
||||
Group="Group"
|
||||
DoNotShowAgain="Do not show again"
|
||||
Default="(Default)"
|
||||
|
||||
# warning if program already open
|
||||
AlreadyRunning.Title="OBS is already running"
|
||||
|
||||
+10
-4
@@ -54,6 +54,8 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "ui-config.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
static log_handler_t def_log_handler;
|
||||
@@ -423,7 +425,7 @@ bool OBSApp::InitGlobalConfigDefaults()
|
||||
|
||||
if (!config_get_bool(globalConfig, "General", "Pre21Defaults")) {
|
||||
config_set_default_string(globalConfig, "General",
|
||||
"CurrentTheme", "Dark");
|
||||
"CurrentTheme", DEFAULT_THEME);
|
||||
}
|
||||
|
||||
config_set_default_bool(globalConfig, "BasicWindow",
|
||||
@@ -1026,18 +1028,22 @@ bool OBSApp::InitTheme()
|
||||
|
||||
const char *themeName = config_get_string(globalConfig, "General",
|
||||
"CurrentTheme");
|
||||
|
||||
if (strcmp(themeName, "Default") == 0)
|
||||
themeName = "System";
|
||||
|
||||
if (!themeName) {
|
||||
/* Use deprecated "Theme" value if available */
|
||||
themeName = config_get_string(globalConfig,
|
||||
"General", "Theme");
|
||||
if (!themeName)
|
||||
themeName = "Default";
|
||||
themeName = DEFAULT_THEME;
|
||||
}
|
||||
|
||||
if (strcmp(themeName, "Default") != 0 && SetTheme(themeName))
|
||||
if (strcmp(themeName, DEFAULT_THEME) != 0 && SetTheme(themeName))
|
||||
return true;
|
||||
|
||||
return SetTheme("Default");
|
||||
return SetTheme(DEFAULT_THEME);
|
||||
}
|
||||
|
||||
OBSApp::OBSApp(int &argc, char **argv, profiler_name_store_t *store)
|
||||
|
||||
@@ -27,3 +27,5 @@
|
||||
#define RESTREAM_ENABLED @RESTREAM_ENABLED@
|
||||
#define RESTREAM_CLIENTID "@RESTREAM_CLIENTID@"
|
||||
#define RESTREAM_HASH 0x@RESTREAM_HASH@
|
||||
|
||||
#define DEFAULT_THEME "Dark"
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "window-projector.hpp"
|
||||
|
||||
#include <util/platform.h>
|
||||
#include "ui-config.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -1003,17 +1004,31 @@ void OBSBasicSettings::LoadThemeList()
|
||||
}
|
||||
}
|
||||
|
||||
QString defaultTheme;
|
||||
defaultTheme += DEFAULT_THEME;
|
||||
defaultTheme += " ";
|
||||
defaultTheme += QTStr("Default");
|
||||
|
||||
/* Check shipped themes. */
|
||||
QDirIterator uIt(QString(themeDir.c_str()), QStringList() << "*.qss",
|
||||
QDir::Files);
|
||||
while (uIt.hasNext()) {
|
||||
uIt.next();
|
||||
QString name = uIt.fileName().section(".",0,0);
|
||||
if (!uniqueSet.contains(name))
|
||||
|
||||
if (name == DEFAULT_THEME)
|
||||
name = defaultTheme;
|
||||
|
||||
if (!uniqueSet.contains(name) && name != "Default")
|
||||
ui->theme->addItem(name);
|
||||
}
|
||||
|
||||
int idx = ui->theme->findText(App()->GetTheme());
|
||||
const char *themeName = App()->GetTheme();
|
||||
|
||||
if (strcmp(themeName, DEFAULT_THEME) == 0)
|
||||
themeName = QT_TO_UTF8(defaultTheme);
|
||||
|
||||
int idx = ui->theme->findText(themeName);
|
||||
if (idx != -1)
|
||||
ui->theme->setCurrentIndex(idx);
|
||||
}
|
||||
@@ -2657,13 +2672,19 @@ void OBSBasicSettings::SaveGeneralSettings()
|
||||
|
||||
int themeIndex = ui->theme->currentIndex();
|
||||
QString themeData = ui->theme->itemText(themeIndex);
|
||||
string theme = themeData.toStdString();
|
||||
QString defaultTheme;
|
||||
defaultTheme += DEFAULT_THEME;
|
||||
defaultTheme += " ";
|
||||
defaultTheme += QTStr("Default");
|
||||
|
||||
if (themeData == defaultTheme)
|
||||
themeData = DEFAULT_THEME;
|
||||
|
||||
if (WidgetChanged(ui->theme)) {
|
||||
config_set_string(GetGlobalConfig(), "General", "CurrentTheme",
|
||||
theme.c_str());
|
||||
QT_TO_UTF8(themeData));
|
||||
|
||||
App()->SetTheme(theme);
|
||||
App()->SetTheme(themeData.toUtf8().constData());
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
@@ -3392,8 +3413,17 @@ void OBSBasicSettings::closeEvent(QCloseEvent *event)
|
||||
|
||||
void OBSBasicSettings::on_theme_activated(int idx)
|
||||
{
|
||||
string currT = ui->theme->itemText(idx).toStdString();
|
||||
App()->SetTheme(currT);
|
||||
QString currT = ui->theme->itemText(idx);
|
||||
|
||||
QString defaultTheme;
|
||||
defaultTheme += DEFAULT_THEME;
|
||||
defaultTheme += " ";
|
||||
defaultTheme += QTStr("Default");
|
||||
|
||||
if (currT == defaultTheme)
|
||||
currT = DEFAULT_THEME;
|
||||
|
||||
App()->SetTheme(currT.toUtf8().constData());
|
||||
}
|
||||
|
||||
void OBSBasicSettings::on_listWidget_itemSelectionChanged()
|
||||
|
||||
Reference in New Issue
Block a user