1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge branch 'pr1400', with style fixes @agilob

Conflicts:
	src/widget/form/profileform.cpp
This commit is contained in:
Dubslow 2015-03-17 13:18:47 -05:00
commit 99e8d71fca
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA
8 changed files with 68 additions and 11 deletions

View File

@ -120,6 +120,12 @@ ProfileForm::ProfileForm(QWidget *parent) :
connect(core, &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); }); connect(core, &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); });
connect(core, &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); }); connect(core, &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); });
for (QComboBox* cb : findChildren<QComboBox*>())
{
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
} }
ProfileForm::~ProfileForm() ProfileForm::~ProfileForm()
@ -392,3 +398,14 @@ void ProfileForm::on_saveQr_clicked()
GUI::showWarning(tr("Failed to copy file"), tr("The file you chose could not be written to.")); GUI::showWarning(tr("Failed to copy file"), tr("The file you chose could not be written to."));
} }
} }
bool ProfileForm::eventFilter(QObject *o, QEvent *e)
{
if ((e->type() == QEvent::Wheel) &&
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) ))
{
e->ignore();
return true;
}
return QWidget::eventFilter(o, e);
}

View File

@ -80,6 +80,7 @@ private slots:
protected: protected:
virtual void showEvent(QShowEvent *); virtual void showEvent(QShowEvent *);
bool eventFilter(QObject *o, QEvent *e);
private: private:
void refreshProfiles(); void refreshProfiles();

View File

@ -42,6 +42,12 @@ AdvancedForm::AdvancedForm() :
connect(bodyUI->cbMakeToxPortable, &QCheckBox::stateChanged, this, &AdvancedForm::onMakeToxPortableUpdated); connect(bodyUI->cbMakeToxPortable, &QCheckBox::stateChanged, this, &AdvancedForm::onMakeToxPortableUpdated);
connect(bodyUI->syncTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onDbSyncTypeUpdated())); connect(bodyUI->syncTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onDbSyncTypeUpdated()));
connect(bodyUI->resetButton, SIGNAL(clicked()), this, SLOT(resetToDefault())); connect(bodyUI->resetButton, SIGNAL(clicked()), this, SLOT(resetToDefault()));
for (QComboBox* cb : findChildren<QComboBox*>())
{
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
} }
AdvancedForm::~AdvancedForm() AdvancedForm::~AdvancedForm()
@ -67,3 +73,14 @@ void AdvancedForm::resetToDefault()
bodyUI->syncTypeComboBox->setCurrentIndex(index); bodyUI->syncTypeComboBox->setCurrentIndex(index);
onDbSyncTypeUpdated(); onDbSyncTypeUpdated();
} }
bool AdvancedForm::eventFilter(QObject *o, QEvent *e)
{
if ((e->type() == QEvent::Wheel) &&
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) ))
{
e->ignore();
return true;
}
return QWidget::eventFilter(o, e);
}

View File

@ -32,6 +32,9 @@ public:
AdvancedForm(); AdvancedForm();
virtual ~AdvancedForm(); virtual ~AdvancedForm();
protected:
bool eventFilter(QObject *o, QEvent *e);
private slots: private slots:
void onMakeToxPortableUpdated(); void onMakeToxPortableUpdated();
void onDbSyncTypeUpdated(); void onDbSyncTypeUpdated();

View File

@ -52,6 +52,12 @@ AVForm::AVForm() :
connect(bodyUI->filterAudio, SIGNAL(toggled(bool)), this, SLOT(onFilterAudioToggled(bool))); connect(bodyUI->filterAudio, SIGNAL(toggled(bool)), this, SLOT(onFilterAudioToggled(bool)));
connect(bodyUI->rescanButton, &QPushButton::clicked, this, [=](){getAudioInDevices(); getAudioOutDevices();}); connect(bodyUI->rescanButton, &QPushButton::clicked, this, [=](){getAudioInDevices(); getAudioOutDevices();});
bodyUI->playbackSlider->setValue(100); bodyUI->playbackSlider->setValue(100);
for (QComboBox* cb : findChildren<QComboBox*>())
{
cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus);
}
} }
AVForm::~AVForm() AVForm::~AVForm()
@ -268,3 +274,14 @@ void AVForm::on_playbackSlider_valueChanged(int value)
{ {
Audio::getInstance().outputVolume = value / 100.0; Audio::getInstance().outputVolume = value / 100.0;
} }
bool AVForm::eventFilter(QObject *o, QEvent *e)
{
if ((e->type() == QEvent::Wheel) &&
(qobject_cast<QComboBox*>(o) || qobject_cast<QAbstractSpinBox*>(o) ))
{
e->ignore();
return true;
}
return QWidget::eventFilter(o, e);
}

