Browse Source

Further preferences simplifying

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
17efa04257
  1. 5
      src/GUI.cpp
  2. 19
      src/options_imp.cpp
  3. 1
      src/options_imp.h
  4. 5
      src/preferences.h
  5. 15
      src/ui/options.ui

5
src/GUI.cpp

@ -881,8 +881,6 @@ void GUI::updateGUI() {
} }
void GUI::showNotificationBaloon(QString title, QString msg) const { void GUI::showNotificationBaloon(QString title, QString msg) const {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(settings.value(QString::fromUtf8("Preferences/General/NotificationBaloons"), true).toBool()) {
#ifdef WITH_LIBNOTIFY #ifdef WITH_LIBNOTIFY
if (notify_init ("summary-body")) { if (notify_init ("summary-body")) {
NotifyNotification* notification; NotifyNotification* notification;
@ -896,11 +894,10 @@ void GUI::showNotificationBaloon(QString title, QString msg) const {
} }
#endif #endif
#ifndef Q_WS_MAC #ifndef Q_WS_MAC
if(systrayIcon) if(systrayIcon && QSystemTrayIcon::supportsMessages())
systrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, TIME_TRAY_BALLOON); systrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
#endif #endif
} }
}
/***************************************************** /*****************************************************
* * * *

19
src/options_imp.cpp

@ -199,7 +199,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkStartMinimized, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkStartMinimized, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkSystrayBalloons, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkDisplayToolbar, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkDisplayToolbar, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkNoSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkNoSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkDeleteTorrentFiles, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkDeleteTorrentFiles, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
@ -281,15 +280,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(textWebUiPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); connect(textWebUiPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
// Disable apply Button // Disable apply Button
applyButton->setEnabled(false); applyButton->setEnabled(false);
#ifdef Q_WS_MAC
if(1) {
#else
if(!QSystemTrayIcon::supportsMessages()){
#endif
// Mac OS X doesn't support it yet
checkSystrayBalloons->setChecked(false);
checkSystrayBalloons->setEnabled(false);
}
// Tab selection mecanism // Tab selection mecanism
connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*))); connect(tabSelection, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
#if LIBTORRENT_VERSION_MINOR < 15 #if LIBTORRENT_VERSION_MINOR < 15
@ -391,7 +381,6 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("CloseToTray"), closeToTray()); settings.setValue(QString::fromUtf8("CloseToTray"), closeToTray());
settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray()); settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray());
settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized()); settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized());
settings.setValue(QString::fromUtf8("NotificationBaloons"), OSDEnabled());
settings.setValue(QString::fromUtf8("ToolbarDisplayed"), isToolbarDisplayed()); settings.setValue(QString::fromUtf8("ToolbarDisplayed"), isToolbarDisplayed());
settings.setValue(QString::fromUtf8("NoSplashScreen"), isSlashScreenDisabled()); settings.setValue(QString::fromUtf8("NoSplashScreen"), isSlashScreenDisabled());
Preferences::setDeleteTorrentFilesAsDefault(checkDeleteTorrentFiles->isChecked()); Preferences::setDeleteTorrentFilesAsDefault(checkDeleteTorrentFiles->isChecked());
@ -628,7 +617,6 @@ void options_imp::loadOptions(){
checkCloseToSystray->setChecked(Preferences::closeToTray()); checkCloseToSystray->setChecked(Preferences::closeToTray());
checkMinimizeToSysTray->setChecked(Preferences::minimizeToTray()); checkMinimizeToSysTray->setChecked(Preferences::minimizeToTray());
checkStartMinimized->setChecked(Preferences::startMinimized()); checkStartMinimized->setChecked(Preferences::startMinimized());
checkSystrayBalloons->setChecked(Preferences::OSDEnabled());
} }
// End General preferences // End General preferences
// Downloads preferences // Downloads preferences
@ -1016,11 +1004,6 @@ QPair<int,int> options_imp::getGlobalBandwidthLimits() const{
return qMakePair(DL, UP); return qMakePair(DL, UP);
} }
bool options_imp::OSDEnabled() const {
if(checkNoSystray->isChecked()) return false;
return checkSystrayBalloons->isChecked();
}
bool options_imp::startMinimized() const { bool options_imp::startMinimized() const {
if(checkStartMinimized->isChecked()) return true; if(checkStartMinimized->isChecked()) return true;
return checkStartMinimized->isChecked(); return checkStartMinimized->isChecked();
@ -1175,13 +1158,11 @@ void options_imp::enableMaxConnecsLimitPerTorrent(bool checked){
void options_imp::enableSystrayOptions() { void options_imp::enableSystrayOptions() {
checkCloseToSystray->setEnabled(true); checkCloseToSystray->setEnabled(true);
checkMinimizeToSysTray->setEnabled(true); checkMinimizeToSysTray->setEnabled(true);
checkSystrayBalloons->setEnabled(true);
} }
void options_imp::disableSystrayOptions() { void options_imp::disableSystrayOptions() {
checkCloseToSystray->setEnabled(false); checkCloseToSystray->setEnabled(false);
checkMinimizeToSysTray->setEnabled(false); checkMinimizeToSysTray->setEnabled(false);
checkSystrayBalloons->setEnabled(false);
} }
void options_imp::setSystrayOptionsState(bool checked) { void options_imp::setSystrayOptionsState(bool checked) {

1
src/options_imp.h

@ -73,7 +73,6 @@ protected:
bool closeToTray() const; bool closeToTray() const;
bool startMinimized() const; bool startMinimized() const;
bool isSlashScreenDisabled() const; bool isSlashScreenDisabled() const;
bool OSDEnabled() const;
bool isToolbarDisplayed() const; bool isToolbarDisplayed() const;
// Downloads // Downloads
QString getSavePath() const; QString getSavePath() const;

5
src/preferences.h

@ -142,11 +142,6 @@ public:
return settings.value(QString::fromUtf8("Preferences/General/NoSplashScreen"), false).toBool(); return settings.value(QString::fromUtf8("Preferences/General/NoSplashScreen"), false).toBool();
} }
static bool OSDEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/General/NotificationBaloons"), true).toBool();
}
// Downloads // Downloads
static QString getSavePath() { static QString getSavePath() {
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");

15
src/ui/options.ui

@ -240,9 +240,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>-109</y>
<width>506</width> <width>506</width>
<height>543</height> <height>515</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_9">
@ -526,16 +526,6 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkSystrayBalloons">
<property name="text">
<string>Show notification balloons in tray</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -3110,7 +3100,6 @@ QGroupBox {
<tabstop>checkCloseToSystray</tabstop> <tabstop>checkCloseToSystray</tabstop>
<tabstop>checkMinimizeToSysTray</tabstop> <tabstop>checkMinimizeToSysTray</tabstop>
<tabstop>checkStartMinimized</tabstop> <tabstop>checkStartMinimized</tabstop>
<tabstop>checkSystrayBalloons</tabstop>
<tabstop>textSavePath</tabstop> <tabstop>textSavePath</tabstop>
<tabstop>browseSaveDirButton</tabstop> <tabstop>browseSaveDirButton</tabstop>
<tabstop>checkPreallocateAll</tabstop> <tabstop>checkPreallocateAll</tabstop>

Loading…
Cancel
Save