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