Skip to content
Permalink
Browse files

Merge PR #2922: Mumble: remove expert mode.

  • Loading branch information...
mkrautz committed Mar 16, 2017
2 parents b9165ae + 0d2e891 commit b16983f33364bb51755d42a05ffca27bbaf5cf79
@@ -368,10 +368,6 @@ void ASIOConfig::load(const Settings &r) {
qlwSpeaker->clear(); qlwSpeaker->clear();
} }


bool ASIOConfig::expert(bool) {
return false;
}

void ASIOConfig::clearQuery() { void ASIOConfig::clearQuery() {
bOk = false; bOk = false;
qlName->setText(QString()); qlName->setText(QString());
@@ -33,7 +33,6 @@ class ASIOConfig : public ConfigWidget, public Ui::ASIOConfig {
public slots: public slots:
void save() const Q_DECL_OVERRIDE; void save() const Q_DECL_OVERRIDE;
void load(const Settings &r) Q_DECL_OVERRIDE; void load(const Settings &r) Q_DECL_OVERRIDE;
bool expert(bool) Q_DECL_OVERRIDE;
void clearQuery(); void clearQuery();
void on_qcbDevice_activated(int index); void on_qcbDevice_activated(int index);
void on_qpbQuery_clicked(); void on_qpbQuery_clicked();
@@ -188,21 +188,6 @@ void AudioInputDialog::save() const {
} }
} }


bool AudioInputDialog::expert(bool b) {
qgbInterfaces->setVisible(b);
qgbAudio->setVisible(b);
qliFrames->setVisible(b);
qsFrames->setVisible(b);
qlFrames->setVisible(b);
qswTransmit->setVisible(b);
qliIdle->setVisible(b);
qsbIdle->setVisible(b);
qcbIdleAction->setVisible(b);
qlIdle->setVisible(b);
qlIdle2->setVisible(b);
return true;
}

void AudioInputDialog::on_qsFrames_valueChanged(int v) { void AudioInputDialog::on_qsFrames_valueChanged(int v) {
qlFrames->setText(tr("%1 ms").arg((v==1) ? 10 : (v-1)*20)); qlFrames->setText(tr("%1 ms").arg((v==1) ? 10 : (v-1)*20));
updateBitrate(); updateBitrate();
@@ -514,10 +499,6 @@ void AudioOutputDialog::save() const {
} }
} }


bool AudioOutputDialog::expert(bool b) {
return b;
}

