mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	Port xconfig to Qt5 - Remove custom ListView classes.
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Thiago Macieira <thiago.macieira@intel.com> Signed-off-by: Michal Marek <mmarek@suse.com>
This commit is contained in:
		
							parent
							
								
									780505e33f
								
							
						
					
					
						commit
						76538660fb
					
				
					 2 changed files with 15 additions and 1066 deletions
				
			
		
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -8,8 +8,6 @@
 | 
				
			||||||
#include <qsettings.h>
 | 
					#include <qsettings.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ConfigView;
 | 
					class ConfigView;
 | 
				
			||||||
class ConfigList;
 | 
					 | 
				
			||||||
class ConfigItem;
 | 
					 | 
				
			||||||
class ConfigLineEdit;
 | 
					class ConfigLineEdit;
 | 
				
			||||||
class ConfigMainWindow;
 | 
					class ConfigMainWindow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,159 +28,6 @@ enum optionMode {
 | 
				
			||||||
	normalOpt = 0, allOpt, promptOpt
 | 
						normalOpt = 0, allOpt, promptOpt
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ConfigList : public Q3ListView {
 | 
					 | 
				
			||||||
	Q_OBJECT
 | 
					 | 
				
			||||||
	typedef class Q3ListView Parent;
 | 
					 | 
				
			||||||
public:
 | 
					 | 
				
			||||||
	ConfigList(ConfigView* p, const char *name = 0);
 | 
					 | 
				
			||||||
	void reinit(void);
 | 
					 | 
				
			||||||
	ConfigView* parent(void) const
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return (ConfigView*)Parent::parent();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	ConfigItem* findConfigItem(struct menu *);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
protected:
 | 
					 | 
				
			||||||
	void keyPressEvent(QKeyEvent *e);
 | 
					 | 
				
			||||||
	void contentsMousePressEvent(QMouseEvent *e);
 | 
					 | 
				
			||||||
	void contentsMouseReleaseEvent(QMouseEvent *e);
 | 
					 | 
				
			||||||
	void contentsMouseMoveEvent(QMouseEvent *e);
 | 
					 | 
				
			||||||
	void contentsMouseDoubleClickEvent(QMouseEvent *e);
 | 
					 | 
				
			||||||
	void focusInEvent(QFocusEvent *e);
 | 
					 | 
				
			||||||
	void contextMenuEvent(QContextMenuEvent *e);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public slots:
 | 
					 | 
				
			||||||
	void setRootMenu(struct menu *menu);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	void updateList(ConfigItem *item);
 | 
					 | 
				
			||||||
	void setValue(ConfigItem* item, tristate val);
 | 
					 | 
				
			||||||
	void changeValue(ConfigItem* item);
 | 
					 | 
				
			||||||
	void updateSelection(void);
 | 
					 | 
				
			||||||
	void saveSettings(void);
 | 
					 | 
				
			||||||
signals:
 | 
					 | 
				
			||||||
	void menuChanged(struct menu *menu);
 | 
					 | 
				
			||||||
	void menuSelected(struct menu *menu);
 | 
					 | 
				
			||||||
	void parentSelected(void);
 | 
					 | 
				
			||||||
	void gotFocus(struct menu *);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public:
 | 
					 | 
				
			||||||
	void updateListAll(void)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		updateAll = true;
 | 
					 | 
				
			||||||
		updateList(NULL);
 | 
					 | 
				
			||||||
		updateAll = false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	ConfigList* listView()
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return this;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	ConfigItem* firstChild() const
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return (ConfigItem *)Parent::firstChild();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	int mapIdx(colIdx idx)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return colMap[idx];
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	void addColumn(colIdx idx, const QString& label)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		colMap[idx] = Parent::addColumn(label);
 | 
					 | 
				
			||||||
		colRevMap[colMap[idx]] = idx;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	void removeColumn(colIdx idx)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		int col = colMap[idx];
 | 
					 | 
				
			||||||
		if (col >= 0) {
 | 
					 | 
				
			||||||
			Parent::removeColumn(col);
 | 
					 | 
				
			||||||
			colRevMap[col] = colMap[idx] = -1;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	void setAllOpen(bool open);
 | 
					 | 
				
			||||||
	void setParentMenu(void);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	bool menuSkip(struct menu *);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	template <class P>
 | 
					 | 
				
			||||||
	void updateMenuList(P*, struct menu*);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	bool updateAll;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	QPixmap symbolYesPix, symbolModPix, symbolNoPix;
 | 
					 | 
				
			||||||
	QPixmap choiceYesPix, choiceNoPix;
 | 
					 | 
				
			||||||
	QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	bool showName, showRange, showData;
 | 
					 | 
				
			||||||
	enum listMode mode;
 | 
					 | 
				
			||||||
	enum optionMode optMode;
 | 
					 | 
				
			||||||
	struct menu *rootEntry;
 | 
					 | 
				
			||||||
	QColorGroup disabledColorGroup;
 | 
					 | 
				
			||||||
	QColorGroup inactivedColorGroup;
 | 
					 | 
				
			||||||
	QMenu* headerPopup;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
private:
 | 
					 | 
				
			||||||
	int colMap[colNr];
 | 
					 | 
				
			||||||
	int colRevMap[colNr];
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class ConfigItem : public Q3ListViewItem {
 | 
					 | 
				
			||||||
	typedef class Q3ListViewItem Parent;
 | 
					 | 
				
			||||||
public:
 | 
					 | 
				
			||||||
	ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
 | 
					 | 
				
			||||||
	: Parent(parent, after), menu(m), visible(v), goParent(false)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		init();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
 | 
					 | 
				
			||||||
	: Parent(parent, after), menu(m), visible(v), goParent(false)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		init();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
 | 
					 | 
				
			||||||
	: Parent(parent, after), menu(0), visible(v), goParent(true)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		init();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	~ConfigItem(void);
 | 
					 | 
				
			||||||
	void init(void);
 | 
					 | 
				
			||||||
	void okRename(int col);
 | 
					 | 
				
			||||||
	void updateMenu(void);
 | 
					 | 
				
			||||||
	void testUpdateMenu(bool v);
 | 
					 | 
				
			||||||
	ConfigList* listView() const
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return (ConfigList*)Parent::listView();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	ConfigItem* firstChild() const
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return (ConfigItem *)Parent::firstChild();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	ConfigItem* nextSibling() const
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return (ConfigItem *)Parent::nextSibling();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	void setText(colIdx idx, const QString& text)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		Parent::setText(listView()->mapIdx(idx), text);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	QString text(colIdx idx) const
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return Parent::text(listView()->mapIdx(idx));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	void setPixmap(colIdx idx, const QPixmap& pm)
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		Parent::setPixmap(listView()->mapIdx(idx), pm);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	const QPixmap* pixmap(colIdx idx) const
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return Parent::pixmap(listView()->mapIdx(idx));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ConfigItem* nextItem;
 | 
					 | 
				
			||||||
	struct menu *menu;
 | 
					 | 
				
			||||||
	bool visible;
 | 
					 | 
				
			||||||
	bool goParent;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class ConfigLineEdit : public QLineEdit {
 | 
					class ConfigLineEdit : public QLineEdit {
 | 
				
			||||||
	Q_OBJECT
 | 
						Q_OBJECT
 | 
				
			||||||
	typedef class QLineEdit Parent;
 | 
						typedef class QLineEdit Parent;
 | 
				
			||||||
| 
						 | 
					@ -192,11 +37,11 @@ class ConfigLineEdit : public QLineEdit {
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		return (ConfigView*)Parent::parent();
 | 
							return (ConfigView*)Parent::parent();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	void show(ConfigItem *i);
 | 
						void show(Q3ListViewItem *i);
 | 
				
			||||||
	void keyPressEvent(QKeyEvent *e);
 | 
						void keyPressEvent(QKeyEvent *e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	ConfigItem *item;
 | 
						Q3ListViewItem *item;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ConfigView : public QWidget {
 | 
					class ConfigView : public QWidget {
 | 
				
			||||||
| 
						 | 
					@ -205,12 +50,12 @@ class ConfigView : public QWidget {
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	ConfigView(QWidget* parent, const char *name = 0);
 | 
						ConfigView(QWidget* parent, const char *name = 0);
 | 
				
			||||||
	~ConfigView(void);
 | 
						~ConfigView(void);
 | 
				
			||||||
	static void updateList(ConfigItem* item);
 | 
						static void updateList(Q3ListViewItem* item);
 | 
				
			||||||
	static void updateListAll(void);
 | 
						static void updateListAll(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool showName(void) const { return list->showName; }
 | 
						bool showName(void) const { return false; } // TODO: Implement me.
 | 
				
			||||||
	bool showRange(void) const { return list->showRange; }
 | 
						bool showRange(void) const { return false; } // TODO: Implement me.
 | 
				
			||||||
	bool showData(void) const { return list->showData; }
 | 
						bool showData(void) const { return false; } // TODO: Implement me.
 | 
				
			||||||
public slots:
 | 
					public slots:
 | 
				
			||||||
	void setShowName(bool);
 | 
						void setShowName(bool);
 | 
				
			||||||
	void setShowRange(bool);
 | 
						void setShowRange(bool);
 | 
				
			||||||
| 
						 | 
					@ -221,7 +66,7 @@ public slots:
 | 
				
			||||||
	void showRangeChanged(bool);
 | 
						void showRangeChanged(bool);
 | 
				
			||||||
	void showDataChanged(bool);
 | 
						void showDataChanged(bool);
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	ConfigList* list;
 | 
						Q3ListView* list;
 | 
				
			||||||
	ConfigLineEdit* lineEdit;
 | 
						ConfigLineEdit* lineEdit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static ConfigView* viewList;
 | 
						static ConfigView* viewList;
 | 
				
			||||||
| 
						 | 
					@ -310,15 +155,15 @@ public slots:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ConfigSearchWindow *searchWindow;
 | 
						ConfigSearchWindow *searchWindow;
 | 
				
			||||||
	ConfigView *menuView;
 | 
						ConfigView *menuView;
 | 
				
			||||||
	ConfigList *menuList;
 | 
						Q3ListView *menuList;
 | 
				
			||||||
	ConfigView *configView;
 | 
						ConfigView *configView;
 | 
				
			||||||
	ConfigList *configList;
 | 
						Q3ListView *configList;
 | 
				
			||||||
	ConfigInfoView *helpText;
 | 
						ConfigInfoView *helpText;
 | 
				
			||||||
	QToolBar *toolBar;
 | 
						QToolBar *toolBar;
 | 
				
			||||||
	QAction *backAction;
 | 
						QAction *backAction;
 | 
				
			||||||
	QAction *singleViewAction;
 | 
						QAction *singleViewAction;
 | 
				
			||||||
	QAction *splitViewAction;
 | 
						QAction *splitViewAction;
 | 
				
			||||||
	QAction *fullViewAction;
 | 
						QAction *fullViewAction;
 | 
				
			||||||
	QSplitter* split1;
 | 
						QSplitter *split1;
 | 
				
			||||||
	QSplitter* split2;
 | 
						QSplitter *split2;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue