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() { @@ -881,8 +881,6 @@ void GUI::updateGUI() {
}
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
if (notify_init ("summary-body")) {
NotifyNotification* notification;
@ -896,11 +894,10 @@ void GUI::showNotificationBaloon(QString title, QString msg) const { @@ -896,11 +894,10 @@ void GUI::showNotificationBaloon(QString title, QString msg) const {
}
#endif
#ifndef Q_WS_MAC
if(systrayIcon)
if(systrayIcon && QSystemTrayIcon::supportsMessages())
systrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
#endif
}
}
/*****************************************************
* *

19
src/options_imp.cpp

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

1
src/options_imp.h

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

5
src/preferences.h

@ -142,11 +142,6 @@ public: @@ -142,11 +142,6 @@ public:
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
static QString getSavePath() {
QSettings settings("qBittorrent", "qBittorrent");

15
src/ui/options.ui

@ -240,9 +240,9 @@ @@ -240,9 +240,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-109</y>
<width>506</width>
<height>543</height>
<height>515</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
@ -526,16 +526,6 @@ QGroupBox { @@ -526,16 +526,6 @@ QGroupBox {
</property>
</widget>
</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>
</widget>
</item>
@ -3110,7 +3100,6 @@ QGroupBox { @@ -3110,7 +3100,6 @@ QGroupBox {
<tabstop>checkCloseToSystray</tabstop>
<tabstop>checkMinimizeToSysTray</tabstop>
<tabstop>checkStartMinimized</tabstop>
<tabstop>checkSystrayBalloons</tabstop>
<tabstop>textSavePath</tabstop>
<tabstop>browseSaveDirButton</tabstop>
<tabstop>checkPreallocateAll</tabstop>

Loading…
Cancel
Save