mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-22 09:16:05 +03:00
- COSMETIC: Improved style management
This commit is contained in:
parent
3693ecdd30
commit
09c48539ad
6 changed files with 47 additions and 109 deletions
|
@ -8,6 +8,7 @@
|
|||
- FEATURE: User can choose to apply transfer limits on LAN too
|
||||
- FEATURE: User can choose to include the protocol overhead in transfer limits
|
||||
- FEATURE: Torrents can be automatically rechecked on completion
|
||||
- COSMETIC: Improved style management
|
||||
|
||||
* Mon Jan 18 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.1.0
|
||||
- FEATURE: Graphical User Interface can be disabled at compilation time (headless running)
|
||||
|
|
43
src/main.cpp
43
src/main.cpp
|
@ -35,17 +35,9 @@
|
|||
#ifndef DISABLE_GUI
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QStyleFactory>
|
||||
#include <QSplashScreen>
|
||||
#include <QPlastiqueStyle>
|
||||
#include "qgnomelook.h"
|
||||
#include <QMotifStyle>
|
||||
#include <QCDEStyle>
|
||||
#ifdef Q_WS_WIN
|
||||
#include <QWindowsXPStyle>
|
||||
#endif
|
||||
#ifdef Q_WS_MAC
|
||||
#include <QMacStyle>
|
||||
#endif
|
||||
#include "GUI.h"
|
||||
#include "ico.h"
|
||||
#else
|
||||
|
@ -162,38 +154,16 @@ void sigabrtHandler(int) {
|
|||
#endif
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
void useStyle(QApplication *app, int style){
|
||||
switch(style) {
|
||||
case 1:
|
||||
app->setStyle(new QPlastiqueStyle());
|
||||
break;
|
||||
case 2:
|
||||
app->setStyle(new QGnomeLookStyle());
|
||||
break;
|
||||
case 3:
|
||||
app->setStyle(new QMotifStyle());
|
||||
break;
|
||||
case 4:
|
||||
app->setStyle(new QCDEStyle());
|
||||
break;
|
||||
#ifdef Q_WS_MAC
|
||||
case 5:
|
||||
app->setStyle(new QMacStyle());
|
||||
break;
|
||||
#endif
|
||||
#ifdef Q_WS_WIN
|
||||
case 6:
|
||||
app->setStyle(new QWindowsXPStyle());
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
void useStyle(QApplication *app, QString style){
|
||||
if(style != "default") {
|
||||
QApplication::setStyle(QStyleFactory::create(style));
|
||||
}
|
||||
if(app->style()->objectName() == "cleanlooks") {
|
||||
// Force our own cleanlooks style
|
||||
qDebug("Forcing our own cleanlooks style");
|
||||
app->setStyle(new QGnomeLookStyle());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Main
|
||||
|
@ -279,7 +249,8 @@ int main(int argc, char *argv[]){
|
|||
app = new QApplication(argc, argv);
|
||||
#endif
|
||||
#ifndef DISABLE_GUI
|
||||
useStyle(app, settings.value("Preferences/General/Style", 0).toInt());
|
||||
Preferences::setDefaultStyle(app->style()->objectName());
|
||||
useStyle(app, settings.value("Preferences/General/Style", "default").toString());
|
||||
app->setStyleSheet("QStatusBar::item { border-width: 0; }");
|
||||
QSplashScreen *splash = 0;
|
||||
if(!no_splash) {
|
||||
|
|
|
@ -34,20 +34,11 @@
|
|||
#include <QSystemTrayIcon>
|
||||
#include <QApplication>
|
||||
#include <QSettings>
|
||||
#include <QPlastiqueStyle>
|
||||
#include "qgnomelook.h"
|
||||
#include <QMotifStyle>
|
||||
#include <QCDEStyle>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QDesktopWidget>
|
||||
#ifdef Q_WS_WIN
|
||||
#include <QWindowsXPStyle>
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#include <QMacStyle>
|
||||
#endif
|
||||
#include <QStyleFactory>
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -72,12 +63,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
}
|
||||
}
|
||||
connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(applySettings(QAbstractButton*)));
|
||||
#ifdef Q_WS_WIN
|
||||
comboStyle->addItem("Windows XP Style (Windows Only)");
|
||||
#endif
|
||||
#ifdef Q_WS_MAC
|
||||
comboStyle->addItem("MacOS Style (MacOS Only)");
|
||||
#endif
|
||||
comboStyle->addItems(QStyleFactory::keys());
|
||||
// Languages supported
|
||||
comboI18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/united_kingdom.png"))), QString::fromUtf8("English"));
|
||||
locales << "en_GB";
|
||||
|
@ -305,30 +291,15 @@ void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous
|
|||
}
|
||||
|
||||
void options_imp::useStyle() {
|
||||
int style = getStyle();
|
||||
switch(style) {
|
||||
case 1:
|
||||
QApplication::setStyle(new QPlastiqueStyle());
|
||||
break;
|
||||
case 2:
|
||||
if(comboStyle->currentIndex() == 0) {
|
||||
QApplication::setStyle(Preferences::getDefaultStyle());
|
||||
} else {
|
||||
QApplication::setStyle(QStyleFactory::create(comboStyle->itemText(comboStyle->currentIndex())));
|
||||
}
|
||||
if(QApplication::style()->objectName() == "cleanlooks") {
|
||||
// Force our own cleanlooks style
|
||||
qDebug("Forcing our own cleanlooks style");
|
||||
QApplication::setStyle(new QGnomeLookStyle());
|
||||
break;
|
||||
case 3:
|
||||
QApplication::setStyle(new QMotifStyle());
|
||||
break;
|
||||
case 4:
|
||||
QApplication::setStyle(new QCDEStyle());
|
||||
break;
|
||||
#ifdef Q_WS_MAC
|
||||
case 5:
|
||||
QApplication::setStyle(new QMacStyle());
|
||||
break;
|
||||
#endif
|
||||
#ifdef Q_WS_WIN
|
||||
case 6:
|
||||
QApplication::setStyle(new QWindowsXPStyle());
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -567,14 +538,19 @@ int options_imp::getHTTPProxyType() const {
|
|||
}
|
||||
}
|
||||
|
||||
int options_imp::getStyle() const{
|
||||
return comboStyle->currentIndex();
|
||||
QString options_imp::getStyle() const{
|
||||
if(comboStyle->currentIndex() == 0)
|
||||
return "default";
|
||||
else
|
||||
return comboStyle->itemText(comboStyle->currentIndex());
|
||||
}
|
||||
|
||||
void options_imp::setStyle(int style){
|
||||
if(style >= comboStyle->count() || style < 0)
|
||||
style = 0;
|
||||
comboStyle->setCurrentIndex(style);
|
||||
void options_imp::setStyle(QString style) {
|
||||
if(style != "default") {
|
||||
int index = comboStyle->findText(style);
|
||||
if(index > 0)
|
||||
comboStyle->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
bool options_imp::isHTTPProxyAuthEnabled() const{
|
||||
|
|
|
@ -65,7 +65,7 @@ protected:
|
|||
void loadOptions();
|
||||
// General options
|
||||
QString getLocale() const;
|
||||
int getStyle() const;
|
||||
QString getStyle() const;
|
||||
bool confirmOnExit() const;
|
||||
bool speedInTitleBar() const;
|
||||
bool systrayIntegration() const;
|
||||
|
@ -154,7 +154,7 @@ protected slots:
|
|||
void enableDHTPortSettings(bool checked);
|
||||
void enableQueueingSystem(bool checked);
|
||||
void enableSpoofingSettings(int index);
|
||||
void setStyle(int style);
|
||||
void setStyle(QString style);
|
||||
void on_buttonBox_accepted();
|
||||
void closeEvent(QCloseEvent *e);
|
||||
void on_buttonBox_rejected();
|
||||
|
|
|
@ -53,9 +53,19 @@ public:
|
|||
settings.setValue(QString::fromUtf8("Preferences/General/Locale"), locale);
|
||||
}
|
||||
|
||||
static int getStyle() {
|
||||
static QString getDefaultStyle() {
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
return settings.value(QString::fromUtf8("Preferences/General/Style"), 0).toInt();
|
||||
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();
|
||||
}
|
||||
|
||||
static bool confirmOnExit() {
|
||||
|
|
|
@ -336,26 +336,6 @@
|
|||
<string>System default</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Plastique style (KDE like)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Cleanlooks style (Gnome like)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Motif style (Unix like)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CDE style (Common Desktop Environment like)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
Loading…
Reference in a new issue