openmw-tes3coop/apps/opencs/view/settings/usersettingsdialog.hpp
graffy76 101c147217 Final changes for record status icon feature, incl. window size user
preference

1. Included updated status icons, added base.png
2. Added doxygen comments CSV / CSM Settings classes
3. Implemented Glorf's code for window size preference
4. Minor changes code that searches maps in CSV / CSM Settings classes
5. Removed CSVSettings::SamplePage class
6. Other minor code maintenance / improvements
2013-06-20 18:06:25 -05:00

73 lines
1.8 KiB
C++

#ifndef USERSETTINGSDIALOG_H
#define USERSETTINGSDIALOG_H
#include <QMainWindow>
#include <QStackedWidget>
#include <QListWidgetItem>
#include <QApplication>
#include "../../model/settings/usersettings.hpp"
#include "../../model/settings/support.hpp"
#include "editorpage.hpp"
class QHBoxLayout;
class AbstractWidget;
class QStackedWidget;
class QListWidget;
namespace CSVSettings {
class AbstractPage;
class UserSettingsDialog : public QMainWindow
{
Q_OBJECT
QListWidget *mListWidget;
QStackedWidget *mStackedWidget;
public:
UserSettingsDialog(QMainWindow *parent = 0);
~UserSettingsDialog();
private:
/// Settings are written on close
void closeEvent (QCloseEvent *event);
/// return the setting page by name
/// performs dynamic cast to AbstractPage *
AbstractPage *getAbstractPage (int index);
void setWidgetStates ();
void buildPages();
void writeSettings();
/// Templated function to create a custom user preference page
template <typename T>
void createPage ()
{
T *page = new T(mStackedWidget);
mStackedWidget->addWidget (dynamic_cast<QWidget *>(page));
new QListWidgetItem (page->objectName(), mListWidget);
//finishing touches
QFontMetrics fm (QApplication::font());
int textWidth = fm.width(page->objectName());
if ((textWidth + 50) > mListWidget->minimumWidth())
mListWidget->setMinimumWidth(textWidth + 50);
resize (mStackedWidget->sizeHint());
}
public slots:
/// Called when a different page is selected in the left-hand list widget
void slotChangePage (QListWidgetItem*, QListWidgetItem*);
};
}
#endif // USERSETTINGSDIALOG_H