Skip to content

Commit

Permalink
Project-wide code style changes, (tentatively) fixed multi monitor su…
Browse files Browse the repository at this point in the history
…pport, fixed the area DPI fix.
  • Loading branch information
ckaiser committed Mar 20, 2016
1 parent 7289fc1 commit 75c4bf9
Show file tree
Hide file tree
Showing 27 changed files with 3,577 additions and 3,639 deletions.
896 changes: 445 additions & 451 deletions dialogs/areadialog.cpp

Large diffs are not rendered by default.

347 changes: 165 additions & 182 deletions dialogs/historydialog.cpp

Large diffs are not rendered by default.

71 changes: 35 additions & 36 deletions dialogs/namingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,66 +26,65 @@
#include <QSettings>
#include <QUrl>

NamingDialog::NamingDialog(Screenshot::Naming naming,QWidget *parent) :
NamingDialog::NamingDialog(Screenshot::Naming naming, QWidget *parent) :
QDialog(parent)
{
ui.setupUi(this);
setModal(true);
setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
ui.setupUi(this);
setModal(true);
setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);

ui.dateFormatComboBox->installEventFilter(this);
ui.dateFormatComboBox->installEventFilter(this);

// Settings
QSettings *s = ScreenshotManager::instance()->settings();
ui.flipNamingCheckBox->setChecked(s->value("options/flip", false).toBool());
// Settings
QSettings *s = ScreenshotManager::instance()->settings();
ui.flipNamingCheckBox->setChecked(s->value("options/flip", false).toBool());

ui.dateFormatComboBox->setCurrentIndex(
ui.dateFormatComboBox->setCurrentIndex(
ui.dateFormatComboBox->findText(s->value("options/naming/dateFormat", "yyyy-MM-dd").toString())
);
);

if (ui.dateFormatComboBox->currentIndex() == -1) {
ui.dateFormatComboBox->addItem(s->value("options/naming/dateFormat", "yyyy-MM-dd").toString());
ui.dateFormatComboBox->setCurrentIndex(ui.dateFormatComboBox->count()-1);
}
if (ui.dateFormatComboBox->currentIndex() == -1) {
ui.dateFormatComboBox->addItem(s->value("options/naming/dateFormat", "yyyy-MM-dd").toString());
ui.dateFormatComboBox->setCurrentIndex(ui.dateFormatComboBox->count() - 1);
}

ui.leadingZerosSpinBox->setValue(s->value("options/naming/leadingZeros", 0).toInt());
ui.leadingZerosSpinBox->setValue(s->value("options/naming/leadingZeros", 0).toInt());

// Signals/Slots
connect(ui.buttonBox , SIGNAL(accepted()), this, SLOT(saveSettings()));
connect(ui.dateHelpLabel, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
// Signals/Slots
connect(ui.buttonBox , SIGNAL(accepted()), this, SLOT(saveSettings()));
connect(ui.dateHelpLabel, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));

// Stack & window size adjustments
ui.stack->setCurrentIndex((int)naming);
ui.stack->currentWidget()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
// Stack & window size adjustments
ui.stack->setCurrentIndex((int)naming);
ui.stack->currentWidget()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);

resize(minimumSizeHint());
resize(minimumSizeHint());
}

void NamingDialog::openUrl(QString url)
{
QDesktopServices::openUrl(QUrl(url));
QDesktopServices::openUrl(QUrl(url));
}

void NamingDialog::saveSettings()
{
QSettings *s = ScreenshotManager::instance()->settings();
s->setValue("options/flip" , ui.flipNamingCheckBox->isChecked());
s->setValue("options/naming/dateFormat" , ui.dateFormatComboBox->currentText());
s->setValue("options/naming/leadingZeros", ui.leadingZerosSpinBox->value());
QSettings *s = ScreenshotManager::instance()->settings();
s->setValue("options/flip" , ui.flipNamingCheckBox->isChecked());
s->setValue("options/naming/dateFormat" , ui.dateFormatComboBox->currentText());
s->setValue("options/naming/leadingZeros", ui.leadingZerosSpinBox->value());
}

bool NamingDialog::eventFilter(QObject *object, QEvent *event)
{
if (event->type() == QEvent::KeyPress
&& object == ui.dateFormatComboBox)
{
QKeyEvent *keyEvent = (QKeyEvent*)(event);
if (QRegExp("[?:\\\\/*\"<>|]").exactMatch(keyEvent->text())) {
event->ignore();
return true;
if (event->type() == QEvent::KeyPress
&& object == ui.dateFormatComboBox) {
QKeyEvent *keyEvent = (QKeyEvent *)(event);
if (QRegExp("[?:\\\\/*\"<>|]").exactMatch(keyEvent->text())) {
event->ignore();
return true;
}
}
}

return QDialog::eventFilter(object, event);
return QDialog::eventFilter(object, event);
}

Loading

0 comments on commit 75c4bf9

Please sign in to comment.