void AudioOutputDialog::on_qcbSystem_currentIndexChanged(int) { void AudioOutputDialog::on_qcbSystem_currentIndexChanged(int) {
qcbDevice->clear(); qcbDevice->clear();


@@ -28,7 +28,6 @@ class AudioInputDialog : public ConfigWidget, public Ui::AudioInput {
public slots: public slots:
void save() const Q_DECL_OVERRIDE; void save() const Q_DECL_OVERRIDE;
void load(const Settings &r) Q_DECL_OVERRIDE; void load(const Settings &r) Q_DECL_OVERRIDE;
bool expert(bool) Q_DECL_OVERRIDE;
void updateBitrate(); void updateBitrate();
void continuePlayback(); void continuePlayback();


@@ -62,7 +61,6 @@ class AudioOutputDialog : public ConfigWidget, public Ui::AudioOutput {
public slots: public slots:
void save() const Q_DECL_OVERRIDE; void save() const Q_DECL_OVERRIDE;
void load(const Settings &r) Q_DECL_OVERRIDE; void load(const Settings &r) Q_DECL_OVERRIDE;
bool expert(bool) Q_DECL_OVERRIDE;
void on_qsDelay_valueChanged(int v); void on_qsDelay_valueChanged(int v);
void on_qsJitter_valueChanged(int v); void on_qsJitter_valueChanged(int v);
void on_qsVolume_valueChanged(int v); void on_qsVolume_valueChanged(int v);
@@ -23,8 +23,7 @@ ConfigDialog::ConfigDialog(QWidget *p) : QDialog(p) {
addPage(cwn(s), ++idx); addPage(cwn(s), ++idx);
} }


qcbExpert->setChecked(g.s.bExpert); updateListView();
on_qcbExpert_clicked(g.s.bExpert);


QPushButton *okButton = dialogButtonBox->button(QDialogButtonBox::Ok); QPushButton *okButton = dialogButtonBox->button(QDialogButtonBox::Ok);
okButton->setToolTip(tr("Accept changes")); okButton->setToolTip(tr("Accept changes"));
@@ -107,7 +106,6 @@ void ConfigDialog::on_pageButtonBox_clicked(QAbstractButton *b) {
switch (pageButtonBox->standardButton(b)) { switch (pageButtonBox->standardButton(b)) {
case QDialogButtonBox::RestoreDefaults: { case QDialogButtonBox::RestoreDefaults: {
Settings def; Settings def;
def.bExpert = g.s.bExpert;
conf->load(def); conf->load(def);
break; break;
} }
@@ -142,7 +140,7 @@ void ConfigDialog::on_qlwIcons_currentItemChanged(QListWidgetItem *current, QLis
} }
} }


void ConfigDialog::on_qcbExpert_clicked(bool b) { void ConfigDialog::updateListView() {
QWidget *ccw = qmIconWidgets.value(qlwIcons->currentItem()); QWidget *ccw = qmIconWidgets.value(qlwIcons->currentItem());
QListWidgetItem *sel = NULL; QListWidgetItem *sel = NULL;


@@ -153,19 +151,16 @@ void ConfigDialog::on_qcbExpert_clicked(bool b) {
int configNavbarWidth = 0; int configNavbarWidth = 0;


foreach(ConfigWidget *cw, qmWidgets) { foreach(ConfigWidget *cw, qmWidgets) {
bool showit = cw->expert(b);
configNavbarWidth = qMax(configNavbarWidth, qfm.width(cw->title())); configNavbarWidth = qMax(configNavbarWidth, qfm.width(cw->title()));
if (showit || b) {
QListWidgetItem *i = new QListWidgetItem(qlwIcons);
i->setIcon(cw->icon());
i->setText(cw->title());
i->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);


QListWidgetItem *i = new QListWidgetItem(qlwIcons);
i->setIcon(cw->icon());
i->setText(cw->title());
i->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);


qmIconWidgets.insert(i, cw); qmIconWidgets.insert(i, cw);
if (cw == ccw) if (cw == ccw)
sel = i; sel = i;
}
} }


// Add space for icon and some padding. // Add space for icon and some padding.
@@ -196,7 +191,6 @@ void ConfigDialog::apply() {


// They might have changed their keys. // They might have changed their keys.
g.iPushToTalk = 0; g.iPushToTalk = 0;
g.s.bExpert = qcbExpert->isChecked();


Audio::start(); Audio::start();
} }
@@ -19,6 +19,7 @@ class ConfigDialog : public QDialog, public Ui::ConfigDialog {
QHash<ConfigWidget *, QWidget *> qhPages; QHash<ConfigWidget *, QWidget *> qhPages;
QMap<unsigned int, ConfigWidget *> qmWidgets; QMap<unsigned int, ConfigWidget *> qmWidgets;
QMap<QListWidgetItem *, ConfigWidget *> qmIconWidgets; QMap<QListWidgetItem *, ConfigWidget *> qmIconWidgets;
void updateListView();
void addPage(ConfigWidget *aw, unsigned int idx); void addPage(ConfigWidget *aw, unsigned int idx);
Settings s; Settings s;


@@ -29,7 +30,6 @@ class ConfigDialog : public QDialog, public Ui::ConfigDialog {
void on_pageButtonBox_clicked(QAbstractButton *); void on_pageButtonBox_clicked(QAbstractButton *);
void on_dialogButtonBox_clicked(QAbstractButton *); void on_dialogButtonBox_clicked(QAbstractButton *);
void on_qlwIcons_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous); void on_qlwIcons_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
void on_qcbExpert_clicked(bool);
void apply(); void apply();
void accept() Q_DECL_OVERRIDE; void accept() Q_DECL_OVERRIDE;
}; };
@@ -42,20 +42,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="qcbExpert">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Advanced</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QDialogButtonBox" name="pageButtonBox"> <widget class="QDialogButtonBox" name="pageButtonBox">
@@ -92,7 +79,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="1" rowspan="2"> <item row="0" column="1" rowspan="1">
<widget class="QStackedWidget" name="qswPages"> <widget class="QStackedWidget" name="qswPages">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -39,7 +39,6 @@ class ConfigWidget : public QWidget {
virtual void accept() const; virtual void accept() const;
virtual void save() const = 0; virtual void save() const = 0;
virtual void load(const Settings &r) = 0; virtual void load(const Settings &r) = 0;
virtual bool expert(bool) = 0;
}; };


typedef ConfigWidget *(*ConfigWidgetNew)(Settings &st); typedef ConfigWidget *(*ConfigWidgetNew)(Settings &st);
@@ -116,27 +116,14 @@ ShortcutActionWidget::ShortcutActionWidget(QWidget *p) : MUComboBox(p) {


idx++; idx++;


bool expert = true;
// Try to traverse to GlobalShortcutConfig to get expert state (default: true)
while (p) {
GlobalShortcutConfig *gsc = qobject_cast<GlobalShortcutConfig *>(p);
if (gsc) {
expert = gsc->bExpert;
break;
}
p = p->parentWidget();
}
foreach(GlobalShortcut *gs, GlobalShortcutEngine::engine->qmShortcuts) { foreach(GlobalShortcut *gs, GlobalShortcutEngine::engine->qmShortcuts) {
// Hide all expert actions if we are not in expert mode insertItem(idx, gs->name);
if (expert || ! gs->bExpert) { setItemData(idx, gs->idx);
insertItem(idx, gs->name); if (! gs->qsToolTip.isEmpty())
setItemData(idx, gs->idx); setItemData(idx, gs->qsToolTip, Qt::ToolTipRole);
if (! gs->qsToolTip.isEmpty()) if (! gs->qsWhatsThis.isEmpty())
setItemData(idx, gs->qsToolTip, Qt::ToolTipRole); setItemData(idx, gs->qsWhatsThis, Qt::WhatsThisRole);
if (! gs->qsWhatsThis.isEmpty()) idx++;
setItemData(idx, gs->qsWhatsThis, Qt::WhatsThisRole);
idx++;
}
} }
} }


