FEATURE: Inhibit system sleep when torrents are active (Vladimir Golovnev)

Remove visual style settings
This commit is contained in:
Christophe Dumez
2011-02-06 14:27:34 +00:00
parent b45171ba43
commit 0f1473e212
16 changed files with 573 additions and 182 deletions

View File

@@ -241,7 +241,7 @@ protected slots:
connect(txt_network_address, SIGNAL(textChanged(QString)), this, SLOT(emitSettingsChanged()));
setCellWidget(NETWORK_ADDRESS, VALUE, txt_network_address);
// Program notifications
setItem(PROGRAM_NOTIFICATIONS, PROPERTY, new QTableWidgetItem(tr("Display program notification balloons")));
setItem(PROGRAM_NOTIFICATIONS, PROPERTY, new QTableWidgetItem(tr("Display program on-screen notifications")));
cb_program_notifications = new QCheckBox();
connect(cb_program_notifications, SIGNAL(toggled(bool)), this, SLOT(emitSettingsChanged()));
cb_program_notifications->setChecked(pref.useProgramNotification());

View File

@@ -40,16 +40,10 @@
</property>
<property name="iconSize">
<size>
<width>30</width>
<height>30</height>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="textElideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="flow">
<enum>QListView::LeftToRight</enum>
</property>
@@ -59,24 +53,18 @@
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="layoutMode">
<enum>QListView::SinglePass</enum>
</property>
<property name="spacing">
<number>0</number>
<number>4</number>
</property>
<property name="gridSize">
<size>
<width>107</width>
<width>110</width>
<height>60</height>
</size>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
@@ -88,10 +76,10 @@
</property>
<item>
<property name="text">
<string extracomment="User Interface">UI</string>
<string>Behavior</string>
</property>
<property name="toolTip">
<string>User Interface</string>
<string>Behavior</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
@@ -126,6 +114,9 @@
<property name="text">
<string>Speed</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item>
<property name="text">
@@ -153,6 +144,9 @@
<property name="text">
<string>Advanced</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
</widget>
<widget class="QStackedWidget" name="tabOption">
@@ -176,16 +170,16 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>506</width>
<height>430</height>
<y>-45</y>
<width>499</width>
<height>459</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QGroupBox" name="UISettingsBox">
<property name="title">
<string>Visual Appearance</string>
<string>Language</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="bottomMargin">
@@ -193,13 +187,6 @@
</property>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="lblI18n">
<property name="text">
<string>Language:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboI18n">
<property name="minimumSize">
@@ -247,33 +234,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="lblStyle">
<property name="text">
<string>Visual style:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboStyle"/>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
@@ -450,6 +410,22 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Power Management</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<widget class="QCheckBox" name="checkPreventFromSuspend">
<property name="text">
<string>Inhibit system sleep when torrents are active</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
@@ -481,7 +457,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>506</width>
<width>440</width>
<height>698</height>
</rect>
</property>
@@ -924,7 +900,7 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>506</width>
<width>447</width>
<height>457</height>
</rect>
</property>
@@ -1404,8 +1380,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<height>414</height>
<width>404</width>
<height>334</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">
@@ -1793,7 +1769,7 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>581</width>
<width>542</width>
<height>422</height>
</rect>
</property>
@@ -2176,7 +2152,7 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>377</width>
<width>378</width>
<height>229</height>
</rect>
</property>
@@ -2339,8 +2315,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>28</height>
<width>80</width>
<height>18</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_36"/>
@@ -2387,7 +2363,6 @@ QGroupBox {
<tabstops>
<tabstop>tabOption</tabstop>
<tabstop>comboI18n</tabstop>
<tabstop>comboStyle</tabstop>
<tabstop>checkCloseToSystray</tabstop>
<tabstop>checkMinimizeToSysTray</tabstop>
<tabstop>textSavePath</tabstop>

View File

@@ -36,7 +36,6 @@
#include <QDialogButtonBox>
#include <QCloseEvent>
#include <QDesktopWidget>
#include <QStyleFactory>
#include <QTranslator>
#include <libtorrent/version.hpp>
@@ -88,7 +87,6 @@ options_imp::options_imp(QWidget *parent):
connect(scanFoldersView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(handleScanFolderViewSelectionChanged()));
connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(applySettings(QAbstractButton*)));
comboStyle->addItems(QStyleFactory::keys());
// Languages supported
initializeLanguageCombo();
@@ -126,13 +124,13 @@ options_imp::options_imp(QWidget *parent):
// Apply button is activated when a value is changed
// General tab
connect(comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(comboStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkStartMinimized, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkShowSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkPreventFromSuspend, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
// Downloads tab
connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(textTempPath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
@@ -251,10 +249,6 @@ void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous
tabOption->setCurrentIndex(tabSelection->row(current));
}
void options_imp::useStyle() {
QApplication::setStyle(QStyleFactory::create(comboStyle->itemText(comboStyle->currentIndex())));
}
void options_imp::loadWindowState() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
resize(settings.value(QString::fromUtf8("Preferences/State/size"), sizeFittingScreen()).toSize());
@@ -308,8 +302,6 @@ QSize options_imp::sizeFittingScreen() {
void options_imp::saveOptions(){
applyButton->setEnabled(false);
Preferences pref;
// Apply style
useStyle();
// Load the translation
QString locale = getLocale();
if(pref.getLocale() != locale) {
@@ -324,13 +316,13 @@ void options_imp::saveOptions(){
// General preferences
pref.setLocale(locale);
pref.setStyle(getStyle());
pref.setAlternatingRowColors(checkAltRowColors->isChecked());
pref.setSystrayIntegration(systrayIntegration());
pref.setCloseToTray(closeToTray());
pref.setMinimizeToTray(minimizeToTray());
pref.setStartMinimized(startMinimized());
pref.setSplashScreenDisabled(isSlashScreenDisabled());
pref.setPreventFromSuspend(preventFromSuspend());
// End General preferences
// Downloads preferences
@@ -455,16 +447,6 @@ int options_imp::getProxyType() const{
}
}
QString options_imp::getStyle() const{
return comboStyle->itemText(comboStyle->currentIndex());
}
void options_imp::setStyle(QString style) {
int index = comboStyle->findText(style, Qt::MatchFixedString);
if(index > 0)
comboStyle->setCurrentIndex(index);
}
void options_imp::loadOptions(){
int intValue;
qreal floatValue;
@@ -472,7 +454,6 @@ void options_imp::loadOptions(){
// General preferences
const Preferences pref;
setLocale(pref.getLocale());
setStyle(pref.getStyle());
checkAltRowColors->setChecked(pref.useAlternatingRowColors());
checkShowSystray->setChecked(pref.systrayIntegration());
checkShowSplash->setChecked(!pref.isSlashScreenDisabled());
@@ -484,6 +465,7 @@ void options_imp::loadOptions(){
checkMinimizeToSysTray->setChecked(pref.minimizeToTray());
checkStartMinimized->setChecked(pref.startMinimized());
}
checkPreventFromSuspend->setChecked(pref.preventFromSuspend());
// End General preferences
// Downloads preferences
QString save_path = pref.getSavePath();
@@ -928,6 +910,10 @@ bool options_imp::isSlashScreenDisabled() const {
return !checkShowSplash->isChecked();
}
bool options_imp::preventFromSuspend() const {
return checkPreventFromSuspend->isChecked();
}
bool options_imp::preAllocateAllFiles() const {
return checkPreallocateAll->isChecked();
}

View File

@@ -60,7 +60,6 @@ protected slots:
void enableMaxConnecsLimitPerTorrent(bool checked);
void enableMaxUploadsLimitPerTorrent(bool checked);
void enableMaxRatio(bool checked);
void setStyle(QString style);
void on_buttonBox_accepted();
void closeEvent(QCloseEvent *e);
void on_buttonBox_rejected();
@@ -85,7 +84,6 @@ protected slots:
public slots:
void setLocale(QString locale);
void useStyle();
void showConnectionTab();
signals:
@@ -100,12 +98,12 @@ private:
static QString languageToLocalizedString(QLocale::Language language, const QString& country);
// General options
QString getLocale() const;
QString getStyle() const;
bool systrayIntegration() const;
bool minimizeToTray() const;
bool closeToTray() const;
bool startMinimized() const;
bool isSlashScreenDisabled() const;
bool preventFromSuspend() const;
// Downloads
QString getSavePath() const;
bool isTempPathEnabled() const;

View File

@@ -77,14 +77,6 @@ public:
setValue(QString::fromUtf8("Preferences/General/Locale"), locale);
}
QString getStyle() const {
return value(QString::fromUtf8("Preferences/General/Style"), "").toString();
}
void setStyle(const QString &style) {
setValue(QString::fromUtf8("Preferences/General/Style"), style);
}
bool useProgramNotification() const {
return value(QString::fromUtf8("Preferences/General/ProgramNotification"), true).toBool();
}
@@ -173,6 +165,15 @@ public:
setValue("Preferences/General/NoSplashScreen", b);
}
// Preventing from system suspend while active torrents are presented.
bool preventFromSuspend() const {
return value(QString::fromUtf8("Preferences/General/PreventFromSuspend"), false).toBool();
}
void setPreventFromSuspend(bool b) {
setValue("Preferences/General/PreventFromSuspend", b);
}
// Downloads
QString getSavePath() const {
#ifdef Q_WS_WIN