View File

@ -63,13 +63,13 @@ private slots:
virtual void showEvent(QShowEvent*); virtual void showEvent(QShowEvent*);
void on_HueSlider_valueChanged(int value); void on_HueSlider_valueChanged(int value);
void on_BrightnessSlider_valueChanged(int value); void on_BrightnessSlider_valueChanged(int value);
void on_SaturationSlider_valueChanged(int value); void on_SaturationSlider_valueChanged(int value);
void on_ContrastSlider_valueChanged(int value); void on_ContrastSlider_valueChanged(int value);
protected:
bool eventFilter(QObject *o, QEvent *e);
private: private:
Ui::AVSettings *bodyUI; Ui::AVSettings *bodyUI;
VideoSurface* camView; VideoSurface* camView;

View File

@ -157,12 +157,14 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
// scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling // scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling
// you can scroll through general settings without accidentially chaning theme/skin/icons etc. // you can scroll through general settings without accidentially chaning theme/skin/icons etc.
// @see GeneralForm::eventFilter(QObject *o, QEvent *e) at the bottom of this file for more // @see GeneralForm::eventFilter(QObject *o, QEvent *e) at the bottom of this file for more
Q_FOREACH(QComboBox *cb, findChildren<QComboBox*>() ) { for (QComboBox* cb : findChildren<QComboBox*>())
{
cb->installEventFilter(this); cb->installEventFilter(this);
cb->setFocusPolicy(Qt::StrongFocus); cb->setFocusPolicy(Qt::StrongFocus);
} }
Q_FOREACH(QSpinBox *sp, findChildren<QSpinBox*>() ) { for (QSpinBox* sp : findChildren<QSpinBox*>())
{
sp->installEventFilter(this); sp->installEventFilter(this);
sp->setFocusPolicy(Qt::WheelFocus); sp->setFocusPolicy(Qt::WheelFocus);
} }

View File

@ -80,9 +80,9 @@ bool PrivacyForm::setChatLogsPassword()
body += "\n\n" + tr("It appears you have an unused encrypted chat history; if the password matches, it will be added to your current history."); body += "\n\n" + tr("It appears you have an unused encrypted chat history; if the password matches, it will be added to your current history.");
if (core->isPasswordSet(Core::ptMain)) if (core->isPasswordSet(Core::ptMain))
dialog = new SetPasswordDialog(body, tr("Use data file password", "pushbutton text"), this); dialog = new SetPasswordDialog(body, tr("Use data file password", "pushbutton text"), 0);
else else
dialog = new SetPasswordDialog(body, QString(), this); dialog = new SetPasswordDialog(body, QString(), 0);
do { do {
int r = dialog->exec(); int r = dialog->exec();
@ -203,9 +203,9 @@ bool PrivacyForm::setToxPassword()
SetPasswordDialog* dialog; SetPasswordDialog* dialog;
QString body = tr("Please set your new data file password."); QString body = tr("Please set your new data file password.");
if (core->isPasswordSet(Core::ptHistory)) if (core->isPasswordSet(Core::ptHistory))
dialog = new SetPasswordDialog(body, tr("Use chat history password", "pushbutton text"), this); dialog = new SetPasswordDialog(body, tr("Use chat history password", "pushbutton text"), 0);
else else
dialog = new SetPasswordDialog(body, QString(), this); dialog = new SetPasswordDialog(body, QString(), 0);
if (int r = dialog->exec()) if (int r = dialog->exec())
{ {