Commit 7fc925fd authored by Roman Zippel's avatar Roman Zippel Committed by Sam Ravnborg

kconfig: finer customization via popup menus

This allows to configure every symbol list and info window separately via a
popup menu, these settings are also separately saved and restored.  Cleanup
the ConfigSettings class a bit to reduce the number of #ifdef.
Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 43bf612a
This diff is collapsed.
...@@ -7,9 +7,25 @@ ...@@ -7,9 +7,25 @@
#if QT_VERSION >= 300 #if QT_VERSION >= 300
#include <qsettings.h> #include <qsettings.h>
#else #else
class QSettings { }; class QSettings {
public:
void beginGroup(const QString& group) { }
void endGroup(void) { }
bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
{ if (ok) *ok = FALSE; return def; }
int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
{ if (ok) *ok = FALSE; return def; }
QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
{ if (ok) *ok = FALSE; return def; }
QStringList readListEntry(const QString& key, bool* ok = 0) const
{ if (ok) *ok = FALSE; return QStringList(); }
template <class t>
bool writeEntry(const QString& key, t value)
{ return TRUE; }
};
#endif #endif
class ConfigView;
class ConfigList; class ConfigList;
class ConfigItem; class ConfigItem;
class ConfigLineEdit; class ConfigLineEdit;
...@@ -18,35 +34,8 @@ class ConfigMainWindow; ...@@ -18,35 +34,8 @@ class ConfigMainWindow;
class ConfigSettings : public QSettings { class ConfigSettings : public QSettings {
public: public:
ConfigSettings();
#if QT_VERSION >= 300
void readListSettings();
QValueList<int> readSizes(const QString& key, bool *ok); QValueList<int> readSizes(const QString& key, bool *ok);
bool writeSizes(const QString& key, const QValueList<int>& value); bool writeSizes(const QString& key, const QValueList<int>& value);
#endif
bool showAll;
bool showName;
bool showRange;
bool showData;
};
class ConfigView : public QVBox {
Q_OBJECT
typedef class QVBox Parent;
public:
ConfigView(QWidget* parent, ConfigSettings* configSettings);
~ConfigView(void);
static void updateList(ConfigItem* item);
static void updateListAll(void);
public:
ConfigList* list;
ConfigLineEdit* lineEdit;
static ConfigView* viewList;
ConfigView* nextView;
}; };
enum colIdx { enum colIdx {
...@@ -60,7 +49,7 @@ class ConfigList : public QListView { ...@@ -60,7 +49,7 @@ class ConfigList : public QListView {
Q_OBJECT Q_OBJECT
typedef class QListView Parent; typedef class QListView Parent;
public: public:
ConfigList(ConfigView* p, ConfigSettings *configSettings); ConfigList(ConfigView* p, const char *name = 0);
void reinit(void); void reinit(void);
ConfigView* parent(void) const ConfigView* parent(void) const
{ {
...@@ -74,6 +63,8 @@ class ConfigList : public QListView { ...@@ -74,6 +63,8 @@ class ConfigList : public QListView {
void contentsMouseMoveEvent(QMouseEvent *e); void contentsMouseMoveEvent(QMouseEvent *e);
void contentsMouseDoubleClickEvent(QMouseEvent *e); void contentsMouseDoubleClickEvent(QMouseEvent *e);
void focusInEvent(QFocusEvent *e); void focusInEvent(QFocusEvent *e);
void contextMenuEvent(QContextMenuEvent *e);
public slots: public slots:
void setRootMenu(struct menu *menu); void setRootMenu(struct menu *menu);
...@@ -81,6 +72,7 @@ public slots: ...@@ -81,6 +72,7 @@ public slots:
void setValue(ConfigItem* item, tristate val); void setValue(ConfigItem* item, tristate val);
void changeValue(ConfigItem* item); void changeValue(ConfigItem* item);
void updateSelection(void); void updateSelection(void);
void saveSettings(void);
signals: signals:
void menuChanged(struct menu *menu); void menuChanged(struct menu *menu);
void menuSelected(struct menu *menu); void menuSelected(struct menu *menu);
...@@ -136,6 +128,7 @@ public slots: ...@@ -136,6 +128,7 @@ public slots:
struct menu *rootEntry; struct menu *rootEntry;
QColorGroup disabledColorGroup; QColorGroup disabledColorGroup;
QColorGroup inactivedColorGroup; QColorGroup inactivedColorGroup;
QPopupMenu* headerPopup;
private: private:
int colMap[colNr]; int colMap[colNr];
...@@ -219,6 +212,37 @@ class ConfigLineEdit : public QLineEdit { ...@@ -219,6 +212,37 @@ class ConfigLineEdit : public QLineEdit {
ConfigItem *item; ConfigItem *item;
}; };
class ConfigView : public QVBox {
Q_OBJECT
typedef class QVBox Parent;
public:
ConfigView(QWidget* parent, const char *name = 0);
~ConfigView(void);
static void updateList(ConfigItem* item);
static void updateListAll(void);
bool showAll(void) const { return list->showAll; }
bool showName(void) const { return list->showName; }
bool showRange(void) const { return list->showRange; }
bool showData(void) const { return list->showData; }
public slots:
void setShowAll(bool);
void setShowName(bool);
void setShowRange(bool);
void setShowData(bool);
signals:
void showAllChanged(bool);
void showNameChanged(bool);
void showRangeChanged(bool);
void showDataChanged(bool);
public:
ConfigList* list;
ConfigLineEdit* lineEdit;
static ConfigView* viewList;
ConfigView* nextView;
};
class ConfigInfoView : public QTextBrowser { class ConfigInfoView : public QTextBrowser {
Q_OBJECT Q_OBJECT
typedef class QTextBrowser Parent; typedef class QTextBrowser Parent;
...@@ -228,6 +252,7 @@ class ConfigInfoView : public QTextBrowser { ...@@ -228,6 +252,7 @@ class ConfigInfoView : public QTextBrowser {
public slots: public slots:
void setInfo(struct menu *menu); void setInfo(struct menu *menu);
void saveSettings(void);
void setSource(const QString& name); void setSource(const QString& name);
void setShowDebug(bool); void setShowDebug(bool);
...@@ -239,6 +264,8 @@ public slots: ...@@ -239,6 +264,8 @@ public slots:
QString debug_info(struct symbol *sym); QString debug_info(struct symbol *sym);
static QString print_filter(const QString &str); static QString print_filter(const QString &str);
static void expr_print_help(void *data, const char *str); static void expr_print_help(void *data, const char *str);
QPopupMenu* createPopupMenu(const QPoint& pos);
void contentsContextMenuEvent(QContextMenuEvent *e);
struct menu *menu; struct menu *menu;
bool _showDebug; bool _showDebug;
...@@ -248,12 +275,16 @@ class ConfigSearchWindow : public QDialog { ...@@ -248,12 +275,16 @@ class ConfigSearchWindow : public QDialog {
Q_OBJECT Q_OBJECT
typedef class QDialog Parent; typedef class QDialog Parent;
public: public:
ConfigSearchWindow(QWidget* parent); ConfigSearchWindow(QWidget* parent, const char *name = 0);
public slots: public slots:
void saveSettings(void);
void search(void); void search(void);
protected: protected:
QLineEdit* editField; QLineEdit* editField;
QPushButton* searchButton; QPushButton* searchButton;
QSplitter* split;
ConfigView* list; ConfigView* list;
ConfigInfoView* info; ConfigInfoView* info;
...@@ -276,10 +307,6 @@ public slots: ...@@ -276,10 +307,6 @@ public slots:
void showSingleView(void); void showSingleView(void);
void showSplitView(void); void showSplitView(void);
void showFullView(void); void showFullView(void);
void setShowAll(bool);
void setShowRange(bool);
void setShowName(bool);
void setShowData(bool);
void showIntro(void); void showIntro(void);
void showAbout(void); void showAbout(void);
void saveSettings(void); void saveSettings(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment