]> Shamusworld >> Repos - architektonas/commitdiff
Added Settings dialog.
authorShamus Hammons <jlhamm@acm.org>
Sun, 5 Jun 2011 03:22:20 +0000 (03:22 +0000)
committerShamus Hammons <jlhamm@acm.org>
Sun, 5 Jun 2011 03:22:20 +0000 (03:22 +0000)
architektonas.pro
src/about.cpp
src/applicationwindow.cpp
src/applicationwindow.h
src/generaltab.cpp [new file with mode: 0644]
src/generaltab.h [new file with mode: 0644]
src/settingsdialog.cpp [new file with mode: 0644]
src/settingsdialog.h [new file with mode: 0644]

index 8b15d07c0603a4aa90fa969e48da2136f3b6e39d..cf3254c9b8392c5723b12e47fc8fe3eeea0e42b2 100644 (file)
@@ -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 \
index 25cd93eaec454ae9bc2018fd1384b6beab115e40..cef694e3fba0571efe39a40f94a54948ed98fbc7 100644 (file)
@@ -61,11 +61,11 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
        QString s = QString(tr(
                "<table>"
                "<tr>"
-               "<td><img src=':/res/about-logo.png' style='float:left; margin-right:20px'></td>"
+               "<td  style='padding-right:15px'><img src=':/res/about-logo.png'></td>"
                "<td>"
                "<table>"
 //             "<tr><td align='right'><b>Architektonas: </b></td><td width='100'>Free, <i>Industrial Strength</i> 2D Computer Aided Design</td></tr>"
-               "<tr><td align='right'><b>Architektonas: </b></td><td>Free, <i>Industrial Strength</i> 2D Computer Aided Design</td></tr>"
+               "<tr><td align='right' width='100'><b>Architektonas: </b></td><td>Free, <i>Industrial Strength</i> 2D Computer Aided Design</td></tr>"
                "<tr><td align='right'><b>Version: </b></td><td>1.0.0</td></tr>"
                "<tr><td align='right'><b>License: </b></td><td>GPL v3 or later</td></tr>"
                "<tr><td align='right'><b>Chief Architect: </b></td><td>James L. Hammons (shamus)</td></tr>"
index 2c7f22fb31ae4f7d54017684b58bc249f7558967..fe0c29db9fd1e2696e91266b40411f0071c3cbad 100644 (file)
@@ -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);
index c3e06a5d91b52ac4c7a35c818088c87eef303b69..99b5441b73edf31f30aa65351c2f81b2f68a9586 100644 (file)
@@ -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 (file)
index 0000000..ebe36cb
--- /dev/null
@@ -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 <jlhamm@acm.org>
+//
+// 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 (file)
index 0000000..8dde60a
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef __GENERALTAB_H__
+#define __GENERALTAB_H__
+
+#include <QtGui>
+
+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 (file)
index 0000000..94c61ab
--- /dev/null
@@ -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 <jlhamm@acm.org>
+//
+// 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 (file)
index 0000000..2298a6e
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef __SETTINGSDIALOG_H__
+#define __SETTINGSDIALOG_H__
+
+#include <QtGui>
+
+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__