00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_VIEW_DIALOGS_PREFERENCES_H
00008 #define BALL_VIEW_DIALOGS_PREFERENCES_H
00009
00010 #ifndef BALL_COMMON_GLOBAL_H
00011 # include <BALL/COMMON/global.h>
00012 #endif
00013
00014 #include <BALL/DATATYPE/string.h>
00015 #ifdef BALL_COMPILER_MSVC
00016 # include <BALL/VIEW/UIC/ui_preferences.h>
00017 #else
00018 # include <BALL/VIEW/UIC/preferencesData.h>
00019 #endif
00020
00021
00022 #ifndef BALL_DATATYPE_HASHSET_H
00023 # include <BALL/DATATYPE/hashSet.h>
00024 #endif
00025
00026 #ifndef BALL_DATATYPE_HASHMAP_H
00027 # include <BALL/DATATYPE/hashMap.h>
00028 #endif
00029
00030 namespace BALL
00031 {
00032 class INIFile;
00033
00034 namespace VIEW
00035 {
00036 class PreferencesEntry;
00037
00044 class BALL_VIEW_EXPORT Preferences
00045 : public QDialog,
00046 public Ui_PreferencesData
00047 {
00048 Q_OBJECT
00049
00050 public:
00051
00055
00066 Preferences(QWidget *parent = NULL, const char *name = "Preferences");
00067
00069 Preferences(const Preferences& preferences);
00070
00072 virtual ~Preferences();
00073
00075
00078
00082 bool hasPages();
00083
00090 void insertEntry(PreferencesEntry *child);
00091
00097 void removeEntry(PreferencesEntry *child);
00098
00104 void fetchPreferences(INIFile &inifile);
00105
00111 void writePreferences(INIFile &inifile);
00112
00114 const QWidget* currentEntry() const;
00115
00117 const QWidget* currentPage() const;
00118
00119 public slots:
00120
00122
00125
00128 void show();
00129
00131 void showEntry(QWidget* page);
00132
00134 void entrySelected();
00135
00137 void setDefaultValues();
00138
00140 void cancelPreferences();
00141
00143 void applyPreferences();
00144
00146 void showHelp();
00147
00148 protected:
00149
00150 void removeItem_(QTreeWidgetItem* item, bool update);
00151
00152 HashSet<PreferencesEntry*> entries_;
00153 HashMap<QTreeWidgetItem*, QWidget*> item_to_widget_;
00154 HashMap<QTreeWidgetItem*, PreferencesEntry*> item_to_entry_;
00155 HashMap<QWidget*, QTreeWidgetItem*> widget_to_item_;
00156
00158 };
00159
00160 }
00161 }
00162
00163 #endif // BALL_VIEW_DIALOGS_PREFERENCES_H