@@ -187,7 +174,7 @@ ShortcutTargetDialog::ShortcutTargetDialog(const ShortcutTarget &st, QWidget *pw


// Load current shortcut configuration // Load current shortcut configuration
qcbForceCenter->setChecked(st.bForceCenter); qcbForceCenter->setChecked(st.bForceCenter);
qgbModifiers->setVisible(g.s.bExpert); qgbModifiers->setVisible(true);


if (st.bUsers) { if (st.bUsers) {
qrbUsers->setChecked(true); qrbUsers->setChecked(true);
@@ -667,7 +654,6 @@ QIcon GlobalShortcutConfig::icon() const {


void GlobalShortcutConfig::load(const Settings &r) { void GlobalShortcutConfig::load(const Settings &r) {
qlShortcuts = r.qlShortcuts; qlShortcuts = r.qlShortcuts;
bExpert = r.bExpert;


// The 'Skip' button is supposed to be live, meaning users do not need to click Apply for // The 'Skip' button is supposed to be live, meaning users do not need to click Apply for
// their choice of skipping to apply. // their choice of skipping to apply.
@@ -745,10 +731,7 @@ void GlobalShortcutConfig::reload() {
qtwShortcuts->clear(); qtwShortcuts->clear();
foreach(const Shortcut &sc, qlShortcuts) { foreach(const Shortcut &sc, qlShortcuts) {
QTreeWidgetItem *item = itemForShortcut(sc); QTreeWidgetItem *item = itemForShortcut(sc);
::GlobalShortcut *gs = GlobalShortcutEngine::engine->qmShortcuts.value(sc.iIndex);
qtwShortcuts->addTopLevelItem(item); qtwShortcuts->addTopLevelItem(item);
if (gs && gs->bExpert && ! bExpert)
item->setHidden(true);
} }
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
if (! g.s.bSuppressMacEventTapWarning) { if (! g.s.bSuppressMacEventTapWarning) {
@@ -765,12 +748,6 @@ void GlobalShortcutConfig::accept() const {
GlobalShortcutEngine::engine->setEnabled(g.s.bShortcutEnable); GlobalShortcutEngine::engine->setEnabled(g.s.bShortcutEnable);
} }


bool GlobalShortcutConfig::expert(bool exp) {
bExpert = exp;
reload();
return true;
}



GlobalShortcutEngine::GlobalShortcutEngine(QObject *p) : QThread(p) { GlobalShortcutEngine::GlobalShortcutEngine(QObject *p) : QThread(p) {
bNeedRemap = true; bNeedRemap = true;
@@ -954,10 +931,9 @@ QString GlobalShortcutEngine::buttonText(const QList<QVariant> &list) {
void GlobalShortcutEngine::prepareInput() { void GlobalShortcutEngine::prepareInput() {
} }


GlobalShortcut::GlobalShortcut(QObject *p, int index, QString qsName, bool expert, QVariant def) : QObject(p) { GlobalShortcut::GlobalShortcut(QObject *p, int index, QString qsName, QVariant def) : QObject(p) {
idx = index; idx = index;
name=qsName; name=qsName;
bExpert = expert;
qvDefault = def; qvDefault = def;
GlobalShortcutEngine::add(this); GlobalShortcutEngine::add(this);
} }
@@ -39,10 +39,9 @@ class GlobalShortcut : public QObject {
QString qsWhatsThis; QString qsWhatsThis;
QString name; QString name;
QVariant qvDefault; QVariant qvDefault;
bool bExpert;
int idx; int idx;


GlobalShortcut(QObject *parent, int index, QString qsName, bool expert = true, QVariant def = QVariant()); GlobalShortcut(QObject *parent, int index, QString qsName, QVariant def = QVariant());
~GlobalShortcut() Q_DECL_OVERRIDE; ~GlobalShortcut() Q_DECL_OVERRIDE;


bool active() const { bool active() const {
@@ -187,7 +186,6 @@ class GlobalShortcutConfig : public ConfigWidget, public Ui::GlobalShortcut {
protected: protected:
QList<Shortcut> qlShortcuts; QList<Shortcut> qlShortcuts;
QTreeWidgetItem *itemForShortcut(const Shortcut &) const; QTreeWidgetItem *itemForShortcut(const Shortcut &) const;
bool bExpert;
bool showWarning() const; bool showWarning() const;
bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE; bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
public: public:
@@ -199,7 +197,6 @@ class GlobalShortcutConfig : public ConfigWidget, public Ui::GlobalShortcut {
void save() const Q_DECL_OVERRIDE; void save() const Q_DECL_OVERRIDE;
void load(const Settings &r) Q_DECL_OVERRIDE; void load(const Settings &r) Q_DECL_OVERRIDE;
void reload(); void reload();
bool expert(bool) Q_DECL_OVERRIDE;
void commit(); void commit();
void on_qcbEnableGlobalShortcuts_stateChanged(int); void on_qcbEnableGlobalShortcuts_stateChanged(int);
void on_qpbAdd_clicked(bool); void on_qpbAdd_clicked(bool);
@@ -97,10 +97,6 @@ LCDConfig::LCDConfig(Settings &st) : ConfigWidget(st) {
} }
} }


bool LCDConfig::expert(bool) {
return false;
}

QString LCDConfig::title() const { QString LCDConfig::title() const {
return tr("LCD"); return tr("LCD");
} }
@@ -28,7 +28,6 @@ class LCDConfig : public ConfigWidget, public Ui::LCDConfig {
void accept() const Q_DECL_OVERRIDE; void accept() const Q_DECL_OVERRIDE;
void save() const Q_DECL_OVERRIDE; void save() const Q_DECL_OVERRIDE;
void load(const Settings &r) Q_DECL_OVERRIDE; void load(const Settings &r) Q_DECL_OVERRIDE;
bool expert(bool) Q_DECL_OVERRIDE;
}; };


class LCDEngine : public QObject { class LCDEngine : public QObject {
@@ -143,10 +143,6 @@ void LogConfig::accept() const {
g.mw->qteLog->document()->setMaximumBlockCount(s.iMaxLogBlocks); g.mw->qteLog->document()->setMaximumBlockCount(s.iMaxLogBlocks);
} }


bool LogConfig::expert(bool) {
return false;
}

void LogConfig::on_qtwMessages_itemChanged(QTreeWidgetItem* i, int column) { void LogConfig::on_qtwMessages_itemChanged(QTreeWidgetItem* i, int column) {
if (! i->isSelected()) return; if (! i->isSelected()) return;
switch (column) { switch (column) {
@@ -28,7 +28,6 @@ class LogConfig : public ConfigWidget, public Ui::LogConfig {
void accept() const Q_DECL_OVERRIDE; void accept() const Q_DECL_OVERRIDE;
void save() const Q_DECL_OVERRIDE; void save() const Q_DECL_OVERRIDE;
void load(const Settings &) Q_DECL_OVERRIDE; void load(const Settings &) Q_DECL_OVERRIDE;
bool expert(bool) Q_DECL_OVERRIDE;


void on_qtwMessages_itemChanged(QTreeWidgetItem*, int); void on_qtwMessages_itemChanged(QTreeWidgetItem*, int);
void on_qtwMessages_itemClicked(QTreeWidgetItem*, int); void on_qtwMessages_itemClicked(QTreeWidgetItem*, int);
@@ -226,15 +226,6 @@ void LookConfig::accept() const {
g.mw->setShowDockTitleBars(g.s.wlWindowLayout == Settings::LayoutCustom); g.mw->setShowDockTitleBars(g.s.wlWindowLayout == Settings::LayoutCustom);
} }


bool LookConfig::expert(bool b) {
qcbExpand->setVisible(b);
qliExpand->setVisible(b);
qcbUsersTop->setVisible(b);
qcbStateInTray->setVisible(b);
qcbShowContextMenuInMenuBar->setVisible(b);
return true;
}

void LookConfig::themeDirectoryChanged() { void LookConfig::themeDirectoryChanged() {
qWarning() << "Theme directory changed"; qWarning() << "Theme directory changed";
QVariant themeData = qcbTheme->itemData(qcbTheme->currentIndex()); QVariant themeData = qcbTheme->itemData(qcbTheme->currentIndex());
@@ -27,7 +27,6 @@ class LookConfig : public ConfigWidget, Ui::LookConfig {
void accept() const Q_DECL_OVERRIDE; void accept() const Q_DECL_OVERRIDE;
void save() const Q_DECL_OVERRIDE; void save() const Q_DECL_OVERRIDE;
void load(const Settings &r) Q_DECL_OVERRIDE; void load(const Settings &r) Q_DECL_OVERRIDE;
bool expert(bool) Q_DECL_OVERRIDE;
void themeDirectoryChanged(); void themeDirectoryChanged();
private: private:
/// Reload themes combobox and select given configuredStyle in it /// Reload themes combobox and select given configuredStyle in it

0 comments on commit b16983f

Please sign in to comment.
You can’t perform that action at this time.