Skip to contentSkip to conversation

persist qconf options

PATCH In review Andreas Fester 3 participants 5 messages Feb 9, 2004 – Feb 10, 2004 Kconfig

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 persist qconf options

Hi,

enclosed is a patch to persist the selected options from the "Options" menu of qconf.
Please apply, since it really improves the usage of the qconf tool ;-) or otherwise comment ...

Thanks :-)

Andreas

scripts/kconfig/qconf.cc +53 -8
diff -ur linux-2.6.2/scripts/kconfig/qconf.cc linux-2.6.2-af2/scripts/kconfig/qconf.cc
@@ -327,13 +327,14 @@
 	hide();
 }
 
-ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv)
+ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv,
+			bool isShowAll, bool isShowName, bool isShowRange, bool isShowData)
 	: Parent(p), cview(cv),
 	  updateAll(false),
 	  symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
 	  choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
 	  menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void),
-	  showAll(false), showName(false), showRange(false), showData(false),
+	  showAll(isShowAll), showName(isShowName), showRange(isShowRange), showData(isShowData),
 	  rootEntry(0)
 {
 	int i;
@@ -702,10 +703,13 @@
 
 ConfigView* ConfigView::viewList;
 
-ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview)
+ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview,
+			bool isShowAll, bool isShowName,
+			bool isShowRange, bool isShowData)
 	: Parent(parent)
 {
-	list = new ConfigList(this, cview);
+	list = new ConfigList(this, cview, isShowAll, isShowName,
+			isShowRange, isShowData);
 	lineEdit = new ConfigLineEdit(this);
 	lineEdit->hide();
 
@@ -754,6 +758,11 @@
 
 	QWidget *d = configApp->desktop();
 
+	bool isShowAll = false;
+	bool isShowName = false;
+	bool isShowRange = false;
+	bool isShowData = false;
+
 #if QT_VERSION >= 300
 	width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64);
 	height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64);
@@ -763,26 +772,34 @@
 		y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok);
 	if (ok)
 		move(x, y);
+	showDebug = configSettings->readBoolEntry("/kconfig/qconf/showDebug", false);
+	isShowAll = configSettings->readBoolEntry("/kconfig/qconf/showAll", false);
+	isShowName = configSettings->readBoolEntry("/kconfig/qconf/showName", false);
+	isShowRange = configSettings->readBoolEntry("/kconfig/qconf/showRange", false);
+	isShowData = configSettings->readBoolEntry("/kconfig/qconf/showData", false);
 #else
 	width = d->width() - 64;
 	height = d->height() - 64;
 	resize(width, height);
-#endif
-
 	showDebug = false;
+#endif
 
 	split1 = new QSplitter(this);
 	split1->setOrientation(QSplitter::Horizontal);
 	setCentralWidget(split1);
 
-	menuView = new ConfigView(split1, this);
+	menuView = new ConfigView(split1, this,
+				 isShowAll, isShowName,
+				 isShowRange, isShowData);
 	menuList = menuView->list;
 
 	split2 = new QSplitter(split1);
 	split2->setOrientation(QSplitter::Vertical);
 
 	// create config tree
-	configView = new ConfigView(split2, this);
+	configView = new ConfigView(split2, this,
+				    isShowAll, isShowName,
+				    isShowRange, isShowData);
 	configList = configView->list;
 
 	helpText = new QTextView(split2);
@@ -1145,6 +1162,10 @@
 	menuList->updateListAll();
 }
 
+bool ConfigMainWindow::getShowAll() {
+	return configList->showAll;
+}
+
 void ConfigMainWindow::setShowDebug(bool b)
 {
 	if (showDebug == b)
@@ -1152,6 +1173,10 @@
 	showDebug = b;
 }
 
+bool ConfigMainWindow::getShowDebug() {
+	return showDebug;
+}
+
 void ConfigMainWindow::setShowName(bool b)
 {
 	if (configList->showName == b)
@@ -1162,6 +1187,10 @@
 	menuList->reinit();
 }
 
+bool ConfigMainWindow::getShowName() {
+	return configList->showName;
+}
+
 void ConfigMainWindow::setShowRange(bool b)
 {
 	if (configList->showRange == b)
@@ -1172,6 +1201,10 @@
 	menuList->reinit();
 }
 
+bool ConfigMainWindow::getShowRange() {
+	return configList->showRange;
+}
+
 void ConfigMainWindow::setShowData(bool b)
 {
 	if (configList->showData == b)
@@ -1182,6 +1215,11 @@
 	menuList->reinit();
 }
 
