21 #include <QMessageBox>
22 #include <QSpacerItem>
23 #include <QScrollArea>
24 #include <QVBoxLayout>
28 #include "../core/system/log.h"
29 #include "../core/config.h"
30 #include "../core/core.h"
31 #include "../core/adapters/projectmanageradapter.h"
35 #include "../settingsforqt.h"
38 #include "../core/messages/messagehandler.h"
43 : QDialog(mainWindow, Qt::Window),
44 mMainWindow(mainWindow),
45 mCore(mainWindow->getCore()),
48 setWindowTitle(tr(
"Options"));
54 QFont titleFont(
mTitle->font());
55 titleFont.setPointSizeF(titleFont.pointSizeF() * 1.5);
56 titleFont.setBold(
true);
57 mTitle->setFont(titleFont);
59 QButtonGroup *group =
new QButtonGroup(
this);
62 QToolBar *selectionToolBar =
new QToolBar;
65 selectionToolBar->setOrientation(Qt::Vertical);
66 int iconSize = selectionToolBar->fontMetrics().height() * 2;
67 selectionToolBar->setIconSize(QSize(iconSize, iconSize));
71 addPageButton(QIcon::fromTheme(
"audio-card", QIcon(
":/media/icons/audio-card.png")), tr(
"Audio"), group, selectionToolBar,
PAGE_AUDIO);
73 QDialogButtonBox *buttonBox =
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel,
this);
75 QObject::connect(buttonBox, SIGNAL(accepted()),
this, SLOT(
accept()));
76 QObject::connect(buttonBox, SIGNAL(rejected()),
this, SLOT(
reject()));
77 QObject::connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()),
this, SLOT(
onApply()));
82 group->button(startupId)->setChecked(
true);
121 LogW(
"Message page %d not implemented.", index);
152 QMessageBox msgBox(
this);
153 msgBox.setWindowTitle(this->windowTitle());
154 msgBox.setIcon(QMessageBox::Question);
155 msgBox.setText(
"There are unsaved changes.");
156 msgBox.setInformativeText(
"Do you want to save your changes?");
158 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
160 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
163 switch (msgBox.exec()) {
164 case QMessageBox::Yes:
167 case QMessageBox::Cancel:
187 QToolButton *button =
new QToolButton(tb);
188 button->setIcon(icon);
189 button->setText(text);
190 button->setCheckable(
true);
191 button->setChecked(
false);
192 button->setStyleSheet(
"text-align: left");
194 button->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
195 button->setIconSize(tb->iconSize());
196 group->addButton(button, page);
197 tb->addWidget(button);
bool checkForChanges(bool allowCancel)
void accept() overridefinal
void reject() overridefinal
static void send(Args &&...args)
short function for creating and sending a message
QButtonGroup * mPageButtons
int getLastVisitedOptionsPage() const
Getter function for mLastVisitedOptionsPage.
void setLastVisitedOptionsPage(int id)
Setter function for mLastVisitedOptionsPage.
QGridLayout * mMainLayout
CentralWidgetInterface * mCentralWidget
OptionsDialog(MainWindow *mainWindow)
settings in the system options changed
void onCurrentSelectionChanged(int)
void addPageButton(QIcon icon, QString text, QButtonGroup *group, QToolBar *tb, OptionPages page)
static const std::unique_ptr< DisplaySizeDefines > & getSingleton()
static SettingsForQt & getSingleton()
Getter function for the singleton.