diff mbox series

[05/11] kconfig: qconf: show data column all the time

Message ID 20200829081417.725978-5-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series [01/11] kconfig: qconf: reformat the intro message | expand

Commit Message

Masahiro Yamada Aug. 29, 2020, 8:14 a.m. UTC
The next commit will allow users to edit "int", "hex", "string"
menus in-place from the data column.

The data column should be always displayed.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 29 +----------------------------
 scripts/kconfig/qconf.h  |  5 +----
 2 files changed, 2 insertions(+), 32 deletions(-)

Comments

Randy Dunlap Aug. 30, 2020, 4:54 a.m. UTC | #1
On 8/29/20 1:14 AM, Masahiro Yamada wrote:
> The next commit will allow users to edit "int", "hex", "string"
> menus in-place from the data column.
> 
> The data column should be always displayed.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  scripts/kconfig/qconf.cc | 29 +----------------------------
>  scripts/kconfig/qconf.h  |  5 +----
>  2 files changed, 2 insertions(+), 32 deletions(-)
> 

I am trying to edit LOG_BUF_SHIFT, which has a value of 17
(this is x86_64).

I want to change the 7 to 9, making it 19, so I double-click on the "17"
(single-click won't give me an edit cursor). The edit cursor is
immediately after the "17", so it's like
						17|
with the | cursor blinking. What I expect to be able to do is
Backspace, enter 9, press Enter, and the new value is 19.
But Backspace does nothing. I just have to enter the complete new
value: 19. So IMO it does not act like an edit box so much as a
replacement box.
Also, the new value that I enter is displayed/written over the old value,
so I see 17 in white-on-blue and over that I see 19 in black until I
press Enter, then I see only 19 in white-on-blue.

BTW, if I edit DEFAULT_HOSTNAME, which begins as "(none)" and I change it
to "xyz" and then change it to <empty string>, it becomes
CONFIG_DEFAULT_HOSTNAME=""
Should I have to enter "(none)" to get it back to (none)?  I guess so.
Masahiro Yamada Aug. 30, 2020, 9:59 a.m. UTC | #2
On Sun, Aug 30, 2020 at 1:54 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> On 8/29/20 1:14 AM, Masahiro Yamada wrote:
> > The next commit will allow users to edit "int", "hex", "string"
> > menus in-place from the data column.
> >
> > The data column should be always displayed.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> >  scripts/kconfig/qconf.cc | 29 +----------------------------
> >  scripts/kconfig/qconf.h  |  5 +----
> >  2 files changed, 2 insertions(+), 32 deletions(-)
> >
>
> I am trying to edit LOG_BUF_SHIFT, which has a value of 17
> (this is x86_64).


My goal is to use Qt gadgets with least modification
and align with the standard behavior as much as possible.



> I want to change the 7 to 9, making it 19, so I double-click on the "17"
> (single-click won't give me an edit cursor).


Yes. You need to double-click the cell
to open up the editor.
Single-click is not enough.

It is the same for a simple example
program using QTreeWidgetItem.
So, it is the standard behavior of the Qt library.



> The edit cursor is
> immediately after the "17", so it's like
>                                                 17|
> with the | cursor blinking.


Same for me.
And the "17" is highlighted.

> What I expect to be able to do is
> Backspace, enter 9, press Enter, and the new value is 19.
> But Backspace does nothing.

That is different from what I see on my machine
(matacity of Ubuntu).

After I double-clicked the cell, the entire "17" is high-lighted.
Backspace deleted "17" entirely for me.

The same behavior for a simple example,
and it makes sense since Backspace should delete the selected characters.

If Backspace does not work at all for you,
was it perhaps captured somewhere else on your machine?


> I just have to enter the complete new
> value: 19. So IMO it does not act like an edit box so much as a
> replacement box.

I am re-implementing a new way to edit values.
It does not need to act as before.


> Also, the new value that I enter is displayed/written over the old value,
> so I see 17 in white-on-blue and over that I see 19 in black until I
> press Enter, then I see only 19 in white-on-blue.

I do not see such a weirdness either on my machine.
I see only the new value I am entering.


I have no idea what makes it work differently
for you.



>
> BTW, if I edit DEFAULT_HOSTNAME, which begins as "(none)" and I change it
> to "xyz" and then change it to <empty string>, it becomes
> CONFIG_DEFAULT_HOSTNAME=""
> Should I have to enter "(none)" to get it back to (none)?  I guess so.


It is a text string, "(none)",
which is not an empty string.

See init/Kconfig.


config DEFAULT_HOSTNAME
        string "Default hostname"
        default "(none)"


--
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 035101984bd3..c48e48a3735f 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -288,7 +288,7 @@  void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
 ConfigList::ConfigList(ConfigView* p, const char *name)
 	: Parent(p),
 	  updateAll(false),
-	  showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt),
+	  showName(false), showRange(false), mode(singleMode), optMode(normalOpt),
 	  rootEntry(0), headerPopup(0)
 {
 	setObjectName(name);
@@ -307,7 +307,6 @@  ConfigList::ConfigList(ConfigView* p, const char *name)
 		configSettings->beginGroup(name);
 		showName = configSettings->value("/showName", false).toBool();
 		showRange = configSettings->value("/showRange", false).toBool();
-		showData = configSettings->value("/showData", false).toBool();
 		optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt();
 		configSettings->endGroup();
 		connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
@@ -338,7 +337,6 @@  bool ConfigList::menuSkip(struct menu *menu)
 
 void ConfigList::reinit(void)
 {
-	hideColumn(dataColIdx);
 	hideColumn(yesColIdx);
 	hideColumn(modColIdx);
 	hideColumn(noColIdx);
@@ -351,8 +349,6 @@  void ConfigList::reinit(void)
 		showColumn(modColIdx);
 		showColumn(yesColIdx);
 	}
-	if (showData)
-		showColumn(dataColIdx);
 
 	updateListAll();
 }
@@ -375,7 +371,6 @@  void ConfigList::saveSettings(void)
 		configSettings->beginGroup(objectName());
 		configSettings->setValue("/showName", showName);
 		configSettings->setValue("/showRange", showRange);
-		configSettings->setValue("/showData", showData);
 		configSettings->setValue("/optionMode", (int)optMode);
 		configSettings->endGroup();
 	}
