2013-05-08 01:33:42 +00:00
|
|
|
#ifndef USERSETTINGSDIALOG_H
|
|
|
|
#define USERSETTINGSDIALOG_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QStackedWidget>
|
2013-05-22 08:14:12 +00:00
|
|
|
#include <QListWidgetItem>
|
2013-06-15 11:40:18 +00:00
|
|
|
#include <QApplication>
|
2013-05-16 17:46:04 +00:00
|
|
|
|
2013-05-10 15:00:58 +00:00
|
|
|
#include "../../model/settings/usersettings.hpp"
|
|
|
|
#include "../../model/settings/support.hpp"
|
2013-05-08 01:33:42 +00:00
|
|
|
|
2013-06-15 11:40:18 +00:00
|
|
|
#include "editorpage.hpp"
|
|
|
|
|
2013-05-08 01:33:42 +00:00
|
|
|
class QHBoxLayout;
|
|
|
|
class AbstractWidget;
|
|
|
|
class QStackedWidget;
|
|
|
|
class QListWidget;
|
|
|
|
|
2013-05-11 10:55:46 +00:00
|
|
|
namespace CSVSettings {
|
2013-05-08 01:33:42 +00:00
|
|
|
|
|
|
|
class AbstractPage;
|
2013-05-12 20:15:57 +00:00
|
|
|
|
2013-05-08 01:33:42 +00:00
|
|
|
class UserSettingsDialog : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
QStringList mPaths;
|
|
|
|
QListWidget *mListWidget;
|
|
|
|
QStackedWidget *mStackedWidget;
|
|
|
|
|
|
|
|
public:
|
|
|
|
UserSettingsDialog(QMainWindow *parent = 0);
|
|
|
|
~UserSettingsDialog();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void closeEvent (QCloseEvent *event);
|
|
|
|
AbstractPage *getAbstractPage (int index);
|
2013-06-15 11:40:18 +00:00
|
|
|
void setWidgetStates ();
|
2013-05-08 01:33:42 +00:00
|
|
|
void buildPages();
|
|
|
|
void positionWindow ();
|
|
|
|
void writeSettings();
|
|
|
|
void createSamplePage();
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void createPage (const QString &title)
|
|
|
|
{
|
|
|
|
T *page = new T(title, this);
|
|
|
|
|
|
|
|
mStackedWidget->addWidget (dynamic_cast<QWidget *>(page));
|
|
|
|
|
|
|
|
new QListWidgetItem (page->objectName(), mListWidget);
|
|
|
|
|
|
|
|
//finishing touches
|
|
|
|
if (mStackedWidget->sizeHint().width() < 640)
|
|
|
|
mStackedWidget->sizeHint().setWidth(640);
|
|
|
|
|
|
|
|
if (mStackedWidget->sizeHint().height() < 480)
|
|
|
|
mStackedWidget->sizeHint().setHeight(480);
|
|
|
|
|
2013-06-15 11:40:18 +00:00
|
|
|
QFontMetrics fm (QApplication::font());
|
|
|
|
int textWidth = fm.width(page->objectName());
|
|
|
|
|
|
|
|
if ((textWidth + 50) > mListWidget->minimumWidth())
|
|
|
|
mListWidget->setMinimumWidth(textWidth + 50);
|
|
|
|
|
2013-05-08 01:33:42 +00:00
|
|
|
resize (mStackedWidget->sizeHint());
|
|
|
|
}
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void slotChangePage (QListWidgetItem*, QListWidgetItem*);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif // USERSETTINGSDIALOG_H
|