From 344e2456de66d38ce7afb86604e0fa714fa95006 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Sun, 5 Jun 2011 03:22:20 +0000 Subject: [PATCH] Added Settings dialog. --- architektonas.pro | 4 ++++ src/about.cpp | 4 ++-- src/applicationwindow.cpp | 16 +++++++++++++++ src/applicationwindow.h | 1 + src/generaltab.cpp | 28 ++++++++++++++++++++++++++ src/generaltab.h | 18 +++++++++++++++++ src/settingsdialog.cpp | 41 +++++++++++++++++++++++++++++++++++++++ src/settingsdialog.h | 24 +++++++++++++++++++++++ 8 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 src/generaltab.cpp create mode 100644 src/generaltab.h create mode 100644 src/settingsdialog.cpp create mode 100644 src/settingsdialog.h diff --git a/architektonas.pro b/architektonas.pro index 8b15d07..cf3254c 100644 --- a/architektonas.pro +++ b/architektonas.pro @@ -48,10 +48,12 @@ HEADERS = \ src/container.h \ src/dimension.h \ src/drawingview.h \ + src/generaltab.h \ src/line.h \ src/main.h \ src/mathconstants.h \ src/object.h \ + src/settingsdialog.h \ src/vector.h SOURCES = \ @@ -62,9 +64,11 @@ SOURCES = \ src/container.cpp \ src/dimension.cpp \ src/drawingview.cpp \ + src/generaltab.cpp \ src/line.cpp \ src/main.cpp \ src/object.cpp \ + src/settingsdialog.cpp \ src/vector.cpp # src/mainapp/commands.cpp \ diff --git a/src/about.cpp b/src/about.cpp index 25cd93e..cef694e 100644 --- a/src/about.cpp +++ b/src/about.cpp @@ -61,11 +61,11 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog) QString s = QString(tr( "" "" - "" + "" "
" "" // "" - "" + "" "" "" "" diff --git a/src/applicationwindow.cpp b/src/applicationwindow.cpp index 2c7f22f..fe0c29d 100644 --- a/src/applicationwindow.cpp +++ b/src/applicationwindow.cpp @@ -28,6 +28,8 @@ #include "about.h" #include "drawingview.h" +#include "settingsdialog.h" +#include "generaltab.h" ApplicationWindow::ApplicationWindow(): settings("Underground Software", "Architektonas") @@ -103,6 +105,19 @@ void ApplicationWindow::HelpAbout(void) aboutWin->show(); } +void ApplicationWindow::Settings(void) +{ + SettingsDialog dlg(this); + dlg.generalTab->antialiasChk->setChecked(drawing->useAntialiasing); + + if (dlg.exec() == false) + return; + + // Deal with stuff here (since user hit "OK" button...) + drawing->useAntialiasing = dlg.generalTab->antialiasChk->isChecked(); + WriteSettings(); +} + void ApplicationWindow::CreateActions(void) { exitAct = CreateAction(tr("&Quit"), tr("Quit"), tr("Exits the application."), @@ -146,6 +161,7 @@ void ApplicationWindow::CreateActions(void) fileCloseAct = CreateAction(tr("&Close Drawing"), tr("Close Drawing"), tr("Closes the current drawing."), QIcon(":/res/generic-tool.png"), QKeySequence(tr("Ctrl+w"))); settingsAct = CreateAction(tr("&Settings"), tr("Settings"), tr("Change certain defaults for Architektonas."), QIcon(":/res/generic-tool.png"), QKeySequence()); + connect(settingsAct, SIGNAL(triggered()), this, SLOT(Settings())); //Hm. I think we'll have to have separate logic to do the "Radio Group Toolbar" thing... /* QActionGroup * group = new QActionGroup(this); diff --git a/src/applicationwindow.h b/src/applicationwindow.h index c3e06a5..99b5441 100644 --- a/src/applicationwindow.h +++ b/src/applicationwindow.h @@ -29,6 +29,7 @@ class ApplicationWindow: public QMainWindow void DimensionTool(void); void RotateTool(void); void HelpAbout(void); + void Settings(void); private: void CreateActions(void); diff --git a/src/generaltab.cpp b/src/generaltab.cpp new file mode 100644 index 0000000..ebe36cb --- /dev/null +++ b/src/generaltab.cpp @@ -0,0 +1,28 @@ +// +// generaltab.cpp: "General" tab on the settings dialog +// +// Part of the Architektonas Project +// (C) 2011 Underground Software +// See the README and GPLv3 files for licensing and warranty information +// +// JLH = James L. Hammons +// +// WHO WHEN WHAT +// --- ---------- ------------------------------------------------------------ +// JLH 06/04/2011 Created this file + +#include "generaltab.h" + + +GeneralTab::GeneralTab(QWidget * parent/*= 0*/): QWidget(parent) +{ + antialiasChk = new QCheckBox(tr("Use Qt's built-in antialiasing")); + + QVBoxLayout * layout = new QVBoxLayout; + layout->addWidget(antialiasChk); + setLayout(layout); +} + +GeneralTab::~GeneralTab() +{ +} diff --git a/src/generaltab.h b/src/generaltab.h new file mode 100644 index 0000000..8dde60a --- /dev/null +++ b/src/generaltab.h @@ -0,0 +1,18 @@ +#ifndef __GENERALTAB_H__ +#define __GENERALTAB_H__ + +#include + +class GeneralTab: public QWidget +{ + Q_OBJECT + + public: + GeneralTab(QWidget * parent = 0); + ~GeneralTab(); + + public: + QCheckBox * antialiasChk; +}; + +#endif // __GENERALTAB_H__ diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp new file mode 100644 index 0000000..94c61ab --- /dev/null +++ b/src/settingsdialog.cpp @@ -0,0 +1,41 @@ +// +// settingsdialog.cpp: Dialog for changing Architektonas settings +// +// Part of the Architektonas Project +// (C) 2011 Underground Software +// See the README and GPLv3 files for licensing and warranty information +// +// JLH = James L. Hammons +// +// WHO WHEN WHAT +// --- ---------- ------------------------------------------------------------ +// JLH 06/04/2011 Created this file + +#include "settingsdialog.h" +#include "generaltab.h" + + +SettingsDialog::SettingsDialog(QWidget * parent/*= 0*/): QDialog(parent) +{ + tabWidget = new QTabWidget; + generalTab = new GeneralTab(this); + tabWidget->addTab(generalTab, tr("General")); +// tabWidget->addTab(new PermissionsTab(fileInfo), tr("Permissions")); +// tabWidget->addTab(new ApplicationsTab(fileInfo), tr("Applications")); + + buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + + connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + + QVBoxLayout * mainLayout = new QVBoxLayout; + mainLayout->addWidget(tabWidget); + mainLayout->addWidget(buttonBox); + setLayout(mainLayout); + + setWindowTitle(tr("Architektonas Settings")); +} + +SettingsDialog::~SettingsDialog() +{ +} diff --git a/src/settingsdialog.h b/src/settingsdialog.h new file mode 100644 index 0000000..2298a6e --- /dev/null +++ b/src/settingsdialog.h @@ -0,0 +1,24 @@ +#ifndef __SETTINGSDIALOG_H__ +#define __SETTINGSDIALOG_H__ + +#include + +class GeneralTab; + +class SettingsDialog: public QDialog +{ + Q_OBJECT + + public: + SettingsDialog(QWidget * parent = 0); + ~SettingsDialog(); + + private: + QTabWidget * tabWidget; + QDialogButtonBox * buttonBox; + + public: + GeneralTab * generalTab; +}; + +#endif // __SETTINGSDIALOG_H__ -- 2.37.2
Architektonas: Free, Industrial Strength 2D Computer Aided Design
Architektonas: Free, Industrial Strength 2D Computer Aided Design
Architektonas: Free, Industrial Strength 2D Computer Aided Design
Version: 1.0.0
License: GPL v3 or later
Chief Architect: James L. Hammons (shamus)