base/config/kconfig/qconf.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
00003  * Released under the terms of the GNU GPL v2.0.
00004  */
00005 
00006 #include <qlistview.h>
00007 
00008 class ConfigList;
00009 class ConfigItem;
00010 class ConfigLineEdit;
00011 class ConfigMainWindow;
00012 
00013 class ConfigView : public QVBox {
00014     Q_OBJECT
00015     typedef class QVBox Parent;
00016 public:
00017     ConfigView(QWidget* parent, ConfigMainWindow* cview);
00018     ~ConfigView(void);
00019     static void updateList(ConfigItem* item);
00020     static void updateListAll(void);
00021 
00022 public:
00023     ConfigList* list;
00024     ConfigLineEdit* lineEdit;
00025 
00026     static ConfigView* viewList;
00027     ConfigView* nextView;
00028 };
00029 
00030 enum colIdx {
00031     promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
00032 };
00033 enum listMode {
00034     singleMode, menuMode, symbolMode, fullMode
00035 };
00036 
00037 class ConfigList : public QListView {
00038     Q_OBJECT
00039     typedef class QListView Parent;
00040 public:
00041     ConfigList(ConfigView* p, ConfigMainWindow* cview);
00042     void reinit(void);
00043     ConfigView* parent(void) const
00044     {
00045         return (ConfigView*)Parent::parent();
00046     }
00047 
00048 protected:
00049     ConfigMainWindow* cview;
00050 
00051     void keyPressEvent(QKeyEvent *e);
00052     void contentsMousePressEvent(QMouseEvent *e);
00053     void contentsMouseReleaseEvent(QMouseEvent *e);
00054     void contentsMouseMoveEvent(QMouseEvent *e);
00055     void contentsMouseDoubleClickEvent(QMouseEvent *e);
00056     void focusInEvent(QFocusEvent *e);
00057 public slots:
00058     void setRootMenu(struct menu *menu);
00059 
00060     void updateList(ConfigItem *item);
00061     void setValue(ConfigItem* item, tristate val);
00062     void changeValue(ConfigItem* item);
00063     void updateSelection(void);
00064 signals:
00065     void menuSelected(struct menu *menu);
00066     void parentSelected(void);
00067     void gotFocus(void);
00068 
00069 public:
00070     void updateListAll(void)
00071     {
00072         updateAll = true;
00073         updateList(NULL);
00074         updateAll = false;
00075     }
00076     ConfigList* listView()
00077     {
00078         return this;
00079     }
00080     ConfigItem* firstChild() const
00081     {
00082         return (ConfigItem *)Parent::firstChild();
00083     }
00084     int mapIdx(colIdx idx)
00085     {
00086         return colMap[idx];
00087     }
00088     void addColumn(colIdx idx, const QString& label)
00089     {
00090         colMap[idx] = Parent::addColumn(label);
00091         colRevMap[colMap[idx]] = idx;
00092     }
00093     void removeColumn(colIdx idx)
00094     {
00095         int col = colMap[idx];
00096         if (col >= 0) {
00097             Parent::removeColumn(col);
00098             colRevMap[col] = colMap[idx] = -1;
00099         }
00100     }
00101     void setAllOpen(bool open);
00102     void setParentMenu(void);
00103 
00104     template <class P>
00105     void updateMenuList(P*, struct menu*);
00106 
00107     bool updateAll;
00108 
00109     QPixmap symbolYesPix, symbolModPix, symbolNoPix;
00110     QPixmap choiceYesPix, choiceNoPix;
00111     QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
00112 
00113     bool showAll, showName, showRange, showData;
00114     enum listMode mode;
00115     struct menu *rootEntry;
00116     QColorGroup disabledColorGroup;
00117     QColorGroup inactivedColorGroup;
00118 
00119 private:
00120     int colMap[colNr];
00121     int colRevMap[colNr];
00122 };
00123 
00124 class ConfigItem : public QListViewItem {
00125     typedef class QListViewItem Parent;
00126 public:
00127     ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v)
00128     : Parent(parent, after), menu(m), visible(v), goParent(false)
00129     {
00130         init();
00131     }
00132     ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
00133     : Parent(parent, after), menu(m), visible(v), goParent(false)
00134     {
00135         init();
00136     }
00137     ConfigItem(QListView *parent, ConfigItem *after, bool v)
00138     : Parent(parent, after), menu(0), visible(v), goParent(true)
00139     {
00140         init();
00141     }
00142     ~ConfigItem(void);
00143     void init(void);
00144 #if QT_VERSION >= 300
00145     void okRename(int col);
00146 #endif
00147     void updateMenu(void);
00148     void testUpdateMenu(bool v);
00149     ConfigList* listView() const
00150     {
00151         return (ConfigList*)Parent::listView();
00152     }
00153     ConfigItem* firstChild() const
00154     {
00155         return (ConfigItem *)Parent::firstChild();
00156     }
00157     ConfigItem* nextSibling() const
00158     {
00159         return (ConfigItem *)Parent::nextSibling();
00160     }
00161     void setText(colIdx idx, const QString& text)
00162     {
00163         Parent::setText(listView()->mapIdx(idx), text);
00164     }
00165     QString text(colIdx idx) const
00166     {
00167         return Parent::text(listView()->mapIdx(idx));
00168     }
00169     void setPixmap(colIdx idx, const QPixmap& pm)
00170     {
00171         Parent::setPixmap(listView()->mapIdx(idx), pm);
00172     }
00173     const QPixmap* pixmap(colIdx idx) const
00174     {
00175         return Parent::pixmap(listView()->mapIdx(idx));
00176     }
00177     void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align);
00178 
00179     ConfigItem* nextItem;
00180     struct menu *menu;
00181     bool visible;
00182     bool goParent;
00183 };
00184 
00185 class ConfigLineEdit : public QLineEdit {
00186     Q_OBJECT
00187     typedef class QLineEdit Parent;
00188 public:
00189     ConfigLineEdit(ConfigView* parent)
00190     : Parent(parent)
00191     { }
00192     ConfigView* parent(void) const
00193     {
00194         return (ConfigView*)Parent::parent();
00195     }
00196     void show(ConfigItem *i);
00197     void keyPressEvent(QKeyEvent *e);
00198 
00199 public:
00200     ConfigItem *item;
00201 };
00202 
00203 class ConfigMainWindow : public QMainWindow {
00204     Q_OBJECT
00205 public:
00206     ConfigMainWindow(void);
00207 public slots:
00208     void setHelp(QListViewItem* item);
00209     void changeMenu(struct menu *);
00210     void listFocusChanged(void);
00211     void goBack(void);
00212     void loadConfig(void);
00213     void saveConfig(void);
00214     void saveConfigAs(void);
00215     void showSingleView(void);
00216     void showSplitView(void);
00217     void showFullView(void);
00218     void setShowAll(bool);
00219     void setShowDebug(bool);
00220     void setShowRange(bool);
00221     void setShowName(bool);
00222     void setShowData(bool);
00223     void showIntro(void);
00224     void showAbout(void);
00225 
00226 protected:
00227     void closeEvent(QCloseEvent *e);
00228 
00229     ConfigView *menuView;
00230     ConfigList *menuList;
00231     ConfigView *configView;
00232     ConfigList *configList;
00233     QTextView *helpText;
00234     QToolBar *toolBar;
00235     QAction *backAction;
00236 
00237     bool showDebug;
00238 };

Generated on Tue Feb 2 17:46:04 2010 for RTAI API by  doxygen 1.4.7