mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 09:55:55 +00:00
Improved application style handling
This commit is contained in:
parent
09c48539ad
commit
e9ad58a373
@ -155,7 +155,7 @@ void sigabrtHandler(int) {
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
void useStyle(QApplication *app, QString style){
|
||||
if(style != "default") {
|
||||
if(!style.isEmpty()) {
|
||||
QApplication::setStyle(QStyleFactory::create(style));
|
||||
}
|
||||
if(app->style()->objectName() == "cleanlooks") {
|
||||
@ -163,6 +163,7 @@ void useStyle(QApplication *app, QString style){
|
||||
qDebug("Forcing our own cleanlooks style");
|
||||
app->setStyle(new QGnomeLookStyle());
|
||||
}
|
||||
Preferences::setStyle(app->style()->objectName());
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -249,8 +250,7 @@ int main(int argc, char *argv[]){
|
||||
app = new QApplication(argc, argv);
|
||||
#endif
|
||||
#ifndef DISABLE_GUI
|
||||
Preferences::setDefaultStyle(app->style()->objectName());
|
||||
useStyle(app, settings.value("Preferences/General/Style", "default").toString());
|
||||
useStyle(app, settings.value("Preferences/General/Style", "").toString());
|
||||
app->setStyleSheet("QStatusBar::item { border-width: 0; }");
|
||||
QSplashScreen *splash = 0;
|
||||
if(!no_splash) {
|
||||
|
@ -291,11 +291,7 @@ void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous
|
||||
}
|
||||
|
||||
void options_imp::useStyle() {
|
||||
if(comboStyle->currentIndex() == 0) {
|
||||
QApplication::setStyle(Preferences::getDefaultStyle());
|
||||
} else {
|
||||
QApplication::setStyle(QStyleFactory::create(comboStyle->itemText(comboStyle->currentIndex())));
|
||||
}
|
||||
QApplication::setStyle(QStyleFactory::create(comboStyle->itemText(comboStyle->currentIndex())));
|
||||
if(QApplication::style()->objectName() == "cleanlooks") {
|
||||
// Force our own cleanlooks style
|
||||
qDebug("Forcing our own cleanlooks style");
|
||||
@ -539,18 +535,13 @@ int options_imp::getHTTPProxyType() const {
|
||||
}
|
||||
|
||||
QString options_imp::getStyle() const{
|
||||
if(comboStyle->currentIndex() == 0)
|
||||
return "default";
|
||||
else
|
||||
return comboStyle->itemText(comboStyle->currentIndex());
|
||||
return comboStyle->itemText(comboStyle->currentIndex());
|
||||
}
|
||||
|
||||
void options_imp::setStyle(QString style) {
|
||||
if(style != "default") {
|
||||
int index = comboStyle->findText(style);
|
||||
if(index > 0)
|
||||
comboStyle->setCurrentIndex(index);
|
||||
}
|
||||
int index = comboStyle->findText(style, Qt::MatchFixedString);
|
||||
if(index > 0)
|
||||
comboStyle->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
bool options_imp::isHTTPProxyAuthEnabled() const{
|
||||
|
@ -53,19 +53,14 @@ public:
|
||||
settings.setValue(QString::fromUtf8("Preferences/General/Locale"), locale);
|
||||
}
|
||||
|
||||
static QString getDefaultStyle() {
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
return settings.value(QString::fromUtf8("Preferences/General/DefaultStyle"), "").toString();
|
||||
}
|
||||
|
||||
static void setDefaultStyle(QString style) {
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
settings.setValue(QString::fromUtf8("Preferences/General/DefaultStyle"), style);
|
||||
}
|
||||
|
||||
static QString getStyle() {
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
return settings.value(QString::fromUtf8("Preferences/General/Style"), "default").toString();
|
||||
return settings.value(QString::fromUtf8("Preferences/General/Style"), "").toString();
|
||||
}
|
||||
|
||||
static void setStyle(QString style) {
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
settings.setValue(QString::fromUtf8("Preferences/General/Style"), style);
|
||||
}
|
||||
|
||||
static bool confirmOnExit() {
|
||||
|
@ -330,13 +330,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboStyle">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>System default</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboStyle"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
|
Loading…
x
Reference in New Issue
Block a user