Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Force show event counter in minimize-on-close mode

  • Loading branch information...
commit 17d11d3bf0c230b79541e5fce45be2a999e94a03 1 parent fec0337
@kekekeks authored
Showing with 49 additions and 5 deletions.
  1. +3 −2 mainwindow.cpp
  2. +42 −3 settingsdialog.cpp
  3. +4 −0 settingsdialog.h
View
5 mainwindow.cpp
@@ -165,8 +165,9 @@ void STabMainWindow::timerEvent(QTimerEvent *)
}
i++;
}
- bool showCounter= (isHidden()) ||
- SkypeTab::settings.value("tabCounter/alwaysShow",QVariant::fromValue(false)).toBool();
+ bool showCounter= (isHidden() ||
+ SkypeTab::settings.value("tabCounter/alwaysShow",QVariant::fromValue(false)).toBool() ||
+ ((SkypeTab::winManager==Unity) && SkypeTab::settings.value("unity/noClose", QVariant::fromValue(true)).toBool()));
if(!showCounter)
activeTabsCount=0;
SkypeTab::updateTrayIcon(activeTabsCount);
View
45 settingsdialog.cpp
@@ -51,7 +51,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
if(SkypeTab::winManager==Unity)
{
addSettingsCheckbox(layout, "Do not wiggle constantly in Unity launcher", "unity/noConstantUrgency", false);
- addSettingsCheckbox(layout, "Minimize on close", "unity/noClose", true);
+ addSettingsCheckbox(layout, "Minimize on close", "unity/noClose", true, "tabCounter/alwaysShow");
}
group=findChild<QWidget*>("startOptions");
layout=new QBoxLayout(QBoxLayout::TopToBottom);
@@ -67,6 +67,11 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
layout->addWidget(cb);
this->resize(width(), minimumHeight());
+ foreach(cb, this->findChildren<QCheckBox*>())
+ {
+ checkBoxChanged(cb, cb->isChecked()?1:0);
+ }
+
}
SettingsDialog::~SettingsDialog()
@@ -74,7 +79,7 @@ SettingsDialog::~SettingsDialog()
delete ui;
}
-void SettingsDialog::addSettingsCheckbox(QBoxLayout *layout, QString title, QString keyName, bool isDefault)
+void SettingsDialog::addSettingsCheckbox(QBoxLayout *layout, QString title, QString keyName, bool isDefault, QList<QString> &disables)
{
bool isChecked=(
((!SkypeTab::settings.contains(keyName))&&isDefault) //If no setting for this entry, use default flag
@@ -84,11 +89,32 @@ void SettingsDialog::addSettingsCheckbox(QBoxLayout *layout, QString title, QStr
QCheckBox* cb=new QCheckBox(title);
cb->setChecked(isChecked);
cb->setObjectName(keyName);
+ QList<QVariant> vlist;
+ QString dstr;
+ foreach (dstr, disables)
+ {
+ vlist.append(QVariant::fromValue(dstr));
+ }
+
+ cb->setProperty("disables", QVariant::fromValue(vlist));
layout->addWidget(cb);
connect(cb, SIGNAL(stateChanged(int)), this, SLOT(namedCheckboxChanged(int)));
cb->show();
}
+void SettingsDialog::addSettingsCheckbox(QBoxLayout *layout, QString title, QString keyName, bool isDefault)
+{
+ QList<QString> list;
+ addSettingsCheckbox(layout, title, keyName, isDefault, list);
+}
+
+void SettingsDialog::addSettingsCheckbox(QBoxLayout *layout, QString title, QString keyName, bool isDefault, QString disables)
+{
+ QList<QString> list;
+ list.append(disables);
+ addSettingsCheckbox(layout, title, keyName, isDefault, list);
+}
+
void SettingsDialog::execIt()
@@ -113,8 +139,21 @@ void SettingsDialog::execIt()
void SettingsDialog::namedCheckboxChanged(int value)
{
+ checkBoxChanged((QCheckBox*)sender(), value);
+}
+
+void SettingsDialog::checkBoxChanged(QCheckBox *ccb, int value)
+{
if(value>=1)
value=1;
- SkypeTab::settings.setValue(sender()->objectName(), QVariant::fromValue(value));
+ QList<QVariant> vdisables=ccb->property ("disables").value<QList<QVariant>>();
+ QVariant vdis;
+ foreach(vdis, vdisables)
+ {
+ QCheckBox* cb=findChild<QCheckBox*>(vdis.toString());
+ cb->setEnabled(value==0);
+ }
+
+ SkypeTab::settings.setValue(ccb->objectName(), QVariant::fromValue(value));
}
}
View
4 settingsdialog.h
@@ -3,6 +3,7 @@
#include <QDialog>
#include <QBoxLayout>
+#include <QCheckBox>
namespace Ui {
class SettingsDialog;
}
@@ -18,6 +19,8 @@ class SettingsDialog : public QDialog
private:
Ui::SettingsDialog *ui;
+ void addSettingsCheckbox(QBoxLayout*layout, QString title, QString setting, bool defValue, QList<QString> &disables);
+ void addSettingsCheckbox(QBoxLayout*layout, QString title, QString setting, bool defValue, QString disables);
void addSettingsCheckbox(QBoxLayout*layout, QString title, QString setting, bool defValue);
QString autostartPath;
protected:
@@ -26,6 +29,7 @@ public slots:
virtual void execIt();
private slots:
void namedCheckboxChanged(int value);
+ void checkBoxChanged (QCheckBox* cb, int value);
};
}
Please sign in to comment.
Something went wrong with that request. Please try again.