+bool ConfigMainWindow::getShowData() {
+	return configList->showData;
+}
+
+
 /*
  * ask for saving configuration before quitting
  * TODO ask only when something changed
@@ -1260,6 +1298,7 @@
 
 int main(int ac, char** av)
 {
+
 	ConfigMainWindow* v;
 	const char *name;
 
@@ -1301,6 +1340,12 @@
 	configSettings->writeEntry("/kconfig/qconf/window y", v->pos().y());
 	configSettings->writeEntry("/kconfig/qconf/window width", v->size().width());
 	configSettings->writeEntry("/kconfig/qconf/window height", v->size().height());
+	configSettings->writeEntry("/kconfig/qconf/showName", v->getShowName());
+	configSettings->writeEntry("/kconfig/qconf/showRange", v->getShowRange());
+	configSettings->writeEntry("/kconfig/qconf/showData", v->getShowData());
+	configSettings->writeEntry("/kconfig/qconf/showAll", v->getShowAll());
+	configSettings->writeEntry("/kconfig/qconf/showDebug", v->getShowDebug());
+
 	delete configSettings;
 #endif
 	return 0;
scripts/kconfig/qconf.h +11 -2
diff -ur linux-2.6.2/scripts/kconfig/qconf.h linux-2.6.2-af2/scripts/kconfig/qconf.h
@@ -14,7 +14,9 @@
 	Q_OBJECT
 	typedef class QVBox Parent;
 public:
-	ConfigView(QWidget* parent, ConfigMainWindow* cview);
+	ConfigView(QWidget* parent, ConfigMainWindow* cview,
+		   bool isShowAll = false, bool isShowName = false,
+		   bool isShowRange = false, bool isShowData = false);
 	~ConfigView(void);
 	static void updateList(ConfigItem* item);
 	static void updateListAll(void);
@@ -38,7 +40,9 @@
 	Q_OBJECT
 	typedef class QListView Parent;
 public:
-	ConfigList(ConfigView* p, ConfigMainWindow* cview);
+	ConfigList(ConfigView* p, ConfigMainWindow* cview,
+		   bool isShowAll = false, bool isShowName = false,
+		   bool isShowRange = false, bool isShowData = false);
 	void reinit(void);
 	ConfigView* parent(void) const
 	{
@@ -216,10 +220,15 @@
 	void showSplitView(void);
 	void showFullView(void);
 	void setShowAll(bool);
+	bool getShowAll();
 	void setShowDebug(bool);
+	bool getShowDebug();
 	void setShowRange(bool);
+	bool getShowRange();
 	void setShowName(bool);
+	bool getShowName();
 	void setShowData(bool);
+	bool getShowData();
 	void showIntro(void);
 	void showAbout(void);
#1 lore raw

On Mon, 09 Feb 2004 23:19:10 +0100 Andreas Fester <[email protected]> wrote:

| Hi,
| 
| enclosed is a patch to persist the selected options
| from the "Options" menu of qconf.
| Please apply, since it really improves the usage of the
| qconf tool ;-) or otherwise comment ...
| 
| Thanks :-)
| 
| 	Andreas

Cool. This is on my projects list for make *config. Thanks.

--
~Randy
kernel-janitors project: http://janitor.kernelnewbies.org/

#2 lore raw
In reply to Andreas Fester

Hi,

scripts/kconfig/qconf.cc line 1171

Quoted 11 lines · Andreas Fester
scripts/kconfig/qconf.cc +4 -0
@@ -1145,6 +1162,10 @@
  	menuList->updateListAll();
  }
 
+bool ConfigMainWindow::getShowAll() {
+	return configList->showAll;
+}
+
  void ConfigMainWindow::setShowDebug(bool b)
  {
  	if (showDebug == b)

All these access functions are really not neccessary.
If we change this I'd like to see this done properly. First all the settings business should be moved into a small helper class, so that there are not x number of new arguments to the ConfigList constructor. The saving of the settings should be connected to aboutToQuit(). Bonus points if you also save the list mode and the position of the splitter. :)

bye, Roman

#3 lore raw

Hi Roman,

thanks for the feedback :-)

Quoted 4 lines
Quoted 4 lines
scripts/kconfig/qconf.cc +0 -0
@@ -1145,6 +1162,10 @@
 	menuList->updateListAll();
 }
 
Quoted 10 lines

scripts/kconfig/qconf.cc line 1171

Quoted 7 lines
scripts/kconfig/qconf.cc +4 -0
+bool ConfigMainWindow::getShowAll() {
+	return configList->showAll;
+}
+
 void ConfigMainWindow::setShowDebug(bool b)
 {
 	if (showDebug == b)

All these access functions are really not neccessary.

Well, I think in the sense of an Object Oriented interface with getter/setter methods they probably *do* make sense ...

Quoted 2 lines

If we change this I'd like to see this done properly. First all the settings business should be moved into a small helper class, so that there

Agreed. I thought about something similar, but simply started to hack some code last night ;-)

Quoted 1 line

are not x number of new arguments to the ConfigList constructor. The

Agreed. The four additional arguments is what I mostly dislike with my solution.

Quoted 1 line

saving of the settings should be connected to aboutToQuit().

Ok.

Quoted 2 lines

Bonus points if you also save the list mode and the position of the splitter. :)

Lets see if I can win them :-)

Thanks,

Andreas

Signature · 3 lines
Andreas Fester
mailto:[email protected]
WWW: http://littletux.homelinux.org
#4 lore raw

Hi,

Quoted 4 lines · Andreas Fester
Quoted 1 line

All these access functions are really not neccessary.

Well, I think in the sense of an Object Oriented interface with getter/setter methods they probably *do* make sense ...

They have the tendency to bloat the source and I try to keep it small.

Quoted 4 lines
Quoted 2 lines

Bonus points if you also save the list mode and the position of the splitter. :)

Lets see if I can win them :-)

Great, I'm looking forward to it.
Thanks.

bye, Roman