@@ -918,15 +913,6 @@  void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 			action, SLOT(setChecked(bool)));
 		action->setChecked(showRange);
 		headerPopup->addAction(action);
-
-		action = new QAction("Show Data", this);
-		action->setCheckable(true);
-		connect(action, SIGNAL(toggled(bool)),
-			parent(), SLOT(setShowData(bool)));
-		connect(parent(), SIGNAL(showDataChanged(bool)),
-			action, SLOT(setChecked(bool)));
-		action->setChecked(showData);
-		headerPopup->addAction(action);
 	}
 
 	headerPopup->exec(e->globalPos());
@@ -970,15 +956,6 @@  void ConfigView::setShowRange(bool b)
 	}
 }
 
-void ConfigView::setShowData(bool b)
-{
-	if (list->showData != b) {
-		list->showData = b;
-		list->reinit();
-		emit showDataChanged(b);
-	}
-}
-
 void ConfigList::setAllOpen(bool open)
 {
 	QTreeWidgetItemIterator it(this);
@@ -1470,9 +1447,6 @@  ConfigMainWindow::ConfigMainWindow(void)
 	QAction *showRangeAction = new QAction("Show Range", this);
 	  showRangeAction->setCheckable(true);
 	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
-	QAction *showDataAction = new QAction("Show Data", this);
-	  showDataAction->setCheckable(true);
-	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
 
 	QActionGroup *optGroup = new QActionGroup(this);
 	optGroup->setExclusive(true);
@@ -1525,7 +1499,6 @@  ConfigMainWindow::ConfigMainWindow(void)
 	menu = menuBar()->addMenu("&Option");
 	menu->addAction(showNameAction);
 	menu->addAction(showRangeAction);
-	menu->addAction(showDataAction);
 	menu->addSeparator();
 	menu->addActions(optGroup->actions());
 	menu->addSeparator();
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 818e00617ae3..d01a6c620dbb 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -101,7 +101,7 @@  public slots:
 
 	bool updateAll;
 
-	bool showName, showRange, showData;
+	bool showName, showRange;
 	enum listMode mode;
 	enum optionMode optMode;
 	struct menu *rootEntry;
@@ -196,15 +196,12 @@  class ConfigView : public QWidget {
 
 	bool showName(void) const { return list->showName; }
 	bool showRange(void) const { return list->showRange; }
-	bool showData(void) const { return list->showData; }
 public slots:
 	void setShowName(bool);
 	void setShowRange(bool);
-	void setShowData(bool);
 signals:
 	void showNameChanged(bool);
 	void showRangeChanged(bool);
-	void showDataChanged(bool);
 public:
 	ConfigList* list;
 	ConfigLineEdit* lineEdit;