2018-12-18 15:13:35 +03:00
// SPDX-License-Identifier: GPL-2.0
2005-04-17 02:20:36 +04:00
/*
* Copyright ( C ) 2002 Roman Zippel < zippel @ linux - m68k . org >
2015-09-22 21:36:38 +03:00
* Copyright ( C ) 2015 Boris Barbulovski < bbarbulovski @ gmail . com >
2005-04-17 02:20:36 +04:00
*/
2015-09-22 21:36:03 +03:00
# include <QAction>
2023-08-09 14:42:31 +03:00
# include <QActionGroup>
2020-06-30 09:26:35 +03:00
# include <QApplication>
# include <QCloseEvent>
2020-06-30 09:26:37 +03:00
# include <QDebug>
2015-09-22 21:36:04 +03:00
# include <QFileDialog>
2020-06-30 09:26:35 +03:00
# include <QLabel>
# include <QLayout>
# include <QList>
2015-09-22 21:36:07 +03:00
# include <QMenu>
2020-06-30 09:26:35 +03:00
# include <QMenuBar>
# include <QMessageBox>
2023-08-09 14:42:31 +03:00
# include <QRegularExpression>
# include <QScreen>
2020-06-30 09:26:35 +03:00
# include <QToolBar>
2005-04-17 02:20:36 +04:00
# include <stdlib.h>
# include "lkc.h"
# include "qconf.h"
2018-12-21 11:33:07 +03:00
# include "images.h"
2005-04-17 02:20:36 +04:00
[PATCH] Kconfig i18n support
This patch adds i18n support for make *config, allowing users to have the
config process in their own language.
No printk was harmed in the process, don't worry, so all the bug reports,
kernel messages, etc, remain in english, just the user tools to configure
the kernel are internationalized.
Users not interested in translations can just unset the related LANG,
LC_ALL, etc env variables and have the config process in plain english,
something like:
LANG= make menuconfig
is enough for having the whole config process in english. Or just don't
install any translation file.
Translations for brazilian portuguese are being done by a team of
volunteers at:
http://www.visionflex.inf.br/kernel_ptbr/pmwiki.php/Principal/Traducoes
To start the translation process:
make update-po-config
This will generate the pot template named scripts/kconfig/linux.pot,
copy it to, say, ~/es.po, to start the translation for spanish.
To test your translation, as root issue this command:
msgfmt -o /usr/share/locale/es/LC_MESSAGES/linux.mo ~/es.po
Replace "es" with your language code.
Then execute, for instance:
make menuconfig
The current patch doesn't use any optimization to reduce the size of the
generated .mo file, it is possible to use the config option as a key, but
this doesn't prevent the current patch from being used or the translations
done under the current scheme to be in any way lost if we chose to do any
kind of keying.
Thanks to Fabricio Vaccari for starting the pt_BR (brazilian portuguese)
translation effort, Thiago Maciera for helping me with the gconf.cc (QT
frontent) i18n coding and to all the volunteers that are already working on
the first translation, to pt_BR.
I left the question on whether to ship the translations with the stock kernel
sources to be discussed here, please share your suggestions.
Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org
Signed-off-by: Andrew Morton <akpm@osdl.org>
2005-05-06 02:09:46 +04:00
2005-04-17 02:20:36 +04:00
static QApplication * configApp ;
2006-06-09 09:12:46 +04:00
static ConfigSettings * configSettings ;
2005-04-17 02:20:36 +04:00
2015-09-22 21:36:03 +03:00
QAction * ConfigMainWindow : : saveAction ;
2006-12-13 11:34:08 +03:00
2013-10-06 22:21:31 +04:00
ConfigSettings : : ConfigSettings ( )
: QSettings ( " kernel.org " , " qconf " )
{
}
2005-04-17 02:20:36 +04:00
/**
* Reads a list of integer values from the application settings .
*/
2015-09-22 21:36:05 +03:00
QList < int > ConfigSettings : : readSizes ( const QString & key , bool * ok )
2005-04-17 02:20:36 +04:00
{
2015-09-22 21:36:05 +03:00
QList < int > result ;
2010-05-07 09:58:04 +04:00
2016-12-01 01:57:55 +03:00
if ( contains ( key ) )
{
QStringList entryList = value ( key ) . toStringList ( ) ;
QStringList : : Iterator it ;
for ( it = entryList . begin ( ) ; it ! = entryList . end ( ) ; + + it )
result . push_back ( ( * it ) . toInt ( ) ) ;
* ok = true ;
}
else
* ok = false ;
2005-04-17 02:20:36 +04:00
return result ;
}
/**
* Writes a list of integer values to the application settings .
*/
2015-09-22 21:36:05 +03:00
bool ConfigSettings : : writeSizes ( const QString & key , const QList < int > & value )
2005-04-17 02:20:36 +04:00
{
QStringList stringList ;
2015-09-22 21:36:05 +03:00
QList < int > : : ConstIterator it ;
2005-04-17 02:20:36 +04:00
for ( it = value . begin ( ) ; it ! = value . end ( ) ; + + it )
stringList . push_back ( QString : : number ( * it ) ) ;
2015-09-22 21:36:15 +03:00
setValue ( key , stringList ) ;
2015-09-22 21:36:18 +03:00
2015-09-22 21:36:15 +03:00
return true ;
2005-04-17 02:20:36 +04:00
}
2020-08-07 12:19:07 +03:00
QIcon ConfigItem : : symbolYesIcon ;
QIcon ConfigItem : : symbolModIcon ;
QIcon ConfigItem : : symbolNoIcon ;
QIcon ConfigItem : : choiceYesIcon ;
QIcon ConfigItem : : choiceNoIcon ;
QIcon ConfigItem : : menuIcon ;
QIcon ConfigItem : : menubackIcon ;
2015-09-22 21:36:18 +03:00
/*
* update the displayed of a menu entry
*/
void ConfigItem : : updateMenu ( void )
{
2015-09-22 21:36:19 +03:00
ConfigList * list ;
struct symbol * sym ;
struct property * prop ;
QString prompt ;
int type ;
tristate expr ;
list = listView ( ) ;
if ( goParent ) {
2020-08-07 12:19:07 +03:00
setIcon ( promptColIdx , menubackIcon ) ;
2015-09-22 21:36:19 +03:00
prompt = " .. " ;
goto set_prompt ;
}
sym = menu - > sym ;
prop = menu - > prompt ;
2020-08-07 12:19:02 +03:00
prompt = menu_get_prompt ( menu ) ;
2015-09-22 21:36:19 +03:00
if ( prop ) switch ( prop - > type ) {
case P_MENU :
if ( list - > mode = = singleMode | | list - > mode = = symbolMode ) {
/* a menuconfig entry is displayed differently
* depending whether it ' s at the view root or a child .
*/
if ( sym & & list - > rootEntry = = menu )
break ;
2020-08-07 12:19:07 +03:00
setIcon ( promptColIdx , menuIcon ) ;
2015-09-22 21:36:19 +03:00
} else {
if ( sym )
break ;
2020-08-07 12:19:03 +03:00
setIcon ( promptColIdx , QIcon ( ) ) ;
2015-09-22 21:36:19 +03:00
}
goto set_prompt ;
case P_COMMENT :
2020-08-07 12:19:03 +03:00
setIcon ( promptColIdx , QIcon ( ) ) ;
2021-04-18 08:51:23 +03:00
prompt = " *** " + prompt + " *** " ;
2015-09-22 21:36:19 +03:00
goto set_prompt ;
default :
;
}
if ( ! sym )
goto set_prompt ;
2020-08-07 12:19:02 +03:00
setText ( nameColIdx , sym - > name ) ;
2015-09-22 21:36:19 +03:00
type = sym_get_type ( sym ) ;
switch ( type ) {
case S_BOOLEAN :
case S_TRISTATE :
char ch ;
2019-07-04 13:50:41 +03:00
if ( ! sym_is_changeable ( sym ) & & list - > optMode = = normalOpt ) {
2020-08-07 12:19:03 +03:00
setIcon ( promptColIdx , QIcon ( ) ) ;
2015-09-22 21:36:19 +03:00
break ;
}
expr = sym_get_tristate_value ( sym ) ;
switch ( expr ) {
case yes :
if ( sym_is_choice_value ( sym ) & & type = = S_BOOLEAN )
2020-08-07 12:19:07 +03:00
setIcon ( promptColIdx , choiceYesIcon ) ;
2015-09-22 21:36:19 +03:00
else
2020-08-07 12:19:07 +03:00
setIcon ( promptColIdx , symbolYesIcon ) ;
2015-09-22 21:36:19 +03:00
ch = ' Y ' ;
break ;
case mod :
2020-08-07 12:19:07 +03:00
setIcon ( promptColIdx , symbolModIcon ) ;
2015-09-22 21:36:19 +03:00
ch = ' M ' ;
break ;
default :
if ( sym_is_choice_value ( sym ) & & type = = S_BOOLEAN )
2020-08-07 12:19:07 +03:00
setIcon ( promptColIdx , choiceNoIcon ) ;
2015-09-22 21:36:19 +03:00
else
2020-08-07 12:19:07 +03:00
setIcon ( promptColIdx , symbolNoIcon ) ;
2015-09-22 21:36:19 +03:00
ch = ' N ' ;
break ;
}
setText ( dataColIdx , QChar ( ch ) ) ;
break ;
case S_INT :
case S_HEX :
case S_STRING :
kconfig: qconf: allow to edit "int", "hex", "string" menus in-place
Previously, when you double-clicked the "int", "hex", or "string" menus,
a line-edit gadget showed up to allow you to input the value, which
looked clumsy.
Also, it was buggy; the editor opened even if the config option was not
editable. For example, just try to double-click CC_VERSION_TEXT, which
has no prompt.
This commit sub-classes QStyleItemDelegate to allow users to edit
"int", "hex", "string" menus in-place. Just double-click (or press
the F2 key) in the data column. Then, an editor widget is placed on
top of the item view.
The two methods are overridden:
createEditor - process only when the data column is being accessed
and the menu is visible. Otherwise, return nullptr to disallow editing.
setModelData - take the new data from the editor, and set it to the
addressed symbol. If it was successful, update all the list windows.
Otherwise, (the reason for the failure is possibly the input data was
out of range), set the old value back to the editor.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-29 11:14:12 +03:00
setText ( dataColIdx , sym_get_string_value ( sym ) ) ;
2015-09-22 21:36:19 +03:00
break ;
}
if ( ! sym_has_value ( sym ) & & visible )
2018-05-22 22:36:12 +03:00
prompt + = " (NEW) " ;
2015-09-22 21:36:19 +03:00
set_prompt :
setText ( promptColIdx , prompt ) ;
2015-09-22 21:36:18 +03:00
}
void ConfigItem : : testUpdateMenu ( bool v )
{
2015-09-22 21:36:19 +03:00
ConfigItem * i ;
visible = v ;
if ( ! menu )
return ;
sym_calc_value ( menu - > sym ) ;
if ( menu - > flags & MENU_CHANGED ) {
/* the menu entry changed, so update all list items */
menu - > flags & = ~ MENU_CHANGED ;
for ( i = ( ConfigItem * ) menu - > data ; i ; i = i - > nextItem )
i - > updateMenu ( ) ;
} else if ( listView ( ) - > updateAll )
updateMenu ( ) ;
2015-09-22 21:36:18 +03:00
}
2015-09-22 21:36:17 +03:00
/*
* construct a menu entry
*/
void ConfigItem : : init ( void )
{
2015-09-22 21:36:19 +03:00
if ( menu ) {
ConfigList * list = listView ( ) ;
nextItem = ( ConfigItem * ) menu - > data ;
menu - > data = this ;
if ( list - > mode ! = fullMode )
setExpanded ( true ) ;
sym_calc_value ( menu - > sym ) ;
kconfig: qconf: allow to edit "int", "hex", "string" menus in-place
Previously, when you double-clicked the "int", "hex", or "string" menus,
a line-edit gadget showed up to allow you to input the value, which
looked clumsy.
Also, it was buggy; the editor opened even if the config option was not
editable. For example, just try to double-click CC_VERSION_TEXT, which
has no prompt.
This commit sub-classes QStyleItemDelegate to allow users to edit
"int", "hex", "string" menus in-place. Just double-click (or press
the F2 key) in the data column. Then, an editor widget is placed on
top of the item view.
The two methods are overridden:
createEditor - process only when the data column is being accessed
and the menu is visible. Otherwise, return nullptr to disallow editing.
setModelData - take the new data from the editor, and set it to the
addressed symbol. If it was successful, update all the list windows.
Otherwise, (the reason for the failure is possibly the input data was
out of range), set the old value back to the editor.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-29 11:14:12 +03:00
if ( menu - > sym ) {
enum symbol_type type = menu - > sym - > type ;
// Allow to edit "int", "hex", and "string" in-place in
// the data column. Unfortunately, you cannot specify
// the flags per column. Set ItemIsEditable for all
// columns here, and check the column in createEditor().
if ( type = = S_INT | | type = = S_HEX | | type = = S_STRING )
setFlags ( flags ( ) | Qt : : ItemIsEditable ) ;
}
2015-09-22 21:36:19 +03:00
}
updateMenu ( ) ;
2015-09-22 21:36:17 +03:00
}
/*
* destruct a menu entry
*/
ConfigItem : : ~ ConfigItem ( void )
{
2015-09-22 21:36:19 +03:00
if ( menu ) {
ConfigItem * * ip = ( ConfigItem * * ) & menu - > data ;
for ( ; * ip ; ip = & ( * ip ) - > nextItem ) {
if ( * ip = = this ) {
* ip = nextItem ;
break ;
}
}
}
2015-09-22 21:36:17 +03:00
}
kconfig: qconf: allow to edit "int", "hex", "string" menus in-place
Previously, when you double-clicked the "int", "hex", or "string" menus,
a line-edit gadget showed up to allow you to input the value, which
looked clumsy.
Also, it was buggy; the editor opened even if the config option was not
editable. For example, just try to double-click CC_VERSION_TEXT, which
has no prompt.
This commit sub-classes QStyleItemDelegate to allow users to edit
"int", "hex", "string" menus in-place. Just double-click (or press
the F2 key) in the data column. Then, an editor widget is placed on
top of the item view.
The two methods are overridden:
createEditor - process only when the data column is being accessed
and the menu is visible. Otherwise, return nullptr to disallow editing.
setModelData - take the new data from the editor, and set it to the
addressed symbol. If it was successful, update all the list windows.
Otherwise, (the reason for the failure is possibly the input data was
out of range), set the old value back to the editor.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-29 11:14:12 +03:00
QWidget * ConfigItemDelegate : : createEditor ( QWidget * parent ,
const QStyleOptionViewItem & option ,
const QModelIndex & index ) const
{
ConfigItem * item ;
// Only the data column is editable
if ( index . column ( ) ! = dataColIdx )
return nullptr ;
// You cannot edit invisible menus
item = static_cast < ConfigItem * > ( index . internalPointer ( ) ) ;
if ( ! item | | ! item - > menu | | ! menu_is_visible ( item - > menu ) )
return nullptr ;
return QStyledItemDelegate : : createEditor ( parent , option , index ) ;
}
void ConfigItemDelegate : : setModelData ( QWidget * editor ,
QAbstractItemModel * model ,
const QModelIndex & index ) const
{
QLineEdit * lineEdit ;
ConfigItem * item ;
struct symbol * sym ;
bool success ;
lineEdit = qobject_cast < QLineEdit * > ( editor ) ;
// If this is not a QLineEdit, use the parent's default.
// (does this happen?)
if ( ! lineEdit )
goto parent ;
item = static_cast < ConfigItem * > ( index . internalPointer ( ) ) ;
if ( ! item | | ! item - > menu )
goto parent ;
sym = item - > menu - > sym ;
if ( ! sym )
goto parent ;
success = sym_set_string_value ( sym , lineEdit - > text ( ) . toUtf8 ( ) . data ( ) ) ;
if ( success ) {
ConfigList : : updateListForAll ( ) ;
} else {
QMessageBox : : information ( editor , " qconf " ,
" Cannot set the data (maybe due to out of range). \n "
" Setting the old value. " ) ;
lineEdit - > setText ( sym_get_string_value ( sym ) ) ;
}
parent :
QStyledItemDelegate : : setModelData ( editor , model , index ) ;
}
2020-08-29 11:14:15 +03:00
ConfigList : : ConfigList ( QWidget * parent , const char * name )
: QTreeWidget ( parent ) ,
2015-09-22 21:36:18 +03:00
updateAll ( false ) ,
2020-08-29 11:14:16 +03:00
showName ( false ) , mode ( singleMode ) , optMode ( normalOpt ) ,
2015-09-22 21:36:18 +03:00
rootEntry ( 0 ) , headerPopup ( 0 )
{
2015-09-22 21:36:19 +03:00
setObjectName ( name ) ;
2015-09-22 21:36:29 +03:00
setSortingEnabled ( false ) ;
2015-09-22 21:36:19 +03:00
setRootIsDecorated ( true ) ;
2015-09-22 21:36:31 +03:00
setVerticalScrollMode ( ScrollPerPixel ) ;
setHorizontalScrollMode ( ScrollPerPixel ) ;
2020-08-29 11:14:16 +03:00
setHeaderLabels ( QStringList ( ) < < " Option " < < " Name " < < " Value " ) ;
2015-09-22 21:36:24 +03:00
2020-10-24 15:38:41 +03:00
connect ( this , & ConfigList : : itemSelectionChanged ,
this , & ConfigList : : updateSelection ) ;
2015-09-22 21:36:19 +03:00
if ( name ) {
configSettings - > beginGroup ( name ) ;
showName = configSettings - > value ( " /showName " , false ) . toBool ( ) ;
optMode = ( enum optionMode ) configSettings - > value ( " /optionMode " , 0 ) . toInt ( ) ;
configSettings - > endGroup ( ) ;
2020-10-24 15:38:41 +03:00
connect ( configApp , & QApplication : : aboutToQuit ,
this , & ConfigList : : saveSettings ) ;
2015-09-22 21:36:19 +03:00
}
2020-08-07 12:19:04 +03:00
showColumn ( promptColIdx ) ;
2015-09-22 21:36:19 +03:00
kconfig: qconf: allow to edit "int", "hex", "string" menus in-place
Previously, when you double-clicked the "int", "hex", or "string" menus,
a line-edit gadget showed up to allow you to input the value, which
looked clumsy.
Also, it was buggy; the editor opened even if the config option was not
editable. For example, just try to double-click CC_VERSION_TEXT, which
has no prompt.
This commit sub-classes QStyleItemDelegate to allow users to edit
"int", "hex", "string" menus in-place. Just double-click (or press
the F2 key) in the data column. Then, an editor widget is placed on
top of the item view.
The two methods are overridden:
createEditor - process only when the data column is being accessed
and the menu is visible. Otherwise, return nullptr to disallow editing.
setModelData - take the new data from the editor, and set it to the
addressed symbol. If it was successful, update all the list windows.
Otherwise, (the reason for the failure is possibly the input data was
out of range), set the old value back to the editor.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-29 11:14:12 +03:00
setItemDelegate ( new ConfigItemDelegate ( this ) ) ;
2020-08-29 11:14:10 +03:00
allLists . append ( this ) ;
2015-09-22 21:36:19 +03:00
reinit ( ) ;
}
2020-08-29 11:14:10 +03:00
ConfigList : : ~ ConfigList ( )
{
allLists . removeOne ( this ) ;
}
2015-09-22 21:36:19 +03:00
bool ConfigList : : menuSkip ( struct menu * menu )
{
if ( optMode = = normalOpt & & menu_is_visible ( menu ) )
return false ;
if ( optMode = = promptOpt & & menu_has_prompt ( menu ) )
return false ;
if ( optMode = = allOpt )
return false ;
return true ;
2015-09-22 21:36:18 +03:00
}
void ConfigList : : reinit ( void )
{
2020-08-07 12:19:04 +03:00
hideColumn ( nameColIdx ) ;
2015-09-22 21:36:19 +03:00
if ( showName )
2020-08-07 12:19:04 +03:00
showColumn ( nameColIdx ) ;
2015-09-22 21:36:19 +03:00
updateListAll ( ) ;
2015-09-22 21:36:18 +03:00
}
2020-08-07 12:19:09 +03:00
void ConfigList : : setOptionMode ( QAction * action )
{
if ( action = = showNormalAction )
optMode = normalOpt ;
else if ( action = = showAllAction )
optMode = allOpt ;
else
optMode = promptOpt ;
updateListAll ( ) ;
}
2015-09-22 21:36:18 +03:00
void ConfigList : : saveSettings ( void )
{
2015-09-22 21:36:19 +03:00
if ( ! objectName ( ) . isEmpty ( ) ) {
configSettings - > beginGroup ( objectName ( ) ) ;
configSettings - > setValue ( " /showName " , showName ) ;
configSettings - > setValue ( " /optionMode " , ( int ) optMode ) ;
configSettings - > endGroup ( ) ;
}
2015-09-22 21:36:18 +03:00
}
ConfigItem * ConfigList : : findConfigItem ( struct menu * menu )
{
2015-09-22 21:36:19 +03:00
ConfigItem * item = ( ConfigItem * ) menu - > data ;
for ( ; item ; item = item - > nextItem ) {
if ( this = = item - > listView ( ) )
break ;
}
return item ;
2015-09-22 21:36:18 +03:00
}
void ConfigList : : updateSelection ( void )
{
2015-09-22 21:36:19 +03:00
struct menu * menu ;
enum prop_type type ;
2015-09-22 21:36:28 +03:00
if ( selectedItems ( ) . count ( ) = = 0 )
return ;
2015-09-22 21:36:19 +03:00
ConfigItem * item = ( ConfigItem * ) selectedItems ( ) . first ( ) ;
if ( ! item )
return ;
menu = item - > menu ;
emit menuChanged ( menu ) ;
if ( ! menu )
return ;
type = menu - > prompt ? menu - > prompt - > type : P_UNKNOWN ;
if ( mode = = menuMode & & type = = P_MENU )
emit menuSelected ( menu ) ;
2015-09-22 21:36:18 +03:00
}
2020-08-07 12:18:59 +03:00
void ConfigList : : updateList ( )
2015-09-22 21:36:18 +03:00
{
2015-09-22 21:36:19 +03:00
ConfigItem * last = 0 ;
2020-08-07 12:18:59 +03:00
ConfigItem * item ;
2015-09-22 21:36:19 +03:00
if ( ! rootEntry ) {
if ( mode ! = listMode )
goto update ;
QTreeWidgetItemIterator it ( this ) ;
while ( * it ) {
item = ( ConfigItem * ) ( * it ) ;
if ( ! item - > menu )
continue ;
item - > testUpdateMenu ( menu_is_visible ( item - > menu ) ) ;
+ + it ;
}
return ;
}
if ( rootEntry ! = & rootmenu & & ( mode = = singleMode | |
( mode = = symbolMode & & rootEntry - > parent ! = & rootmenu ) ) ) {
2015-09-22 21:36:37 +03:00
item = ( ConfigItem * ) topLevelItem ( 0 ) ;
Revert "kconfig: qconf: don't show goback button on splitMode"
This reverts commit cc1c08edccaf5317d99a17a3231fe06381044e83.
Maxim Levitsky reports 'make xconfig' crashes since that commit
(https://lkml.org/lkml/2020/7/18/411)
Or, the following is simple test code that makes it crash:
menu "Menu"
config FOO
bool "foo"
default y
menuconfig BAR
bool "bar"
depends on FOO
endmenu
Select the Split View mode, and double-click "bar" in the right
window, then you will see Segmentation fault.
When 'last' is not set for symbolMode, the following code in
ConfigList::updateList() calls firstChild().
item = last ? last->nextSibling() : firstChild();
However, the pointer returned by ConfigList::firstChild() does not
seem to be compatible with (ConfigItem *), which seems another bug.
I'd rather want to reconsider whether hiding the goback icon is the
right thing to do.
In the following test code, the Split View shows "Menu2" and "Menu3"
in the right window. You can descend into "Menu3", but there is no way
to ascend back to "Menu2" from "Menu3".
menu "Menu1"
config FOO
bool "foo"
default y
menu "Menu2"
depends on FOO
menu "Menu3"
config BAZ
bool "baz"
endmenu
endmenu
endmenu
It is true that the goback button is currently not functional due to
yet another bug, but hiding the problem is not the right way to go.
Anyway, Segmentation fault is fatal. Revert the offending commit for
now, and we should find the right solution.
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-01 10:08:49 +03:00
if ( ! item )
2015-09-22 21:36:19 +03:00
item = new ConfigItem ( this , 0 , true ) ;
Revert "kconfig: qconf: don't show goback button on splitMode"
This reverts commit cc1c08edccaf5317d99a17a3231fe06381044e83.
Maxim Levitsky reports 'make xconfig' crashes since that commit
(https://lkml.org/lkml/2020/7/18/411)
Or, the following is simple test code that makes it crash:
menu "Menu"
config FOO
bool "foo"
default y
menuconfig BAR
bool "bar"
depends on FOO
endmenu
Select the Split View mode, and double-click "bar" in the right
window, then you will see Segmentation fault.
When 'last' is not set for symbolMode, the following code in
ConfigList::updateList() calls firstChild().
item = last ? last->nextSibling() : firstChild();
However, the pointer returned by ConfigList::firstChild() does not
seem to be compatible with (ConfigItem *), which seems another bug.
I'd rather want to reconsider whether hiding the goback icon is the
right thing to do.
In the following test code, the Split View shows "Menu2" and "Menu3"
in the right window. You can descend into "Menu3", but there is no way
to ascend back to "Menu2" from "Menu3".
menu "Menu1"
config FOO
bool "foo"
default y
menu "Menu2"
depends on FOO
menu "Menu3"
config BAZ
bool "baz"
endmenu
endmenu
endmenu
It is true that the goback button is currently not functional due to
yet another bug, but hiding the problem is not the right way to go.
Anyway, Segmentation fault is fatal. Revert the offending commit for
now, and we should find the right solution.
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-01 10:08:49 +03:00
last = item ;
2015-09-22 21:36:19 +03:00
}
if ( ( mode = = singleMode | | ( mode = = symbolMode & & ! ( rootEntry - > flags & MENU_ROOT ) ) ) & &
rootEntry - > sym & & rootEntry - > prompt ) {
2020-08-01 10:08:50 +03:00
item = last ? last - > nextSibling ( ) : nullptr ;
2015-09-22 21:36:19 +03:00
if ( ! item )
item = new ConfigItem ( this , last , rootEntry , true ) ;
else
item - > testUpdateMenu ( true ) ;
updateMenuList ( item , rootEntry ) ;
update ( ) ;
2015-09-22 21:36:31 +03:00
resizeColumnToContents ( 0 ) ;
2015-09-22 21:36:19 +03:00
return ;
}
update :
2020-08-07 12:19:01 +03:00
updateMenuList ( rootEntry ) ;
2015-09-22 21:36:19 +03:00
update ( ) ;
2015-09-22 21:36:31 +03:00
resizeColumnToContents ( 0 ) ;
2015-09-22 21:36:18 +03:00
}
2020-08-29 11:14:10 +03:00
void ConfigList : : updateListForAll ( )
{
QListIterator < ConfigList * > it ( allLists ) ;
while ( it . hasNext ( ) ) {
ConfigList * list = it . next ( ) ;
list - > updateList ( ) ;
}
}
void ConfigList : : updateListAllForAll ( )
{
QListIterator < ConfigList * > it ( allLists ) ;
while ( it . hasNext ( ) ) {
ConfigList * list = it . next ( ) ;
list - > updateList ( ) ;
}
}
2015-09-22 21:36:18 +03:00
void ConfigList : : setValue ( ConfigItem * item , tristate val )
{
2015-09-22 21:36:19 +03:00
struct symbol * sym ;
int type ;
tristate oldval ;
sym = item - > menu ? item - > menu - > sym : 0 ;
if ( ! sym )
return ;
type = sym_get_type ( sym ) ;
switch ( type ) {
case S_BOOLEAN :
case S_TRISTATE :
oldval = sym_get_tristate_value ( sym ) ;
if ( ! sym_set_tristate_value ( sym , val ) )
return ;
if ( oldval = = no & & item - > menu - > list )
item - > setExpanded ( true ) ;
2020-08-29 11:14:10 +03:00
ConfigList : : updateListForAll ( ) ;
2015-09-22 21:36:19 +03:00
break ;
}
2015-09-22 21:36:18 +03:00
}
void ConfigList : : changeValue ( ConfigItem * item )
{
2015-09-22 21:36:19 +03:00
struct symbol * sym ;
struct menu * menu ;
int type , oldexpr , newexpr ;
menu = item - > menu ;
if ( ! menu )
return ;
sym = menu - > sym ;
if ( ! sym ) {
if ( item - > menu - > list )
item - > setExpanded ( ! item - > isExpanded ( ) ) ;
return ;
}
type = sym_get_type ( sym ) ;
switch ( type ) {
case S_BOOLEAN :
case S_TRISTATE :
oldexpr = sym_get_tristate_value ( sym ) ;
newexpr = sym_toggle_tristate_value ( sym ) ;
if ( item - > menu - > list ) {
if ( oldexpr = = newexpr )
item - > setExpanded ( ! item - > isExpanded ( ) ) ;
else if ( oldexpr = = no )
item - > setExpanded ( true ) ;
}
if ( oldexpr ! = newexpr )
2020-08-29 11:14:10 +03:00
ConfigList : : updateListForAll ( ) ;
2015-09-22 21:36:19 +03:00
break ;
kconfig: qconf: allow to edit "int", "hex", "string" menus in-place
Previously, when you double-clicked the "int", "hex", or "string" menus,
a line-edit gadget showed up to allow you to input the value, which
looked clumsy.
Also, it was buggy; the editor opened even if the config option was not
editable. For example, just try to double-click CC_VERSION_TEXT, which
has no prompt.
This commit sub-classes QStyleItemDelegate to allow users to edit
"int", "hex", "string" menus in-place. Just double-click (or press
the F2 key) in the data column. Then, an editor widget is placed on
top of the item view.
The two methods are overridden:
createEditor - process only when the data column is being accessed
and the menu is visible. Otherwise, return nullptr to disallow editing.
setModelData - take the new data from the editor, and set it to the
addressed symbol. If it was successful, update all the list windows.
Otherwise, (the reason for the failure is possibly the input data was
out of range), set the old value back to the editor.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-29 11:14:12 +03:00
default :
2015-09-22 21:36:19 +03:00
break ;
}
2015-09-22 21:36:18 +03:00
}
void ConfigList : : setRootMenu ( struct menu * menu )
{
2015-09-22 21:36:19 +03:00
enum prop_type type ;
if ( rootEntry = = menu )
return ;
type = menu & & menu - > prompt ? menu - > prompt - > type : P_UNKNOWN ;
if ( type ! = P_MENU )
return ;
2020-08-07 12:19:01 +03:00
updateMenuList ( 0 ) ;
2015-09-22 21:36:19 +03:00
rootEntry = menu ;
updateListAll ( ) ;
if ( currentItem ( ) ) {
2020-06-30 09:26:38 +03:00
setSelected ( currentItem ( ) , hasFocus ( ) ) ;
2015-09-22 21:36:19 +03:00
scrollToItem ( currentItem ( ) ) ;
}
2015-09-22 21:36:18 +03:00
}
void ConfigList : : setParentMenu ( void )
{
2015-09-22 21:36:19 +03:00
ConfigItem * item ;
struct menu * oldroot ;
oldroot = rootEntry ;
if ( rootEntry = = & rootmenu )
return ;
setRootMenu ( menu_get_parent_menu ( rootEntry - > parent ) ) ;
QTreeWidgetItemIterator it ( this ) ;
while ( * it ) {
item = ( ConfigItem * ) ( * it ) ;
if ( item - > menu = = oldroot ) {
setCurrentItem ( item ) ;
scrollToItem ( item ) ;
break ;
}
+ + it ;
}
2015-09-22 21:36:18 +03:00
}
/*
* update all the children of a menu entry
* removes / adds the entries from the parent widget as necessary
*
* parent : either the menu list widget or a menu entry widget
* menu : entry to be updated
*/
2015-09-22 21:36:27 +03:00
void ConfigList : : updateMenuList ( ConfigItem * parent , struct menu * menu )
2015-09-22 21:36:18 +03:00
{
2015-09-22 21:36:19 +03:00
struct menu * child ;
ConfigItem * item ;
ConfigItem * last ;
bool visible ;
enum prop_type type ;
if ( ! menu ) {
2015-09-22 21:36:27 +03:00
while ( parent - > childCount ( ) > 0 )
{
delete parent - > takeChild ( 0 ) ;
}
2015-09-22 21:36:19 +03:00
return ;
}
last = parent - > firstChild ( ) ;
if ( last & & ! last - > goParent )
last = 0 ;
for ( child = menu - > list ; child ; child = child - > next ) {
item = last ? last - > nextSibling ( ) : parent - > firstChild ( ) ;
type = child - > prompt ? child - > prompt - > type : P_UNKNOWN ;
switch ( mode ) {
case menuMode :
if ( ! ( child - > flags & MENU_ROOT ) )
goto hide ;
break ;
case symbolMode :
if ( child - > flags & MENU_ROOT )
goto hide ;
break ;
default :
break ;
}
visible = menu_is_visible ( child ) ;
if ( ! menuSkip ( child ) ) {
if ( ! child - > sym & & ! child - > list & & ! child - > prompt )
continue ;
if ( ! item | | item - > menu ! = child )
item = new ConfigItem ( parent , last , child , visible ) ;
else
item - > testUpdateMenu ( visible ) ;
if ( mode = = fullMode | | mode = = menuMode | | type ! = P_MENU )
updateMenuList ( item , child ) ;
else
updateMenuList ( item , 0 ) ;
last = item ;
continue ;
}
2020-04-02 12:28:03 +03:00
hide :
2015-09-22 21:36:19 +03:00
if ( item & & item - > menu = = child ) {
last = parent - > firstChild ( ) ;
if ( last = = item )
last = 0 ;
else while ( last - > nextSibling ( ) ! = item )
last = last - > nextSibling ( ) ;
delete item ;
}
}
2015-09-22 21:36:18 +03:00
}
2020-08-07 12:19:01 +03:00
void ConfigList : : updateMenuList ( struct menu * menu )
2015-09-22 21:36:27 +03:00
{
struct menu * child ;
ConfigItem * item ;
ConfigItem * last ;
bool visible ;
enum prop_type type ;
if ( ! menu ) {
2020-08-07 12:19:01 +03:00
while ( topLevelItemCount ( ) > 0 )
2015-09-22 21:36:27 +03:00
{
2020-08-07 12:19:01 +03:00
delete takeTopLevelItem ( 0 ) ;
2015-09-22 21:36:27 +03:00
}
return ;
}
2020-08-07 12:19:01 +03:00
last = ( ConfigItem * ) topLevelItem ( 0 ) ;
2015-09-22 21:36:27 +03:00
if ( last & & ! last - > goParent )
last = 0 ;
for ( child = menu - > list ; child ; child = child - > next ) {
2020-08-07 12:19:01 +03:00
item = last ? last - > nextSibling ( ) : ( ConfigItem * ) topLevelItem ( 0 ) ;
2015-09-22 21:36:27 +03:00
type = child - > prompt ? child - > prompt - > type : P_UNKNOWN ;
switch ( mode ) {
case menuMode :
if ( ! ( child - > flags & MENU_ROOT ) )
goto hide ;
break ;
case symbolMode :
if ( child - > flags & MENU_ROOT )
goto hide ;
break ;
default :
break ;
}
visible = menu_is_visible ( child ) ;
if ( ! menuSkip ( child ) ) {
if ( ! child - > sym & & ! child - > list & & ! child - > prompt )
continue ;
if ( ! item | | item - > menu ! = child )
2020-08-07 12:19:01 +03:00
item = new ConfigItem ( this , last , child , visible ) ;
2015-09-22 21:36:27 +03:00
else
item - > testUpdateMenu ( visible ) ;
if ( mode = = fullMode | | mode = = menuMode | | type ! = P_MENU )
updateMenuList ( item , child ) ;
else
updateMenuList ( item , 0 ) ;
last = item ;
continue ;
}
2020-04-02 12:28:03 +03:00
hide :
2015-09-22 21:36:27 +03:00
if ( item & & item - > menu = = child ) {
2020-08-07 12:19:01 +03:00
last = ( ConfigItem * ) topLevelItem ( 0 ) ;
2015-09-22 21:36:27 +03:00
if ( last = = item )
last = 0 ;
else while ( last - > nextSibling ( ) ! = item )
last = last - > nextSibling ( ) ;
delete item ;
}
}
}
2015-09-22 21:36:18 +03:00
void ConfigList : : keyPressEvent ( QKeyEvent * ev )
{
2015-09-22 21:36:19 +03:00
QTreeWidgetItem * i = currentItem ( ) ;
ConfigItem * item ;
struct menu * menu ;
enum prop_type type ;
if ( ev - > key ( ) = = Qt : : Key_Escape & & mode ! = fullMode & & mode ! = listMode ) {
emit parentSelected ( ) ;
ev - > accept ( ) ;
return ;
}
if ( ! i ) {
Parent : : keyPressEvent ( ev ) ;
return ;
}
item = ( ConfigItem * ) i ;
switch ( ev - > key ( ) ) {
case Qt : : Key_Return :
case Qt : : Key_Enter :
if ( item - > goParent ) {
emit parentSelected ( ) ;
break ;
}
menu = item - > menu ;
if ( ! menu )
break ;
type = menu - > prompt ? menu - > prompt - > type : P_UNKNOWN ;
if ( type = = P_MENU & & rootEntry ! = menu & &
mode ! = fullMode & & mode ! = menuMode ) {
2020-04-02 12:28:01 +03:00
if ( mode = = menuMode )
emit menuSelected ( menu ) ;
else
emit itemSelected ( menu ) ;
2015-09-22 21:36:19 +03:00
break ;
}
case Qt : : Key_Space :
changeValue ( item ) ;
break ;
case Qt : : Key_N :
setValue ( item , no ) ;
break ;
case Qt : : Key_M :
setValue ( item , mod ) ;
break ;
case Qt : : Key_Y :
setValue ( item , yes ) ;
break ;
default :
Parent : : keyPressEvent ( ev ) ;
return ;
}
ev - > accept ( ) ;
2015-09-22 21:36:18 +03:00
}
2015-09-22 21:36:19 +03:00
void ConfigList : : mousePressEvent ( QMouseEvent * e )
2015-09-22 21:36:17 +03:00
{
2015-09-22 21:36:19 +03:00
//QPoint p(contentsToViewport(e->pos()));
//printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y());
Parent : : mousePressEvent ( e ) ;
2015-09-22 21:36:17 +03:00
}
2015-09-22 21:36:18 +03:00
2015-09-22 21:36:19 +03:00
void ConfigList : : mouseReleaseEvent ( QMouseEvent * e )
2015-09-22 21:36:18 +03:00
{
2015-09-22 21:36:19 +03:00
QPoint p = e - > pos ( ) ;
ConfigItem * item = ( ConfigItem * ) itemAt ( p ) ;
struct menu * menu ;
enum prop_type ptype ;
QIcon icon ;
int idx , x ;
if ( ! item )
goto skip ;
menu = item - > menu ;
x = header ( ) - > offset ( ) + p . x ( ) ;
2015-09-22 21:36:35 +03:00
idx = header ( ) - > logicalIndexAt ( x ) ;
2015-09-22 21:36:19 +03:00
switch ( idx ) {
case promptColIdx :
2020-08-07 12:19:03 +03:00
icon = item - > icon ( promptColIdx ) ;
2015-09-22 21:36:35 +03:00
if ( ! icon . isNull ( ) ) {
int off = header ( ) - > sectionPosition ( 0 ) + visualRect ( indexAt ( p ) ) . x ( ) + 4 ; // 4 is Hardcoded image offset. There might be a way to do it properly.
if ( x > = off & & x < off + icon . availableSizes ( ) . first ( ) . width ( ) ) {
if ( item - > goParent ) {
emit parentSelected ( ) ;
break ;
} else if ( ! menu )
break ;
ptype = menu - > prompt ? menu - > prompt - > type : P_UNKNOWN ;
if ( ptype = = P_MENU & & rootEntry ! = menu & &
2020-07-08 16:32:15 +03:00
mode ! = fullMode & & mode ! = menuMode & &
mode ! = listMode )
2015-09-22 21:36:35 +03:00
emit menuSelected ( menu ) ;
else
changeValue ( item ) ;
}
}
2015-09-22 21:36:19 +03:00
break ;
case dataColIdx :
changeValue ( item ) ;
break ;
}
skip :
//printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y());
Parent : : mouseReleaseEvent ( e ) ;
2015-09-22 21:36:18 +03:00
}
2015-09-22 21:36:19 +03:00
void ConfigList : : mouseMoveEvent ( QMouseEvent * e )
2015-09-22 21:36:18 +03:00
{
2015-09-22 21:36:19 +03:00
//QPoint p(contentsToViewport(e->pos()));
//printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y());
Parent : : mouseMoveEvent ( e ) ;
2015-09-22 21:36:18 +03:00
}
2015-09-22 21:36:19 +03:00
void ConfigList : : mouseDoubleClickEvent ( QMouseEvent * e )
2015-09-22 21:36:18 +03:00
{
2020-04-02 12:28:02 +03:00
QPoint p = e - > pos ( ) ;
2015-09-22 21:36:19 +03:00
ConfigItem * item = ( ConfigItem * ) itemAt ( p ) ;
struct menu * menu ;
enum prop_type ptype ;
if ( ! item )
goto skip ;
if ( item - > goParent ) {
emit parentSelected ( ) ;
goto skip ;
}
menu = item - > menu ;
if ( ! menu )
goto skip ;
ptype = menu - > prompt ? menu - > prompt - > type : P_UNKNOWN ;
2020-07-08 16:32:15 +03:00
if ( ptype = = P_MENU & & mode ! = listMode ) {
2020-04-02 12:28:01 +03:00
if ( mode = = singleMode )
emit itemSelected ( menu ) ;
else if ( mode = = symbolMode )
emit menuSelected ( menu ) ;
} else if ( menu - > sym )
2015-09-22 21:36:19 +03:00
changeValue ( item ) ;
skip :
//printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y());
Parent : : mouseDoubleClickEvent ( e ) ;
2015-09-22 21:36:18 +03:00
}
void ConfigList : : focusInEvent ( QFocusEvent * e )
{
2015-09-22 21:36:19 +03:00
struct menu * menu = NULL ;
Parent : : focusInEvent ( e ) ;
ConfigItem * item = ( ConfigItem * ) currentItem ( ) ;
if ( item ) {
2020-06-30 09:26:38 +03:00
setSelected ( item , true ) ;
2015-09-22 21:36:19 +03:00
menu = item - > menu ;
}
emit gotFocus ( menu ) ;
2015-09-22 21:36:18 +03:00
}
void ConfigList : : contextMenuEvent ( QContextMenuEvent * e )
{
2020-08-07 12:19:08 +03:00
if ( ! headerPopup ) {
QAction * action ;
headerPopup = new QMenu ( this ) ;
action = new QAction ( " Show Name " , this ) ;
action - > setCheckable ( true ) ;
2020-10-24 15:38:41 +03:00
connect ( action , & QAction : : toggled ,
this , & ConfigList : : setShowName ) ;
connect ( this , & ConfigList : : showNameChanged ,
action , & QAction : : setChecked ) ;
2020-08-07 12:19:08 +03:00
action - > setChecked ( showName ) ;
headerPopup - > addAction ( action ) ;
}
headerPopup - > exec ( e - > globalPos ( ) ) ;
e - > accept ( ) ;
2015-09-22 21:36:18 +03:00
}
2020-08-29 11:14:14 +03:00
void ConfigList : : setShowName ( bool on )
{
if ( showName = = on )
return ;
showName = on ;
reinit ( ) ;
emit showNameChanged ( on ) ;
}
2020-08-29 11:14:10 +03:00
QList < ConfigList * > ConfigList : : allLists ;
2020-08-07 12:19:09 +03:00
QAction * ConfigList : : showNormalAction ;
QAction * ConfigList : : showAllAction ;
QAction * ConfigList : : showPromptAction ;
2005-04-17 02:20:36 +04:00
2015-09-22 21:36:19 +03:00
void ConfigList : : setAllOpen ( bool open )
{
QTreeWidgetItemIterator it ( this ) ;
while ( * it ) {
( * it ) - > setExpanded ( open ) ;
+ + it ;
}
2006-06-09 09:12:46 +04:00
}
2006-06-09 09:12:45 +04:00
ConfigInfoView : : ConfigInfoView ( QWidget * parent , const char * name )
2015-09-22 21:36:15 +03:00
: Parent ( parent ) , sym ( 0 ) , _menu ( 0 )
2006-06-09 09:12:45 +04:00
{
2015-09-22 21:36:19 +03:00
setObjectName ( name ) ;
2020-06-30 09:26:37 +03:00
setOpenLinks ( false ) ;
2015-09-22 21:36:19 +03:00
if ( ! objectName ( ) . isEmpty ( ) ) {
configSettings - > beginGroup ( objectName ( ) ) ;
2016-12-01 01:57:52 +03:00
setShowDebug ( configSettings - > value ( " /showDebug " , false ) . toBool ( ) ) ;
2006-06-09 09:12:46 +04:00
configSettings - > endGroup ( ) ;
2020-10-24 15:38:41 +03:00
connect ( configApp , & QApplication : : aboutToQuit ,
this , & ConfigInfoView : : saveSettings ) ;
2006-06-09 09:12:46 +04:00
}
2020-08-17 19:36:30 +03:00
contextMenu = createStandardContextMenu ( ) ;
QAction * action = new QAction ( " Show Debug Info " , contextMenu ) ;
action - > setCheckable ( true ) ;
2020-10-24 15:38:41 +03:00
connect ( action , & QAction : : toggled ,
this , & ConfigInfoView : : setShowDebug ) ;
connect ( this , & ConfigInfoView : : showDebugChanged ,
action , & QAction : : setChecked ) ;
2020-08-17 19:36:30 +03:00
action - > setChecked ( showDebug ( ) ) ;
contextMenu - > addSeparator ( ) ;
contextMenu - > addAction ( action ) ;
2006-06-09 09:12:46 +04:00
}
void ConfigInfoView : : saveSettings ( void )
{
2015-09-22 21:36:19 +03:00
if ( ! objectName ( ) . isEmpty ( ) ) {
configSettings - > beginGroup ( objectName ( ) ) ;
configSettings - > setValue ( " /showDebug " , showDebug ( ) ) ;
configSettings - > endGroup ( ) ;
}
2006-06-09 09:12:45 +04:00
}
void ConfigInfoView : : setShowDebug ( bool b )
{
if ( _showDebug ! = b ) {
_showDebug = b ;
2010-08-31 19:34:37 +04:00
if ( _menu )
2006-06-09 09:12:45 +04:00
menuInfo ( ) ;
2006-06-09 09:12:47 +04:00
else if ( sym )
symbolInfo ( ) ;
2006-06-09 09:12:45 +04:00
emit showDebugChanged ( b ) ;
}
}
void ConfigInfoView : : setInfo ( struct menu * m )
{
2010-08-31 19:34:37 +04:00
if ( _menu = = m )
2006-06-09 09:12:47 +04:00
return ;
2010-08-31 19:34:37 +04:00
_menu = m ;
2007-01-11 10:15:31 +03:00
sym = NULL ;
2010-08-31 19:34:37 +04:00
if ( ! _menu )
2006-06-09 09:12:45 +04:00
clear ( ) ;
2007-01-11 10:15:31 +03:00
else
2006-06-09 09:12:45 +04:00
menuInfo ( ) ;
}
2006-06-09 09:12:47 +04:00
void ConfigInfoView : : symbolInfo ( void )
{
QString str ;
str + = " <big>Symbol: <b> " ;
str + = print_filter ( sym - > name ) ;
str + = " </b></big><br><br>value: " ;
str + = print_filter ( sym_get_string_value ( sym ) ) ;
str + = " <br>visibility: " ;
str + = sym - > visible = = yes ? " y " : sym - > visible = = mod ? " m " : " n " ;
str + = " <br> " ;
str + = debug_info ( sym ) ;
setText ( str ) ;
}
2006-06-09 09:12:45 +04:00
void ConfigInfoView : : menuInfo ( void )
{
struct symbol * sym ;
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
QString info ;
QTextStream stream ( & info ) ;
2006-06-09 09:12:45 +04:00
2010-08-31 19:34:37 +04:00
sym = _menu - > sym ;
2006-06-09 09:12:45 +04:00
if ( sym ) {
2010-08-31 19:34:37 +04:00
if ( _menu - > prompt ) {
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " <big><b> " ;
stream < < print_filter ( _menu - > prompt - > text ) ;
stream < < " </b></big> " ;
2006-06-09 09:12:45 +04:00
if ( sym - > name ) {
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " ( " ;
2006-06-09 09:12:47 +04:00
if ( showDebug ( ) )
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " <a href= \" s " < < sym - > name < < " \" > " ;
stream < < print_filter ( sym - > name ) ;
2006-06-09 09:12:47 +04:00
if ( showDebug ( ) )
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " </a> " ;
stream < < " ) " ;
2006-06-09 09:12:45 +04:00
}
} else if ( sym - > name ) {
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " <big><b> " ;
2006-06-09 09:12:47 +04:00
if ( showDebug ( ) )
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " <a href= \" s " < < sym - > name < < " \" > " ;
stream < < print_filter ( sym - > name ) ;
2006-06-09 09:12:47 +04:00
if ( showDebug ( ) )
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " </a> " ;
stream < < " </b></big> " ;
2006-06-09 09:12:45 +04:00
}
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " <br><br> " ;
2006-06-09 09:12:45 +04:00
if ( showDebug ( ) )
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < debug_info ( sym ) ;
2020-09-14 17:59:48 +03:00
struct gstr help_gstr = str_new ( ) ;
menu_get_ext_help ( _menu , & help_gstr ) ;
stream < < print_filter ( str_get ( & help_gstr ) ) ;
str_free ( & help_gstr ) ;
2010-08-31 19:34:37 +04:00
} else if ( _menu - > prompt ) {
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " <big><b> " ;
stream < < print_filter ( _menu - > prompt - > text ) ;
stream < < " </b></big><br><br> " ;
2006-06-09 09:12:45 +04:00
if ( showDebug ( ) ) {
2010-08-31 19:34:37 +04:00
if ( _menu - > prompt - > visible . expr ) {
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " dep: " ;
expr_print ( _menu - > prompt - > visible . expr ,
expr_print_help , & stream , E_NONE ) ;
stream < < " <br><br> " ;
2006-06-09 09:12:45 +04:00
}
2020-09-14 17:59:48 +03:00
stream < < " defined at " < < _menu - > file - > name < < " : "
< < _menu - > lineno < < " <br><br> " ;
2006-06-09 09:12:45 +04:00
}
}
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
setText ( info ) ;
2006-06-09 09:12:45 +04:00
}
QString ConfigInfoView : : debug_info ( struct symbol * sym )
{
QString debug ;
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
QTextStream stream ( & debug ) ;
2006-06-09 09:12:45 +04:00
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " type: " ;
stream < < print_filter ( sym_type_name ( sym - > type ) ) ;
2006-06-09 09:12:45 +04:00
if ( sym_is_choice ( sym ) )
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " (choice) " ;
2006-06-09 09:12:45 +04:00
debug + = " <br> " ;
if ( sym - > rev_dep . expr ) {
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " reverse dep: " ;
expr_print ( sym - > rev_dep . expr , expr_print_help , & stream , E_NONE ) ;
stream < < " <br> " ;
2006-06-09 09:12:45 +04:00
}
for ( struct property * prop = sym - > prop ; prop ; prop = prop - > next ) {
switch ( prop - > type ) {
case P_PROMPT :
case P_MENU :
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " prompt: <a href= \" m " < < sym - > name < < " \" > " ;
stream < < print_filter ( prop - > text ) ;
stream < < " </a><br> " ;
2006-06-09 09:12:45 +04:00
break ;
case P_DEFAULT :
2008-01-14 06:50:54 +03:00
case P_SELECT :
case P_RANGE :
2020-06-30 09:48:53 +03:00
case P_COMMENT :
case P_IMPLY :
case P_SYMBOL :
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < prop_get_type_name ( prop - > type ) ;
stream < < " : " ;
expr_print ( prop - > expr , expr_print_help ,
& stream , E_NONE ) ;
stream < < " <br> " ;
2006-06-09 09:12:45 +04:00
break ;
case P_CHOICE :
if ( sym_is_choice ( sym ) ) {
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " choice: " ;
expr_print ( prop - > expr , expr_print_help ,
& stream , E_NONE ) ;
stream < < " <br> " ;
2006-06-09 09:12:45 +04:00
}
break ;
default :
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " unknown property: " ;
stream < < prop_get_type_name ( prop - > type ) ;
stream < < " <br> " ;
2006-06-09 09:12:45 +04:00
}
if ( prop - > visible . expr ) {
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " dep: " ;
expr_print ( prop - > visible . expr , expr_print_help ,
& stream , E_NONE ) ;
stream < < " <br> " ;
2006-06-09 09:12:45 +04:00
}
}
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
stream < < " <br> " ;
2006-06-09 09:12:45 +04:00
return debug ;
}
QString ConfigInfoView : : print_filter ( const QString & str )
{
2023-08-09 14:42:31 +03:00
QRegularExpression re ( " [<>& \" \\ n] " ) ;
2006-06-09 09:12:45 +04:00
QString res = str ;
2015-09-22 21:36:15 +03:00
for ( int i = 0 ; ( i = res . indexOf ( re , i ) ) > = 0 ; ) {
switch ( res [ i ] . toLatin1 ( ) ) {
2006-06-09 09:12:45 +04:00
case ' < ' :
res . replace ( i , 1 , " < " ) ;
i + = 4 ;
break ;
case ' > ' :
res . replace ( i , 1 , " > " ) ;
i + = 4 ;
break ;
case ' & ' :
res . replace ( i , 1 , " & " ) ;
i + = 5 ;
break ;
case ' " ' :
res . replace ( i , 1 , " " " ) ;
i + = 6 ;
break ;
case ' \n ' :
res . replace ( i , 1 , " <br> " ) ;
i + = 4 ;
break ;
}
}
return res ;
}
2006-06-09 09:12:47 +04:00
void ConfigInfoView : : expr_print_help ( void * data , struct symbol * sym , const char * str )
2006-06-09 09:12:45 +04:00
{
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
QTextStream * stream = reinterpret_cast < QTextStream * > ( data ) ;
2006-06-09 09:12:47 +04:00
if ( sym & & sym - > name & & ! ( sym - > flags & SYMBOL_CONST ) ) {
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-20 20:43:28 +03:00
* stream < < " <a href= \" s " < < sym - > name < < " \" > " ;
* stream < < print_filter ( str ) ;
* stream < < " </a> " ;
} else {
* stream < < print_filter ( str ) ;
}
2006-06-09 09:12:45 +04:00
}
2020-06-30 09:26:37 +03:00
void ConfigInfoView : : clicked ( const QUrl & url )
{
QByteArray str = url . toEncoded ( ) ;
const std : : size_t count = str . size ( ) ;
char * data = new char [ count + 1 ] ;
struct symbol * * result ;
struct menu * m = NULL ;
if ( count < 1 ) {
2020-07-29 20:02:39 +03:00
delete [ ] data ;
2020-06-30 09:26:37 +03:00
return ;
}
memcpy ( data , str . constData ( ) , count ) ;
data [ count ] = ' \0 ' ;
/* Seek for exact match */
data [ 0 ] = ' ^ ' ;
strcat ( data , " $ " ) ;
result = sym_re_search ( data ) ;
if ( ! result ) {
2020-07-29 20:02:39 +03:00
delete [ ] data ;
2020-06-30 09:26:37 +03:00
return ;
}
sym = * result ;
2020-06-30 09:48:35 +03:00
/* Seek for the menu which holds the symbol */
2020-06-30 09:26:37 +03:00
for ( struct property * prop = sym - > prop ; prop ; prop = prop - > next ) {
if ( prop - > type ! = P_PROMPT & & prop - > type ! = P_MENU )
continue ;
m = prop - > menu ;
break ;
}
if ( ! m ) {
2020-06-30 09:48:35 +03:00
/* Symbol is not visible as a menu */
symbolInfo ( ) ;
emit showDebugChanged ( true ) ;
} else {
emit menuSelected ( m ) ;
2020-06-30 09:26:37 +03:00
}
free ( result ) ;
2020-09-09 01:16:37 +03:00
delete [ ] data ;
2020-06-30 09:26:37 +03:00
}
2020-08-17 19:36:30 +03:00
void ConfigInfoView : : contextMenuEvent ( QContextMenuEvent * event )
2006-06-09 09:12:46 +04:00
{
2020-08-17 19:36:30 +03:00
contextMenu - > popup ( event - > globalPos ( ) ) ;
event - > accept ( ) ;
2006-06-09 09:12:46 +04:00
}
2020-08-07 12:18:57 +03:00
ConfigSearchWindow : : ConfigSearchWindow ( ConfigMainWindow * parent )
2015-09-22 21:36:15 +03:00
: Parent ( parent ) , result ( NULL )
2006-06-09 09:12:45 +04:00
{
2020-08-07 12:18:57 +03:00
setObjectName ( " search " ) ;
2015-09-22 21:36:15 +03:00
setWindowTitle ( " Search Config " ) ;
2006-06-09 09:12:45 +04:00
2015-09-22 21:36:15 +03:00
QVBoxLayout * layout1 = new QVBoxLayout ( this ) ;
layout1 - > setContentsMargins ( 11 , 11 , 11 , 11 ) ;
layout1 - > setSpacing ( 6 ) ;
2020-08-07 12:18:58 +03:00
QHBoxLayout * layout2 = new QHBoxLayout ( ) ;
2015-09-22 21:36:15 +03:00
layout2 - > setContentsMargins ( 0 , 0 , 0 , 0 ) ;
layout2 - > setSpacing ( 6 ) ;
2018-05-22 22:36:12 +03:00
layout2 - > addWidget ( new QLabel ( " Find: " , this ) ) ;
2006-06-09 09:12:45 +04:00
editField = new QLineEdit ( this ) ;
2020-10-24 15:38:41 +03:00
connect ( editField , & QLineEdit : : returnPressed ,
this , & ConfigSearchWindow : : search ) ;
2006-06-09 09:12:45 +04:00
layout2 - > addWidget ( editField ) ;
2018-05-22 22:36:12 +03:00
searchButton = new QPushButton ( " Search " , this ) ;
2015-09-22 21:36:15 +03:00
searchButton - > setAutoDefault ( false ) ;
2020-10-24 15:38:41 +03:00
connect ( searchButton , & QPushButton : : clicked ,
this , & ConfigSearchWindow : : search ) ;
2006-06-09 09:12:45 +04:00
layout2 - > addWidget ( searchButton ) ;
layout1 - > addLayout ( layout2 ) ;
2006-06-09 09:12:46 +04:00
split = new QSplitter ( this ) ;
2009-05-18 03:36:50 +04:00
split - > setOrientation ( Qt : : Vertical ) ;
2020-08-29 11:14:15 +03:00
list = new ConfigList ( split , " search " ) ;
list - > mode = listMode ;
2020-08-07 12:18:57 +03:00
info = new ConfigInfoView ( split , " search " ) ;
2020-10-24 15:38:41 +03:00
connect ( list , & ConfigList : : menuChanged ,
info , & ConfigInfoView : : setInfo ) ;
connect ( list , & ConfigList : : menuChanged ,
parent , & ConfigMainWindow : : setMenuLink ) ;
2006-10-05 21:12:59 +04:00
2006-06-09 09:12:45 +04:00
layout1 - > addWidget ( split ) ;
2006-06-09 09:12:46 +04:00
2020-08-07 12:18:57 +03:00
QVariant x , y ;
int width , height ;
bool ok ;
2006-06-09 09:12:46 +04:00
2020-08-07 12:18:57 +03:00
configSettings - > beginGroup ( " search " ) ;
width = configSettings - > value ( " /window width " , parent - > width ( ) / 2 ) . toInt ( ) ;
height = configSettings - > value ( " /window height " , parent - > height ( ) / 2 ) . toInt ( ) ;
resize ( width , height ) ;
x = configSettings - > value ( " /window x " ) ;
y = configSettings - > value ( " /window y " ) ;
if ( x . isValid ( ) & & y . isValid ( ) )
move ( x . toInt ( ) , y . toInt ( ) ) ;
QList < int > sizes = configSettings - > readSizes ( " /split " , & ok ) ;
if ( ok )
split - > setSizes ( sizes ) ;
configSettings - > endGroup ( ) ;
2020-10-24 15:38:41 +03:00
connect ( configApp , & QApplication : : aboutToQuit ,
this , & ConfigSearchWindow : : saveSettings ) ;
2006-06-09 09:12:46 +04:00
}
void ConfigSearchWindow : : saveSettings ( void )
{
2015-09-22 21:36:19 +03:00
if ( ! objectName ( ) . isEmpty ( ) ) {
configSettings - > beginGroup ( objectName ( ) ) ;
configSettings - > setValue ( " /window x " , pos ( ) . x ( ) ) ;
configSettings - > setValue ( " /window y " , pos ( ) . y ( ) ) ;
configSettings - > setValue ( " /window width " , size ( ) . width ( ) ) ;
configSettings - > setValue ( " /window height " , size ( ) . height ( ) ) ;
configSettings - > writeSizes ( " /split " , split - > sizes ( ) ) ;
configSettings - > endGroup ( ) ;
}
2006-06-09 09:12:45 +04:00
}
void ConfigSearchWindow : : search ( void )
{
2015-09-22 21:36:19 +03:00
struct symbol * * p ;
struct property * prop ;
ConfigItem * lastItem = NULL ;
free ( result ) ;
2020-08-29 11:14:15 +03:00
list - > clear ( ) ;
2015-09-22 21:36:19 +03:00
info - > clear ( ) ;
result = sym_re_search ( editField - > text ( ) . toLatin1 ( ) ) ;
if ( ! result )
return ;
for ( p = result ; * p ; p + + ) {
for_all_prompts ( ( * p ) , prop )
2020-08-29 11:14:15 +03:00
lastItem = new ConfigItem ( list , lastItem , prop - > menu ,
2015-09-22 21:36:19 +03:00
menu_is_visible ( prop - > menu ) ) ;
}
2006-06-09 09:12:45 +04:00
}
2005-04-17 02:20:36 +04:00
/*
* Construct the complete config widget
*/
ConfigMainWindow : : ConfigMainWindow ( void )
2006-11-25 22:09:31 +03:00
: searchWindow ( 0 )
2005-04-17 02:20:36 +04:00
{
2015-09-22 21:36:16 +03:00
bool ok = true ;
2015-09-22 21:36:15 +03:00
QVariant x , y ;
int width , height ;
2007-10-20 22:18:47 +04:00
char title [ 256 ] ;
2005-04-17 02:20:36 +04:00
2010-08-18 09:57:13 +04:00
snprintf ( title , sizeof ( title ) , " %s%s " ,
rootmenu . prompt - > text ,
2010-09-01 19:39:27 +04:00
" "
) ;
2015-09-22 21:36:15 +03:00
setWindowTitle ( title ) ;
2005-04-17 02:20:36 +04:00
2023-08-09 14:42:31 +03:00
QRect g = configApp - > primaryScreen ( ) - > geometry ( ) ;
width = configSettings - > value ( " /window width " , g . width ( ) - 64 ) . toInt ( ) ;
height = configSettings - > value ( " /window height " , g . height ( ) - 64 ) . toInt ( ) ;
2005-04-17 02:20:36 +04:00
resize ( width , height ) ;
2015-09-22 21:36:15 +03:00
x = configSettings - > value ( " /window x " ) ;
y = configSettings - > value ( " /window y " ) ;
if ( ( x . isValid ( ) ) & & ( y . isValid ( ) ) )
move ( x . toInt ( ) , y . toInt ( ) ) ;
2005-04-17 02:20:36 +04:00
2020-08-07 12:19:07 +03:00
// set up icons
ConfigItem : : symbolYesIcon = QIcon ( QPixmap ( xpm_symbol_yes ) ) ;
ConfigItem : : symbolModIcon = QIcon ( QPixmap ( xpm_symbol_mod ) ) ;
ConfigItem : : symbolNoIcon = QIcon ( QPixmap ( xpm_symbol_no ) ) ;
ConfigItem : : choiceYesIcon = QIcon ( QPixmap ( xpm_choice_yes ) ) ;
ConfigItem : : choiceNoIcon = QIcon ( QPixmap ( xpm_choice_no ) ) ;
ConfigItem : : menuIcon = QIcon ( QPixmap ( xpm_menu ) ) ;
ConfigItem : : menubackIcon = QIcon ( QPixmap ( xpm_menuback ) ) ;
2020-04-02 12:28:00 +03:00
QWidget * widget = new QWidget ( this ) ;
QVBoxLayout * layout = new QVBoxLayout ( widget ) ;
setCentralWidget ( widget ) ;
split1 = new QSplitter ( widget ) ;
2009-05-18 03:36:50 +04:00
split1 - > setOrientation ( Qt : : Horizontal ) ;
2020-04-02 12:28:00 +03:00
split1 - > setChildrenCollapsible ( false ) ;
2005-04-17 02:20:36 +04:00
2020-08-29 11:14:15 +03:00
menuList = new ConfigList ( widget , " menu " ) ;
2005-04-17 02:20:36 +04:00
2020-04-02 12:28:00 +03:00
split2 = new QSplitter ( widget ) ;
split2 - > setChildrenCollapsible ( false ) ;
2009-05-18 03:36:50 +04:00
split2 - > setOrientation ( Qt : : Vertical ) ;
2005-04-17 02:20:36 +04:00
// create config tree
2020-08-29 11:14:15 +03:00
configList = new ConfigList ( widget , " config " ) ;
2005-04-17 02:20:36 +04:00
2020-04-02 12:28:00 +03:00
helpText = new ConfigInfoView ( widget , " help " ) ;
layout - > addWidget ( split2 ) ;
split2 - > addWidget ( split1 ) ;
2020-08-29 11:14:15 +03:00
split1 - > addWidget ( configList ) ;
split1 - > addWidget ( menuList ) ;
2020-04-02 12:28:00 +03:00
split2 - > addWidget ( helpText ) ;
2005-04-17 02:20:36 +04:00
setTabOrder ( configList , helpText ) ;
configList - > setFocus ( ) ;
2018-05-22 22:36:12 +03:00
backAction = new QAction ( QPixmap ( xpm_back ) , " Back " , this ) ;
2020-10-24 15:38:41 +03:00
connect ( backAction , & QAction : : triggered ,
this , & ConfigMainWindow : : goBack ) ;
2020-06-30 09:26:39 +03:00
2018-05-22 22:36:12 +03:00
QAction * quitAction = new QAction ( " &Quit " , this ) ;
2023-08-09 14:42:31 +03:00
quitAction - > setShortcut ( Qt : : CTRL | Qt : : Key_Q ) ;
2020-10-24 15:38:41 +03:00
connect ( quitAction , & QAction : : triggered ,
this , & ConfigMainWindow : : close ) ;
2020-06-30 09:26:39 +03:00
2018-05-22 22:36:12 +03:00
QAction * loadAction = new QAction ( QPixmap ( xpm_load ) , " &Load " , this ) ;
2023-08-09 14:42:31 +03:00
loadAction - > setShortcut ( Qt : : CTRL | Qt : : Key_L ) ;
2020-10-24 15:38:41 +03:00
connect ( loadAction , & QAction : : triggered ,
this , & ConfigMainWindow : : loadConfig ) ;
2020-06-30 09:26:39 +03:00
2018-05-22 22:36:12 +03:00
saveAction = new QAction ( QPixmap ( xpm_save ) , " &Save " , this ) ;
2023-08-09 14:42:31 +03:00
saveAction - > setShortcut ( Qt : : CTRL | Qt : : Key_S ) ;
2020-10-24 15:38:41 +03:00
connect ( saveAction , & QAction : : triggered ,
this , & ConfigMainWindow : : saveConfig ) ;
2020-06-30 09:26:39 +03:00
2006-12-13 11:34:08 +03:00
conf_set_changed_callback ( conf_changed ) ;
2020-06-30 09:26:39 +03:00
2006-12-13 11:34:08 +03:00
// Set saveAction's initial state
conf_changed ( ) ;
2019-03-10 19:13:15 +03:00
configname = xstrdup ( conf_get_configname ( ) ) ;
2018-05-22 22:36:12 +03:00
QAction * saveAsAction = new QAction ( " Save &As... " , this ) ;
2020-10-24 15:38:41 +03:00
connect ( saveAsAction , & QAction : : triggered ,
this , & ConfigMainWindow : : saveConfigAs ) ;
2018-05-22 22:36:12 +03:00
QAction * searchAction = new QAction ( " &Find " , this ) ;
2023-08-09 14:42:31 +03:00
searchAction - > setShortcut ( Qt : : CTRL | Qt : : Key_F ) ;
2020-10-24 15:38:41 +03:00
connect ( searchAction , & QAction : : triggered ,
this , & ConfigMainWindow : : searchConfig ) ;
2018-05-22 22:36:12 +03:00
singleViewAction = new QAction ( QPixmap ( xpm_single_view ) , " Single View " , this ) ;
2015-09-22 21:36:15 +03:00
singleViewAction - > setCheckable ( true ) ;
2020-10-24 15:38:41 +03:00
connect ( singleViewAction , & QAction : : triggered ,
this , & ConfigMainWindow : : showSingleView ) ;
2018-05-22 22:36:12 +03:00
splitViewAction = new QAction ( QPixmap ( xpm_split_view ) , " Split View " , this ) ;
2015-09-22 21:36:15 +03:00
splitViewAction - > setCheckable ( true ) ;
2020-10-24 15:38:41 +03:00
connect ( splitViewAction , & QAction : : triggered ,
this , & ConfigMainWindow : : showSplitView ) ;
2018-05-22 22:36:12 +03:00
fullViewAction = new QAction ( QPixmap ( xpm_tree_view ) , " Full View " , this ) ;
2015-09-22 21:36:15 +03:00
fullViewAction - > setCheckable ( true ) ;
2020-10-24 15:38:41 +03:00
connect ( fullViewAction , & QAction : : triggered ,
this , & ConfigMainWindow : : showFullView ) ;
2005-04-17 02:20:36 +04:00
2018-05-22 22:36:12 +03:00
QAction * showNameAction = new QAction ( " Show Name " , this ) ;
2015-09-22 21:36:15 +03:00
showNameAction - > setCheckable ( true ) ;
2020-10-24 15:38:41 +03:00
connect ( showNameAction , & QAction : : toggled ,
configList , & ConfigList : : setShowName ) ;
2020-08-29 11:14:14 +03:00
showNameAction - > setChecked ( configList - > showName ) ;
2010-05-10 12:33:41 +04:00
QActionGroup * optGroup = new QActionGroup ( this ) ;
2015-09-22 21:36:15 +03:00
optGroup - > setExclusive ( true ) ;
2020-10-24 15:38:41 +03:00
connect ( optGroup , & QActionGroup : : triggered ,
configList , & ConfigList : : setOptionMode ) ;
connect ( optGroup , & QActionGroup : : triggered ,
menuList , & ConfigList : : setOptionMode ) ;
2010-05-10 12:33:41 +04:00
2020-08-07 12:19:09 +03:00
ConfigList : : showNormalAction = new QAction ( " Show Normal Options " , optGroup ) ;
ConfigList : : showNormalAction - > setCheckable ( true ) ;
ConfigList : : showAllAction = new QAction ( " Show All Options " , optGroup ) ;
ConfigList : : showAllAction - > setCheckable ( true ) ;
ConfigList : : showPromptAction = new QAction ( " Show Prompt Options " , optGroup ) ;
ConfigList : : showPromptAction - > setCheckable ( true ) ;
2010-05-10 12:33:41 +04:00
2018-05-22 22:36:12 +03:00
QAction * showDebugAction = new QAction ( " Show Debug Info " , this ) ;
2015-09-22 21:36:15 +03:00
showDebugAction - > setCheckable ( true ) ;
2020-10-24 15:38:41 +03:00
connect ( showDebugAction , & QAction : : toggled ,
helpText , & ConfigInfoView : : setShowDebug ) ;
2015-09-22 21:36:12 +03:00
showDebugAction - > setChecked ( helpText - > showDebug ( ) ) ;
2005-04-17 02:20:36 +04:00
2018-05-22 22:36:12 +03:00
QAction * showIntroAction = new QAction ( " Introduction " , this ) ;
2020-10-24 15:38:41 +03:00
connect ( showIntroAction , & QAction : : triggered ,
this , & ConfigMainWindow : : showIntro ) ;
2018-05-22 22:36:12 +03:00
QAction * showAboutAction = new QAction ( " About " , this ) ;
2020-10-24 15:38:41 +03:00
connect ( showAboutAction , & QAction : : triggered ,
this , & ConfigMainWindow : : showAbout ) ;
2005-04-17 02:20:36 +04:00
// init tool bar
2020-08-07 12:18:55 +03:00
QToolBar * toolBar = addToolBar ( " Tools " ) ;
2015-09-22 21:36:15 +03:00
toolBar - > addAction ( backAction ) ;
2005-04-17 02:20:36 +04:00
toolBar - > addSeparator ( ) ;
2015-09-22 21:36:15 +03:00
toolBar - > addAction ( loadAction ) ;
toolBar - > addAction ( saveAction ) ;
2005-04-17 02:20:36 +04:00
toolBar - > addSeparator ( ) ;
2015-09-22 21:36:15 +03:00
toolBar - > addAction ( singleViewAction ) ;
toolBar - > addAction ( splitViewAction ) ;
toolBar - > addAction ( fullViewAction ) ;
2005-04-17 02:20:36 +04:00
2020-08-07 12:18:53 +03:00
// create file menu
QMenu * menu = menuBar ( ) - > addMenu ( " &File " ) ;
menu - > addAction ( loadAction ) ;
menu - > addAction ( saveAction ) ;
menu - > addAction ( saveAsAction ) ;
menu - > addSeparator ( ) ;
menu - > addAction ( quitAction ) ;
2005-04-17 02:20:36 +04:00
2007-02-14 11:32:58 +03:00
// create edit menu
2020-08-07 12:18:53 +03:00
menu = menuBar ( ) - > addMenu ( " &Edit " ) ;
menu - > addAction ( searchAction ) ;
2007-02-14 11:32:58 +03:00
2005-04-17 02:20:36 +04:00
// create options menu
2020-08-07 12:18:53 +03:00
menu = menuBar ( ) - > addMenu ( " &Option " ) ;
menu - > addAction ( showNameAction ) ;
menu - > addSeparator ( ) ;
menu - > addActions ( optGroup - > actions ( ) ) ;
menu - > addSeparator ( ) ;
menu - > addAction ( showDebugAction ) ;
2005-04-17 02:20:36 +04:00
// create help menu
2020-08-07 12:18:53 +03:00
menu = menuBar ( ) - > addMenu ( " &Help " ) ;
menu - > addAction ( showIntroAction ) ;
menu - > addAction ( showAboutAction ) ;
2005-04-17 02:20:36 +04:00
2020-10-24 15:38:41 +03:00
connect ( helpText , & ConfigInfoView : : anchorClicked ,
helpText , & ConfigInfoView : : clicked ) ;
connect ( configList , & ConfigList : : menuChanged ,
helpText , & ConfigInfoView : : setInfo ) ;
connect ( configList , & ConfigList : : menuSelected ,
this , & ConfigMainWindow : : changeMenu ) ;
connect ( configList , & ConfigList : : itemSelected ,
this , & ConfigMainWindow : : changeItens ) ;
connect ( configList , & ConfigList : : parentSelected ,
this , & ConfigMainWindow : : goBack ) ;
connect ( menuList , & ConfigList : : menuChanged ,
helpText , & ConfigInfoView : : setInfo ) ;
connect ( menuList , & ConfigList : : menuSelected ,
this , & ConfigMainWindow : : changeMenu ) ;
connect ( configList , & ConfigList : : gotFocus ,
helpText , & ConfigInfoView : : setInfo ) ;
connect ( menuList , & ConfigList : : gotFocus ,
helpText , & ConfigInfoView : : setInfo ) ;
connect ( menuList , & ConfigList : : gotFocus ,
this , & ConfigMainWindow : : listFocusChanged ) ;
connect ( helpText , & ConfigInfoView : : menuSelected ,
this , & ConfigMainWindow : : setMenuLink ) ;
2005-04-17 02:20:36 +04:00
2015-09-22 21:36:15 +03:00
QString listMode = configSettings - > value ( " /listMode " , " symbol " ) . toString ( ) ;
2005-04-17 02:20:36 +04:00
if ( listMode = = " single " )
showSingleView ( ) ;
else if ( listMode = = " full " )
showFullView ( ) ;
else /*if (listMode == "split")*/
showSplitView ( ) ;
// UI setup done, restore splitter positions
2015-09-22 21:36:05 +03:00
QList < int > sizes = configSettings - > readSizes ( " /split1 " , & ok ) ;
2005-04-17 02:20:36 +04:00
if ( ok )
split1 - > setSizes ( sizes ) ;
2006-06-09 09:12:46 +04:00
sizes = configSettings - > readSizes ( " /split2 " , & ok ) ;
2005-04-17 02:20:36 +04:00
if ( ok )
split2 - > setSizes ( sizes ) ;
}
void ConfigMainWindow : : loadConfig ( void )
{
2019-03-10 19:13:15 +03:00
QString str ;
QByteArray ba ;
const char * name ;
str = QFileDialog : : getOpenFileName ( this , " " , configname ) ;
if ( str . isNull ( ) )
2005-04-17 02:20:36 +04:00
return ;
2019-03-10 19:13:15 +03:00
ba = str . toLocal8Bit ( ) ;
name = ba . data ( ) ;
if ( conf_read ( name ) )
2018-05-22 22:36:12 +03:00
QMessageBox : : information ( this , " qconf " , " Unable to load configuration! " ) ;
2019-03-10 19:13:15 +03:00
free ( configname ) ;
configname = xstrdup ( name ) ;
2020-08-29 11:14:10 +03:00
ConfigList : : updateListAllForAll ( ) ;
2005-04-17 02:20:36 +04:00
}
2011-05-25 17:10:25 +04:00
bool ConfigMainWindow : : saveConfig ( void )
2005-04-17 02:20:36 +04:00
{
2019-03-10 19:13:15 +03:00
if ( conf_write ( configname ) ) {
2018-05-22 22:36:12 +03:00
QMessageBox : : information ( this , " qconf " , " Unable to save configuration! " ) ;
2011-05-25 17:10:25 +04:00
return false ;
}
kconfig: allow all config targets to write auto.conf if missing
Currently, only syncconfig creates or updates include/config/auto.conf
and some other files. Other config targets create or update only the
.config file.
When you configure and build the kernel from a pristine source tree,
any config target is followed by syncconfig in the build stage since
include/config/auto.conf is missing.
We are moving compiler tests from Makefile to Kconfig. It means that
parsing Kconfig files will be more costly since Kconfig invokes the
compiler commands internally. Thus, we want to avoid invoking Kconfig
twice (one for *config to create the .config, and one for syncconfig
to synchronize the auto.conf). If auto.conf does not exist, we can
generate all configuration files in the first configuration stage,
which will save the syncconfig in the build stage.
Please note this should be done only when auto.conf is missing. If
*config blindly did this, time stamp files under include/config/ would
be unnecessarily touched, triggering unneeded rebuild of objects.
I assume a scenario like this:
1. You have a source tree that has already been built
with CONFIG_FOO disabled
2. Run "make menuconfig" to enable CONFIG_FOO
3. CONFIG_FOO turns out to be unnecessary.
Run "make menuconfig" again to disable CONFIG_FOO
4. Run "make"
In this case, include/config/foo.h should not be touched since there
is no change in CONFIG_FOO. The sync process should be delayed until
the user really attempts to build the kernel.
This commit has another motivation; I want to suppress the 'No such
file or directory' warning from the 'include' directive.
The top-level Makefile includes auto.conf with '-include' directive,
like this:
ifeq ($(dot-config),1)
-include include/config/auto.conf
endif
This looks strange because auto.conf is mandatory when dot-config is 1.
I guess only the reason of using '-include' is to suppress the warning
'include/config/auto.conf: No such file or directory' when building
from a clean tree. However, this has a side-effect; Make considers
the files included by '-include' are optional. Hence, Make continues
to build even if it fails to generate include/config/auto.conf. I will
change this in the next commit, but the warning message is annoying.
(At least, kbuild test robot reports it as a regression.)
With this commit, Kconfig will generate all configuration files together
with the .config and I guess it is a solution good enough to suppress
the warning.
Note:
GNU Make 4.2 or later does not display the warning from the 'include'
directive if include files are successfully generated. See GNU Make
commit 87a5f98d248f ("[SV 102] Don't show unnecessary include file
errors.") However, older GNU Make versions are still widely used.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-07-20 10:46:31 +03:00
conf_write_autoconf ( 0 ) ;
2011-05-25 17:10:25 +04:00
return true ;
2005-04-17 02:20:36 +04:00
}
void ConfigMainWindow : : saveConfigAs ( void )
{
2019-03-10 19:13:15 +03:00
QString str ;
QByteArray ba ;
const char * name ;
str = QFileDialog : : getSaveFileName ( this , " " , configname ) ;
if ( str . isNull ( ) )
2005-04-17 02:20:36 +04:00
return ;
2019-03-10 19:13:15 +03:00
ba = str . toLocal8Bit ( ) ;
name = ba . data ( ) ;
if ( conf_write ( name ) ) {
QMessageBox : : information ( this , " qconf " , " Unable to save configuration! " ) ;
}
conf_write_autoconf ( 0 ) ;
free ( configname ) ;
configname = xstrdup ( name ) ;
2005-04-17 02:20:36 +04:00
}
2006-06-09 09:12:45 +04:00
void ConfigMainWindow : : searchConfig ( void )
{
if ( ! searchWindow )
2020-08-07 12:18:57 +03:00
searchWindow = new ConfigSearchWindow ( this ) ;
2006-06-09 09:12:45 +04:00
searchWindow - > show ( ) ;
}
2020-04-02 12:28:01 +03:00
void ConfigMainWindow : : changeItens ( struct menu * menu )
2005-04-17 02:20:36 +04:00
{
2015-09-22 21:36:19 +03:00
configList - > setRootMenu ( menu ) ;
2005-04-17 02:20:36 +04:00
}
2020-04-02 12:28:01 +03:00
void ConfigMainWindow : : changeMenu ( struct menu * menu )
{
menuList - > setRootMenu ( menu ) ;
}
2006-06-09 09:12:47 +04:00
void ConfigMainWindow : : setMenuLink ( struct menu * menu )
2005-04-17 02:20:36 +04:00
{
2015-09-22 21:36:19 +03:00
struct menu * parent ;
ConfigList * list = NULL ;
ConfigItem * item ;
if ( configList - > menuSkip ( menu ) )
return ;
switch ( configList - > mode ) {
case singleMode :
list = configList ;
parent = menu_get_parent_menu ( menu ) ;
if ( ! parent )
return ;
list - > setRootMenu ( parent ) ;
break ;
kconfig: qconf: make search fully work again on split mode
When the search dialog box finds symbols/menus that match
the search criteria, it presents all results at the window.
Clicking on a search result should make qconf to navigate
to the selected item. This works on singleMode and on
fullMode, but on splitMode, the navigation is broken.
This was partially caused by an incomplete Qt5 conversion
and by the followup patches that restored the original
behavior.
When qconf is on split mode, it has to update both the
config and the menu views. Right now, such logic is broken,
as it is not seeking using the right structures.
On qconf, the screen is split into 3 parts:
+------------+-------+
| | |
| Config | Menu |
| | |
+------------+-------+
| |
| ConfigInfo |
| |
+--------------------+
On singleMode and on fullMode, the menuView is hidden, and search
updates only the configList (which controls the ConfigView).
On SplitMode, the search logic should detect if the variable is a
leaf or not. If it is a leaf, it should be presented at the menuView,
and both configList and menuList should be updated. Otherwise, just
the configList should be updated.
Link: https://lore.kernel.org/lkml/a98b0f0ebe0c23615a76f1d23f25fd0c84835e6b.camel@redhat.com/
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-06-30 09:26:36 +03:00
case menuMode :
2015-09-22 21:36:19 +03:00
if ( menu - > flags & MENU_ROOT ) {
kconfig: qconf: make search fully work again on split mode
When the search dialog box finds symbols/menus that match
the search criteria, it presents all results at the window.
Clicking on a search result should make qconf to navigate
to the selected item. This works on singleMode and on
fullMode, but on splitMode, the navigation is broken.
This was partially caused by an incomplete Qt5 conversion
and by the followup patches that restored the original
behavior.
When qconf is on split mode, it has to update both the
config and the menu views. Right now, such logic is broken,
as it is not seeking using the right structures.
On qconf, the screen is split into 3 parts:
+------------+-------+
| | |
| Config | Menu |
| | |
+------------+-------+
| |
| ConfigInfo |
| |
+--------------------+
On singleMode and on fullMode, the menuView is hidden, and search
updates only the configList (which controls the ConfigView).
On SplitMode, the search logic should detect if the variable is a
leaf or not. If it is a leaf, it should be presented at the menuView,
and both configList and menuList should be updated. Otherwise, just
the configList should be updated.
Link: https://lore.kernel.org/lkml/a98b0f0ebe0c23615a76f1d23f25fd0c84835e6b.camel@redhat.com/
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-06-30 09:26:36 +03:00
menuList - > setRootMenu ( menu ) ;
2015-09-22 21:36:19 +03:00
configList - > clearSelection ( ) ;
list = configList ;
kconfig: qconf: make search fully work again on split mode
When the search dialog box finds symbols/menus that match
the search criteria, it presents all results at the window.
Clicking on a search result should make qconf to navigate
to the selected item. This works on singleMode and on
fullMode, but on splitMode, the navigation is broken.
This was partially caused by an incomplete Qt5 conversion
and by the followup patches that restored the original
behavior.
When qconf is on split mode, it has to update both the
config and the menu views. Right now, such logic is broken,
as it is not seeking using the right structures.
On qconf, the screen is split into 3 parts:
+------------+-------+
| | |
| Config | Menu |
| | |
+------------+-------+
| |
| ConfigInfo |
| |
+--------------------+
On singleMode and on fullMode, the menuView is hidden, and search
updates only the configList (which controls the ConfigView).
On SplitMode, the search logic should detect if the variable is a
leaf or not. If it is a leaf, it should be presented at the menuView,
and both configList and menuList should be updated. Otherwise, just
the configList should be updated.
Link: https://lore.kernel.org/lkml/a98b0f0ebe0c23615a76f1d23f25fd0c84835e6b.camel@redhat.com/
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-06-30 09:26:36 +03:00
} else {
2015-09-22 21:36:19 +03:00
parent = menu_get_parent_menu ( menu - > parent ) ;
if ( ! parent )
return ;
kconfig: qconf: make search fully work again on split mode
When the search dialog box finds symbols/menus that match
the search criteria, it presents all results at the window.
Clicking on a search result should make qconf to navigate
to the selected item. This works on singleMode and on
fullMode, but on splitMode, the navigation is broken.
This was partially caused by an incomplete Qt5 conversion
and by the followup patches that restored the original
behavior.
When qconf is on split mode, it has to update both the
config and the menu views. Right now, such logic is broken,
as it is not seeking using the right structures.
On qconf, the screen is split into 3 parts:
+------------+-------+
| | |
| Config | Menu |
| | |
+------------+-------+
| |
| ConfigInfo |
| |
+--------------------+
On singleMode and on fullMode, the menuView is hidden, and search
updates only the configList (which controls the ConfigView).
On SplitMode, the search logic should detect if the variable is a
leaf or not. If it is a leaf, it should be presented at the menuView,
and both configList and menuList should be updated. Otherwise, just
the configList should be updated.
Link: https://lore.kernel.org/lkml/a98b0f0ebe0c23615a76f1d23f25fd0c84835e6b.camel@redhat.com/
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-06-30 09:26:36 +03:00
/* Select the config view */
item = configList - > findConfigItem ( parent ) ;
2015-09-22 21:36:19 +03:00
if ( item ) {
2020-06-30 09:26:38 +03:00
configList - > setSelected ( item , true ) ;
kconfig: qconf: make search fully work again on split mode
When the search dialog box finds symbols/menus that match
the search criteria, it presents all results at the window.
Clicking on a search result should make qconf to navigate
to the selected item. This works on singleMode and on
fullMode, but on splitMode, the navigation is broken.
This was partially caused by an incomplete Qt5 conversion
and by the followup patches that restored the original
behavior.
When qconf is on split mode, it has to update both the
config and the menu views. Right now, such logic is broken,
as it is not seeking using the right structures.
On qconf, the screen is split into 3 parts:
+------------+-------+
| | |
| Config | Menu |
| | |
+------------+-------+
| |
| ConfigInfo |
| |
+--------------------+
On singleMode and on fullMode, the menuView is hidden, and search
updates only the configList (which controls the ConfigView).
On SplitMode, the search logic should detect if the variable is a
leaf or not. If it is a leaf, it should be presented at the menuView,
and both configList and menuList should be updated. Otherwise, just
the configList should be updated.
Link: https://lore.kernel.org/lkml/a98b0f0ebe0c23615a76f1d23f25fd0c84835e6b.camel@redhat.com/
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-06-30 09:26:36 +03:00
configList - > scrollToItem ( item ) ;
2015-09-22 21:36:19 +03:00
}
kconfig: qconf: make search fully work again on split mode
When the search dialog box finds symbols/menus that match
the search criteria, it presents all results at the window.
Clicking on a search result should make qconf to navigate
to the selected item. This works on singleMode and on
fullMode, but on splitMode, the navigation is broken.
This was partially caused by an incomplete Qt5 conversion
and by the followup patches that restored the original
behavior.
When qconf is on split mode, it has to update both the
config and the menu views. Right now, such logic is broken,
as it is not seeking using the right structures.
On qconf, the screen is split into 3 parts:
+------------+-------+
| | |
| Config | Menu |
| | |
+------------+-------+
| |
| ConfigInfo |
| |
+--------------------+
On singleMode and on fullMode, the menuView is hidden, and search
updates only the configList (which controls the ConfigView).
On SplitMode, the search logic should detect if the variable is a
leaf or not. If it is a leaf, it should be presented at the menuView,
and both configList and menuList should be updated. Otherwise, just
the configList should be updated.
Link: https://lore.kernel.org/lkml/a98b0f0ebe0c23615a76f1d23f25fd0c84835e6b.camel@redhat.com/
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-06-30 09:26:36 +03:00
menuList - > setRootMenu ( parent ) ;
menuList - > clearSelection ( ) ;
list = menuList ;
2015-09-22 21:36:19 +03:00
}
break ;
case fullMode :
list = configList ;
break ;
default :
break ;
}
if ( list ) {
item = list - > findConfigItem ( menu ) ;
if ( item ) {
2020-06-30 09:26:38 +03:00
list - > setSelected ( item , true ) ;
2015-09-22 21:36:19 +03:00
list - > scrollToItem ( item ) ;
list - > setFocus ( ) ;
2020-06-30 09:48:35 +03:00
helpText - > setInfo ( menu ) ;
2015-09-22 21:36:19 +03:00
}
}
2005-04-17 02:20:36 +04:00
}
2006-06-09 09:12:47 +04:00
void ConfigMainWindow : : listFocusChanged ( void )
{
2015-09-22 21:36:19 +03:00
if ( menuList - > mode = = menuMode )
configList - > clearSelection ( ) ;
2006-06-09 09:12:47 +04:00
}
2005-04-17 02:20:36 +04:00
void ConfigMainWindow : : goBack ( void )
{
2015-09-22 21:36:19 +03:00
if ( configList - > rootEntry = = & rootmenu )
2015-09-22 21:36:28 +03:00
return ;
2020-06-30 09:26:39 +03:00
configList - > setParentMenu ( ) ;
2005-04-17 02:20:36 +04:00
}
void ConfigMainWindow : : showSingleView ( void )
{
2015-09-22 21:36:13 +03:00
singleViewAction - > setEnabled ( false ) ;
singleViewAction - > setChecked ( true ) ;
splitViewAction - > setEnabled ( true ) ;
splitViewAction - > setChecked ( false ) ;
fullViewAction - > setEnabled ( true ) ;
fullViewAction - > setChecked ( false ) ;
2020-06-30 09:26:39 +03:00
backAction - > setEnabled ( true ) ;
2020-08-29 11:14:15 +03:00
menuList - > hide ( ) ;
2015-09-22 21:36:19 +03:00
menuList - > setRootMenu ( 0 ) ;
configList - > mode = singleMode ;
if ( configList - > rootEntry = = & rootmenu )
configList - > updateListAll ( ) ;
else
configList - > setRootMenu ( & rootmenu ) ;
2005-04-17 02:20:36 +04:00
configList - > setFocus ( ) ;
}
void ConfigMainWindow : : showSplitView ( void )
{
2015-09-22 21:36:13 +03:00
singleViewAction - > setEnabled ( true ) ;
singleViewAction - > setChecked ( false ) ;
splitViewAction - > setEnabled ( false ) ;
splitViewAction - > setChecked ( true ) ;
fullViewAction - > setEnabled ( true ) ;
fullViewAction - > setChecked ( false ) ;
2020-06-30 09:26:39 +03:00
backAction - > setEnabled ( false ) ;
2020-04-02 12:28:01 +03:00
configList - > mode = menuMode ;
2015-09-22 21:36:19 +03:00
if ( configList - > rootEntry = = & rootmenu )
configList - > updateListAll ( ) ;
else
configList - > setRootMenu ( & rootmenu ) ;
configList - > setAllOpen ( true ) ;
configApp - > processEvents ( ) ;
2020-04-02 12:28:01 +03:00
menuList - > mode = symbolMode ;
2015-09-22 21:36:19 +03:00
menuList - > setRootMenu ( & rootmenu ) ;
menuList - > setAllOpen ( true ) ;
2020-08-29 11:14:15 +03:00
menuList - > show ( ) ;
2005-04-17 02:20:36 +04:00
menuList - > setFocus ( ) ;
}
void ConfigMainWindow : : showFullView ( void )
{
2015-09-22 21:36:13 +03:00
singleViewAction - > setEnabled ( true ) ;
singleViewAction - > setChecked ( false ) ;
splitViewAction - > setEnabled ( true ) ;
splitViewAction - > setChecked ( false ) ;
fullViewAction - > setEnabled ( false ) ;
fullViewAction - > setChecked ( true ) ;
2020-06-30 09:26:39 +03:00
backAction - > setEnabled ( false ) ;
2020-08-29 11:14:15 +03:00
menuList - > hide ( ) ;
2015-09-22 21:36:19 +03:00
menuList - > setRootMenu ( 0 ) ;
configList - > mode = fullMode ;
if ( configList - > rootEntry = = & rootmenu )
configList - > updateListAll ( ) ;
else
configList - > setRootMenu ( & rootmenu ) ;
2005-04-17 02:20:36 +04:00
configList - > setFocus ( ) ;
}
/*
* ask for saving configuration before quitting
*/
void ConfigMainWindow : : closeEvent ( QCloseEvent * e )
{
2006-12-13 11:34:06 +03:00
if ( ! conf_get_changed ( ) ) {
2005-04-17 02:20:36 +04:00
e - > accept ( ) ;
return ;
}
2023-08-09 14:42:31 +03:00
QMessageBox mb ( QMessageBox : : Icon : : Warning , " qconf " ,
" Save configuration? " ) ;
QPushButton * yb = mb . addButton ( QMessageBox : : Yes ) ;
QPushButton * db = mb . addButton ( QMessageBox : : No ) ;
QPushButton * cb = mb . addButton ( QMessageBox : : Cancel ) ;
yb - > setText ( " &Save Changes " ) ;
db - > setText ( " &Discard Changes " ) ;
cb - > setText ( " Cancel Exit " ) ;
mb . setDefaultButton ( yb ) ;
mb . setEscapeButton ( cb ) ;
2005-04-17 02:20:36 +04:00
switch ( mb . exec ( ) ) {
case QMessageBox : : Yes :
2011-05-25 17:10:25 +04:00
if ( saveConfig ( ) )
e - > accept ( ) ;
else
e - > ignore ( ) ;
break ;
2005-04-17 02:20:36 +04:00
case QMessageBox : : No :
e - > accept ( ) ;
break ;
case QMessageBox : : Cancel :
e - > ignore ( ) ;
break ;
}
}
void ConfigMainWindow : : showIntro ( void )
{
2020-08-29 11:14:07 +03:00
static const QString str =
" Welcome to the qconf graphical configuration tool. \n "
" \n "
kconfig: qconf: allow to edit "int", "hex", "string" menus in-place
Previously, when you double-clicked the "int", "hex", or "string" menus,
a line-edit gadget showed up to allow you to input the value, which
looked clumsy.
Also, it was buggy; the editor opened even if the config option was not
editable. For example, just try to double-click CC_VERSION_TEXT, which
has no prompt.
This commit sub-classes QStyleItemDelegate to allow users to edit
"int", "hex", "string" menus in-place. Just double-click (or press
the F2 key) in the data column. Then, an editor widget is placed on
top of the item view.
The two methods are overridden:
createEditor - process only when the data column is being accessed
and the menu is visible. Otherwise, return nullptr to disallow editing.
setModelData - take the new data from the editor, and set it to the
addressed symbol. If it was successful, update all the list windows.
Otherwise, (the reason for the failure is possibly the input data was
out of range), set the old value back to the editor.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-08-29 11:14:12 +03:00
" For bool and tristate options, a blank box indicates the "
" feature is disabled, a check indicates it is enabled, and a "
" dot indicates that it is to be compiled as a module. Clicking "
" on the box will cycle through the three states. For int, hex, "
" and string options, double-clicking or pressing F2 on the "
" Value cell will allow you to edit the value. \n "
2020-08-29 11:14:07 +03:00
" \n "
" If you do not see an option (e.g., a device driver) that you "
" believe should be present, try turning on Show All Options "
2020-08-29 11:14:08 +03:00
" under the Options menu. Enabling Show Debug Info will help you "
" figure out what other options must be enabled to support the "
" option you are interested in, and hyperlinks will navigate to "
" them. \n "
2020-08-29 11:14:07 +03:00
" \n "
" Toggling Show Debug Info under the Options menu will show the "
" dependencies, which you can then match by examining other "
" options. \n " ;
2005-04-17 02:20:36 +04:00
QMessageBox : : information ( this , " qconf " , str ) ;
}
void ConfigMainWindow : : showAbout ( void )
{
2018-05-22 22:36:12 +03:00
static const QString str = " qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>. \n "
2020-11-02 05:59:57 +03:00
" Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>. \n "
" \n "
" Bug reports and feature request can also be entered at http://bugzilla.kernel.org/ \n "
" \n "
" Qt Version: " ;
2005-04-17 02:20:36 +04:00
2020-11-02 05:59:57 +03:00
QMessageBox : : information ( this , " qconf " , str + qVersion ( ) ) ;
2005-04-17 02:20:36 +04:00
}
void ConfigMainWindow : : saveSettings ( void )
{
2015-09-22 21:36:15 +03:00
configSettings - > setValue ( " /window x " , pos ( ) . x ( ) ) ;
configSettings - > setValue ( " /window y " , pos ( ) . y ( ) ) ;
configSettings - > setValue ( " /window width " , size ( ) . width ( ) ) ;
configSettings - > setValue ( " /window height " , size ( ) . height ( ) ) ;
2005-04-17 02:20:36 +04:00
QString entry ;
2015-09-22 21:36:19 +03:00
switch ( configList - > mode ) {
case singleMode :
entry = " single " ;
break ;
case symbolMode :
entry = " split " ;
break ;
case fullMode :
entry = " full " ;
break ;
2009-05-18 03:36:49 +04:00
2015-09-22 21:36:19 +03:00
default :
break ;
}
2015-09-22 21:36:15 +03:00
configSettings - > setValue ( " /listMode " , entry ) ;
2005-04-17 02:20:36 +04:00
2006-06-09 09:12:46 +04:00
configSettings - > writeSizes ( " /split1 " , split1 - > sizes ( ) ) ;
configSettings - > writeSizes ( " /split2 " , split2 - > sizes ( ) ) ;
2005-04-17 02:20:36 +04:00
}
2006-12-13 11:34:08 +03:00
void ConfigMainWindow : : conf_changed ( void )
{
if ( saveAction )
saveAction - > setEnabled ( conf_get_changed ( ) ) ;
}
2005-04-17 02:20:36 +04:00
void fixup_rootmenu ( struct menu * menu )
{
struct menu * child ;
static int menu_cnt = 0 ;
menu - > flags | = MENU_ROOT ;
for ( child = menu - > list ; child ; child = child - > next ) {
if ( child - > prompt & & child - > prompt - > type = = P_MENU ) {
menu_cnt + + ;
fixup_rootmenu ( child ) ;
menu_cnt - - ;
} else if ( ! menu_cnt )
fixup_rootmenu ( child ) ;
}
}
static const char * progname ;
static void usage ( void )
{
2018-05-22 22:36:12 +03:00
printf ( " %s [-s] <config> \n " , progname ) ;
2005-04-17 02:20:36 +04:00
exit ( 0 ) ;
}
int main ( int ac , char * * av )
{
ConfigMainWindow * v ;
const char * name ;
progname = av [ 0 ] ;
if ( ac > 1 & & av [ 1 ] [ 0 ] = = ' - ' ) {
switch ( av [ 1 ] [ 1 ] ) {
2015-04-08 14:30:42 +03:00
case ' s ' :
conf_set_message_callback ( NULL ) ;
break ;
2005-04-17 02:20:36 +04:00
case ' h ' :
case ' ? ' :
usage ( ) ;
}
name = av [ 2 ] ;
} else
name = av [ 1 ] ;
if ( ! name )
usage ( ) ;
conf_parse ( name ) ;
fixup_rootmenu ( & rootmenu ) ;
conf_read ( NULL ) ;
//zconfdump(stdout);
2020-08-29 11:14:17 +03:00
configApp = new QApplication ( ac , av ) ;
2006-06-09 09:12:46 +04:00
configSettings = new ConfigSettings ( ) ;
configSettings - > beginGroup ( " /kconfig/qconf " ) ;
2005-04-17 02:20:36 +04:00
v = new ConfigMainWindow ( ) ;
//zconfdump(stdout);
configApp - > connect ( configApp , SIGNAL ( lastWindowClosed ( ) ) , SLOT ( quit ( ) ) ) ;
configApp - > connect ( configApp , SIGNAL ( aboutToQuit ( ) ) , v , SLOT ( saveSettings ( ) ) ) ;
2006-06-09 09:12:45 +04:00
v - > show ( ) ;
2005-04-17 02:20:36 +04:00
configApp - > exec ( ) ;
2006-06-09 09:12:46 +04:00
configSettings - > endGroup ( ) ;
delete configSettings ;
2016-01-08 23:44:04 +03:00
delete v ;
delete configApp ;
2006-06-09 09:12:46 +04:00
2005-04-17 02:20:36 +04:00
return 0 ;
}