mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	kconfig: qconf: convert to Qt5 new signal/slot connection syntax
Now that the Qt4 support was dropped, we can use the new connection
syntax supported by Qt5. It provides compile-time checking of the
validity of the connection.
Previously, the connection between signals and slots were checked
only run-time.
Commit d85de3399f ("kconfig: qconf: fix signal connection to invalid
slots") fixed wrong slots.
This change makes it possible to catch such mistakes easily.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Boris Kolpackov <boris@codesynthesis.com>
			
			
This commit is contained in:
		
							parent
							
								
									7cd0158703
								
							
						
					
					
						commit
						a2574c12df
					
				
					 1 changed files with 76 additions and 56 deletions
				
			
		| 
						 | 
					@ -310,15 +310,16 @@ ConfigList::ConfigList(QWidget *parent, const char *name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	setHeaderLabels(QStringList() << "Option" << "Name" << "Value");
 | 
						setHeaderLabels(QStringList() << "Option" << "Name" << "Value");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	connect(this, SIGNAL(itemSelectionChanged(void)),
 | 
						connect(this, &ConfigList::itemSelectionChanged,
 | 
				
			||||||
		SLOT(updateSelection(void)));
 | 
							this, &ConfigList::updateSelection);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (name) {
 | 
						if (name) {
 | 
				
			||||||
		configSettings->beginGroup(name);
 | 
							configSettings->beginGroup(name);
 | 
				
			||||||
		showName = configSettings->value("/showName", false).toBool();
 | 
							showName = configSettings->value("/showName", false).toBool();
 | 
				
			||||||
		optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt();
 | 
							optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt();
 | 
				
			||||||
		configSettings->endGroup();
 | 
							configSettings->endGroup();
 | 
				
			||||||
		connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
 | 
							connect(configApp, &QApplication::aboutToQuit,
 | 
				
			||||||
 | 
								this, &ConfigList::saveSettings);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	showColumn(promptColIdx);
 | 
						showColumn(promptColIdx);
 | 
				
			||||||
| 
						 | 
					@ -888,10 +889,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 | 
				
			||||||
		headerPopup = new QMenu(this);
 | 
							headerPopup = new QMenu(this);
 | 
				
			||||||
		action = new QAction("Show Name", this);
 | 
							action = new QAction("Show Name", this);
 | 
				
			||||||
		action->setCheckable(true);
 | 
							action->setCheckable(true);
 | 
				
			||||||
		connect(action, SIGNAL(toggled(bool)),
 | 
							connect(action, &QAction::toggled,
 | 
				
			||||||
			SLOT(setShowName(bool)));
 | 
								this, &ConfigList::setShowName);
 | 
				
			||||||
		connect(this, SIGNAL(showNameChanged(bool)),
 | 
							connect(this, &ConfigList::showNameChanged,
 | 
				
			||||||
			action, SLOT(setChecked(bool)));
 | 
								action, &QAction::setChecked);
 | 
				
			||||||
		action->setChecked(showName);
 | 
							action->setChecked(showName);
 | 
				
			||||||
		headerPopup->addAction(action);
 | 
							headerPopup->addAction(action);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -936,15 +937,18 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
 | 
				
			||||||
		configSettings->beginGroup(objectName());
 | 
							configSettings->beginGroup(objectName());
 | 
				
			||||||
		setShowDebug(configSettings->value("/showDebug", false).toBool());
 | 
							setShowDebug(configSettings->value("/showDebug", false).toBool());
 | 
				
			||||||
		configSettings->endGroup();
 | 
							configSettings->endGroup();
 | 
				
			||||||
		connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
 | 
							connect(configApp, &QApplication::aboutToQuit,
 | 
				
			||||||
 | 
								this, &ConfigInfoView::saveSettings);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	contextMenu = createStandardContextMenu();
 | 
						contextMenu = createStandardContextMenu();
 | 
				
			||||||
	QAction *action = new QAction("Show Debug Info", contextMenu);
 | 
						QAction *action = new QAction("Show Debug Info", contextMenu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	action->setCheckable(true);
 | 
						action->setCheckable(true);
 | 
				
			||||||
	connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
 | 
						connect(action, &QAction::toggled,
 | 
				
			||||||
	connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setChecked(bool)));
 | 
							this, &ConfigInfoView::setShowDebug);
 | 
				
			||||||
 | 
						connect(this, &ConfigInfoView::showDebugChanged,
 | 
				
			||||||
 | 
							action, &QAction::setChecked);
 | 
				
			||||||
	action->setChecked(showDebug());
 | 
						action->setChecked(showDebug());
 | 
				
			||||||
	contextMenu->addSeparator();
 | 
						contextMenu->addSeparator();
 | 
				
			||||||
	contextMenu->addAction(action);
 | 
						contextMenu->addAction(action);
 | 
				
			||||||
| 
						 | 
					@ -1231,11 +1235,13 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)
 | 
				
			||||||
	layout2->setSpacing(6);
 | 
						layout2->setSpacing(6);
 | 
				
			||||||
	layout2->addWidget(new QLabel("Find:", this));
 | 
						layout2->addWidget(new QLabel("Find:", this));
 | 
				
			||||||
	editField = new QLineEdit(this);
 | 
						editField = new QLineEdit(this);
 | 
				
			||||||
	connect(editField, SIGNAL(returnPressed()), SLOT(search()));
 | 
						connect(editField, &QLineEdit::returnPressed,
 | 
				
			||||||
 | 
							this, &ConfigSearchWindow::search);
 | 
				
			||||||
	layout2->addWidget(editField);
 | 
						layout2->addWidget(editField);
 | 
				
			||||||
	searchButton = new QPushButton("Search", this);
 | 
						searchButton = new QPushButton("Search", this);
 | 
				
			||||||
	searchButton->setAutoDefault(false);
 | 
						searchButton->setAutoDefault(false);
 | 
				
			||||||
	connect(searchButton, SIGNAL(clicked()), SLOT(search()));
 | 
						connect(searchButton, &QPushButton::clicked,
 | 
				
			||||||
 | 
							this, &ConfigSearchWindow::search);
 | 
				
			||||||
	layout2->addWidget(searchButton);
 | 
						layout2->addWidget(searchButton);
 | 
				
			||||||
	layout1->addLayout(layout2);
 | 
						layout1->addLayout(layout2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1244,10 +1250,10 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)
 | 
				
			||||||
	list = new ConfigList(split, "search");
 | 
						list = new ConfigList(split, "search");
 | 
				
			||||||
	list->mode = listMode;
 | 
						list->mode = listMode;
 | 
				
			||||||
	info = new ConfigInfoView(split, "search");
 | 
						info = new ConfigInfoView(split, "search");
 | 
				
			||||||
	connect(list, SIGNAL(menuChanged(struct menu *)),
 | 
						connect(list, &ConfigList::menuChanged,
 | 
				
			||||||
		info, SLOT(setInfo(struct menu *)));
 | 
							info, &ConfigInfoView::setInfo);
 | 
				
			||||||
	connect(list, SIGNAL(menuChanged(struct menu *)),
 | 
						connect(list, &ConfigList::menuChanged,
 | 
				
			||||||
		parent, SLOT(setMenuLink(struct menu *)));
 | 
							parent, &ConfigMainWindow::setMenuLink);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	layout1->addWidget(split);
 | 
						layout1->addWidget(split);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1267,7 +1273,8 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)
 | 
				
			||||||
	if (ok)
 | 
						if (ok)
 | 
				
			||||||
		split->setSizes(sizes);
 | 
							split->setSizes(sizes);
 | 
				
			||||||
	configSettings->endGroup();
 | 
						configSettings->endGroup();
 | 
				
			||||||
	connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
 | 
						connect(configApp, &QApplication::aboutToQuit,
 | 
				
			||||||
 | 
							this, &ConfigSearchWindow::saveSettings);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ConfigSearchWindow::saveSettings(void)
 | 
					void ConfigSearchWindow::saveSettings(void)
 | 
				
			||||||
| 
						 | 
					@ -1367,19 +1374,23 @@ ConfigMainWindow::ConfigMainWindow(void)
 | 
				
			||||||
	configList->setFocus();
 | 
						configList->setFocus();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	backAction = new QAction(QPixmap(xpm_back), "Back", this);
 | 
						backAction = new QAction(QPixmap(xpm_back), "Back", this);
 | 
				
			||||||
	connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack()));
 | 
						connect(backAction, &QAction::triggered,
 | 
				
			||||||
 | 
							this, &ConfigMainWindow::goBack);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QAction *quitAction = new QAction("&Quit", this);
 | 
						QAction *quitAction = new QAction("&Quit", this);
 | 
				
			||||||
	quitAction->setShortcut(Qt::CTRL + Qt::Key_Q);
 | 
						quitAction->setShortcut(Qt::CTRL + Qt::Key_Q);
 | 
				
			||||||
	connect(quitAction, SIGNAL(triggered(bool)), SLOT(close()));
 | 
						connect(quitAction, &QAction::triggered,
 | 
				
			||||||
 | 
							this, &ConfigMainWindow::close);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QAction *loadAction = new QAction(QPixmap(xpm_load), "&Load", this);
 | 
						QAction *loadAction = new QAction(QPixmap(xpm_load), "&Load", this);
 | 
				
			||||||
	loadAction->setShortcut(Qt::CTRL + Qt::Key_L);
 | 
						loadAction->setShortcut(Qt::CTRL + Qt::Key_L);
 | 
				
			||||||
	connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig()));
 | 
						connect(loadAction, &QAction::triggered,
 | 
				
			||||||
 | 
							this, &ConfigMainWindow::loadConfig);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	saveAction = new QAction(QPixmap(xpm_save), "&Save", this);
 | 
						saveAction = new QAction(QPixmap(xpm_save), "&Save", this);
 | 
				
			||||||
	saveAction->setShortcut(Qt::CTRL + Qt::Key_S);
 | 
						saveAction->setShortcut(Qt::CTRL + Qt::Key_S);
 | 
				
			||||||
	connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig()));
 | 
						connect(saveAction, &QAction::triggered,
 | 
				
			||||||
 | 
							this, &ConfigMainWindow::saveConfig);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	conf_set_changed_callback(conf_changed);
 | 
						conf_set_changed_callback(conf_changed);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1388,31 +1399,37 @@ ConfigMainWindow::ConfigMainWindow(void)
 | 
				
			||||||
	configname = xstrdup(conf_get_configname());
 | 
						configname = xstrdup(conf_get_configname());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QAction *saveAsAction = new QAction("Save &As...", this);
 | 
						QAction *saveAsAction = new QAction("Save &As...", this);
 | 
				
			||||||
	  connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs()));
 | 
						connect(saveAsAction, &QAction::triggered,
 | 
				
			||||||
 | 
							this, &ConfigMainWindow::saveConfigAs);
 | 
				
			||||||
	QAction *searchAction = new QAction("&Find", this);
 | 
						QAction *searchAction = new QAction("&Find", this);
 | 
				
			||||||
	searchAction->setShortcut(Qt::CTRL + Qt::Key_F);
 | 
						searchAction->setShortcut(Qt::CTRL + Qt::Key_F);
 | 
				
			||||||
	  connect(searchAction, SIGNAL(triggered(bool)), SLOT(searchConfig()));
 | 
						connect(searchAction, &QAction::triggered,
 | 
				
			||||||
 | 
							this, &ConfigMainWindow::searchConfig);
 | 
				
			||||||
	singleViewAction = new QAction(QPixmap(xpm_single_view), "Single View", this);
 | 
						singleViewAction = new QAction(QPixmap(xpm_single_view), "Single View", this);
 | 
				
			||||||
	singleViewAction->setCheckable(true);
 | 
						singleViewAction->setCheckable(true);
 | 
				
			||||||
	  connect(singleViewAction, SIGNAL(triggered(bool)), SLOT(showSingleView()));
 | 
						connect(singleViewAction, &QAction::triggered,
 | 
				
			||||||
 | 
							this, &ConfigMainWindow::showSingleView);
 | 
				
			||||||
	splitViewAction = new QAction(QPixmap(xpm_split_view), "Split View", this);
 | 
						splitViewAction = new QAction(QPixmap(xpm_split_view), "Split View", this);
 | 
				
			||||||
	splitViewAction->setCheckable(true);
 | 
						splitViewAction->setCheckable(true);
 | 
				
			||||||
	  connect(splitViewAction, SIGNAL(triggered(bool)), SLOT(showSplitView()));
 | 
						connect(splitViewAction, &QAction::triggered,
 | 
				
			||||||
 | 
							this, &ConfigMainWindow::showSplitView);
 | 
				
			||||||
	fullViewAction = new QAction(QPixmap(xpm_tree_view), "Full View", this);
 | 
						fullViewAction = new QAction(QPixmap(xpm_tree_view), "Full View", this);
 | 
				
			||||||
	fullViewAction->setCheckable(true);
 | 
						fullViewAction->setCheckable(true);
 | 
				
			||||||
	  connect(fullViewAction, SIGNAL(triggered(bool)), SLOT(showFullView()));
 | 
						connect(fullViewAction, &QAction::triggered,
 | 
				
			||||||
 | 
							this, &ConfigMainWindow::showFullView);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QAction *showNameAction = new QAction("Show Name", this);
 | 
						QAction *showNameAction = new QAction("Show Name", this);
 | 
				
			||||||
	  showNameAction->setCheckable(true);
 | 
						  showNameAction->setCheckable(true);
 | 
				
			||||||
	connect(showNameAction, SIGNAL(toggled(bool)), configList, SLOT(setShowName(bool)));
 | 
						connect(showNameAction, &QAction::toggled,
 | 
				
			||||||
 | 
							configList, &ConfigList::setShowName);
 | 
				
			||||||
	showNameAction->setChecked(configList->showName);
 | 
						showNameAction->setChecked(configList->showName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QActionGroup *optGroup = new QActionGroup(this);
 | 
						QActionGroup *optGroup = new QActionGroup(this);
 | 
				
			||||||
	optGroup->setExclusive(true);
 | 
						optGroup->setExclusive(true);
 | 
				
			||||||
	connect(optGroup, SIGNAL(triggered(QAction*)), configList,
 | 
						connect(optGroup, &QActionGroup::triggered,
 | 
				
			||||||
		SLOT(setOptionMode(QAction *)));
 | 
							configList, &ConfigList::setOptionMode);
 | 
				
			||||||
	connect(optGroup, SIGNAL(triggered(QAction *)), menuList,
 | 
						connect(optGroup, &QActionGroup::triggered,
 | 
				
			||||||
		SLOT(setOptionMode(QAction *)));
 | 
							menuList, &ConfigList::setOptionMode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ConfigList::showNormalAction = new QAction("Show Normal Options", optGroup);
 | 
						ConfigList::showNormalAction = new QAction("Show Normal Options", optGroup);
 | 
				
			||||||
	ConfigList::showNormalAction->setCheckable(true);
 | 
						ConfigList::showNormalAction->setCheckable(true);
 | 
				
			||||||
| 
						 | 
					@ -1423,13 +1440,16 @@ ConfigMainWindow::ConfigMainWindow(void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QAction *showDebugAction = new QAction("Show Debug Info", this);
 | 
						QAction *showDebugAction = new QAction("Show Debug Info", this);
 | 
				
			||||||
	  showDebugAction->setCheckable(true);
 | 
						  showDebugAction->setCheckable(true);
 | 
				
			||||||
	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
 | 
						connect(showDebugAction, &QAction::toggled,
 | 
				
			||||||
 | 
							helpText, &ConfigInfoView::setShowDebug);
 | 
				
			||||||
	  showDebugAction->setChecked(helpText->showDebug());
 | 
						  showDebugAction->setChecked(helpText->showDebug());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QAction *showIntroAction = new QAction("Introduction", this);
 | 
						QAction *showIntroAction = new QAction("Introduction", this);
 | 
				
			||||||
	  connect(showIntroAction, SIGNAL(triggered(bool)), SLOT(showIntro()));
 | 
						connect(showIntroAction, &QAction::triggered,
 | 
				
			||||||
 | 
							this, &ConfigMainWindow::showIntro);
 | 
				
			||||||
	QAction *showAboutAction = new QAction("About", this);
 | 
						QAction *showAboutAction = new QAction("About", this);
 | 
				
			||||||
	  connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout()));
 | 
						connect(showAboutAction, &QAction::triggered,
 | 
				
			||||||
 | 
							this, &ConfigMainWindow::showAbout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// init tool bar
 | 
						// init tool bar
 | 
				
			||||||
	QToolBar *toolBar = addToolBar("Tools");
 | 
						QToolBar *toolBar = addToolBar("Tools");
 | 
				
			||||||
| 
						 | 
					@ -1467,30 +1487,30 @@ ConfigMainWindow::ConfigMainWindow(void)
 | 
				
			||||||
	menu->addAction(showIntroAction);
 | 
						menu->addAction(showIntroAction);
 | 
				
			||||||
	menu->addAction(showAboutAction);
 | 
						menu->addAction(showAboutAction);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	connect (helpText, SIGNAL (anchorClicked (const QUrl &)),
 | 
						connect(helpText, &ConfigInfoView::anchorClicked,
 | 
				
			||||||
		 helpText, SLOT (clicked (const QUrl &)) );
 | 
							helpText, &ConfigInfoView::clicked);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	connect(configList, SIGNAL(menuChanged(struct menu *)),
 | 
						connect(configList, &ConfigList::menuChanged,
 | 
				
			||||||
		helpText, SLOT(setInfo(struct menu *)));
 | 
							helpText, &ConfigInfoView::setInfo);
 | 
				
			||||||
	connect(configList, SIGNAL(menuSelected(struct menu *)),
 | 
						connect(configList, &ConfigList::menuSelected,
 | 
				
			||||||
		SLOT(changeMenu(struct menu *)));
 | 
							this, &ConfigMainWindow::changeMenu);
 | 
				
			||||||
	connect(configList, SIGNAL(itemSelected(struct menu *)),
 | 
						connect(configList, &ConfigList::itemSelected,
 | 
				
			||||||
		SLOT(changeItens(struct menu *)));
 | 
							this, &ConfigMainWindow::changeItens);
 | 
				
			||||||
	connect(configList, SIGNAL(parentSelected()),
 | 
						connect(configList, &ConfigList::parentSelected,
 | 
				
			||||||
		SLOT(goBack()));
 | 
							this, &ConfigMainWindow::goBack);
 | 
				
			||||||
	connect(menuList, SIGNAL(menuChanged(struct menu *)),
 | 
						connect(menuList, &ConfigList::menuChanged,
 | 
				
			||||||
		helpText, SLOT(setInfo(struct menu *)));
 | 
							helpText, &ConfigInfoView::setInfo);
 | 
				
			||||||
	connect(menuList, SIGNAL(menuSelected(struct menu *)),
 | 
						connect(menuList, &ConfigList::menuSelected,
 | 
				
			||||||
		SLOT(changeMenu(struct menu *)));
 | 
							this, &ConfigMainWindow::changeMenu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	connect(configList, SIGNAL(gotFocus(struct menu *)),
 | 
						connect(configList, &ConfigList::gotFocus,
 | 
				
			||||||
		helpText, SLOT(setInfo(struct menu *)));
 | 
							helpText, &ConfigInfoView::setInfo);
 | 
				
			||||||
	connect(menuList, SIGNAL(gotFocus(struct menu *)),
 | 
						connect(menuList, &ConfigList::gotFocus,
 | 
				
			||||||
		helpText, SLOT(setInfo(struct menu *)));
 | 
							helpText, &ConfigInfoView::setInfo);
 | 
				
			||||||
	connect(menuList, SIGNAL(gotFocus(struct menu *)),
 | 
						connect(menuList, &ConfigList::gotFocus,
 | 
				
			||||||
		SLOT(listFocusChanged(void)));
 | 
							this, &ConfigMainWindow::listFocusChanged);
 | 
				
			||||||
	connect(helpText, SIGNAL(menuSelected(struct menu *)),
 | 
						connect(helpText, &ConfigInfoView::menuSelected,
 | 
				
			||||||
		SLOT(setMenuLink(struct menu *)));
 | 
							this, &ConfigMainWindow::setMenuLink);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QString listMode = configSettings->value("/listMode", "symbol").toString();
 | 
						QString listMode = configSettings->value("/listMode", "symbol").toString();
 | 
				
			||||||
	if (listMode == "single")
 | 
						if (listMode == "single")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue