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:
Boris Barbulovski 2015-09-22 11:36:14 -07:00 committed by Michal Marek
parent 780505e33f
commit 76538660fb
2 changed files with 15 additions and 1066 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,6 @@
#include <qsettings.h>
class ConfigView;
class ConfigList;
class ConfigItem;
class ConfigLineEdit;
class ConfigMainWindow;
@ -30,159 +28,6 @@ enum optionMode {
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 {
Q_OBJECT
typedef class QLineEdit Parent;
@ -192,11 +37,11 @@ class ConfigLineEdit : public QLineEdit {
{
return (ConfigView*)Parent::parent();
}
void show(ConfigItem *i);
void show(Q3ListViewItem *i);
void keyPressEvent(QKeyEvent *e);
public:
ConfigItem *item;
Q3ListViewItem *item;
};
class ConfigView : public QWidget {
@ -205,12 +50,12 @@ class ConfigView : public QWidget {
public:
ConfigView(QWidget* parent, const char *name = 0);
~ConfigView(void);
static void updateList(ConfigItem* item);
static void updateList(Q3ListViewItem* item);
static void updateListAll(void);
bool showName(void) const { return list->showName; }
bool showRange(void) const { return list->showRange; }
bool showData(void) const { return list->showData; }
bool showName(void) const { return false; } // TODO: Implement me.
bool showRange(void) const { return false; } // TODO: Implement me.
bool showData(void) const { return false; } // TODO: Implement me.
public slots:
void setShowName(bool);
void setShowRange(bool);
@ -221,7 +66,7 @@ public slots:
void showRangeChanged(bool);
void showDataChanged(bool);
public:
ConfigList* list;
Q3ListView* list;
ConfigLineEdit* lineEdit;
static ConfigView* viewList;
@ -310,15 +155,15 @@ public slots:
ConfigSearchWindow *searchWindow;
ConfigView *menuView;
ConfigList *menuList;
Q3ListView *menuList;
ConfigView *configView;
ConfigList *configList;
Q3ListView *configList;
ConfigInfoView *helpText;
QToolBar *toolBar;
QAction *backAction;
QAction *singleViewAction;
QAction *splitViewAction;
QAction *fullViewAction;
QSplitter* split1;
QSplitter* split2;
QSplitter *split1;
QSplitter *split2;
};