summaryrefslogtreecommitdiff
path: root/extra/config/qconf.cc
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-06-05 11:43:44 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-06-05 11:43:44 +0000
commitb7a51199bdd351992670e6466d36202c8e70d89a (patch)
treeb9fda86acebfcd59f190b2063e3e7c292c176cb6 /extra/config/qconf.cc
parent3afa0348159254528ec5c21829d250899cd76b76 (diff)
- pull kconfig from 2.6.25.4
It has nicer "-*-" etc hints
Diffstat (limited to 'extra/config/qconf.cc')
-rw-r--r--extra/config/qconf.cc132
1 files changed, 74 insertions, 58 deletions
diff --git a/extra/config/qconf.cc b/extra/config/qconf.cc
index c0ae0a7dd..ec3b5bb1e 100644
--- a/extra/config/qconf.cc
+++ b/extra/config/qconf.cc
@@ -89,6 +89,7 @@ void ConfigItem::okRename(int col)
{
Parent::okRename(col);
sym_set_string_value(menu->sym, text(dataColIdx).latin1());
+ listView()->updateList(this);
}
#endif
@@ -113,7 +114,7 @@ void ConfigItem::updateMenu(void)
sym = menu->sym;
prop = menu->prompt;
- prompt = QString::fromLocal8Bit(menu_get_prompt(menu));
+ prompt = _(menu_get_prompt(menu));
if (prop) switch (prop->type) {
case P_MENU:
@@ -207,7 +208,7 @@ void ConfigItem::updateMenu(void)
break;
}
if (!sym_has_value(sym) && visible)
- prompt += " (NEW)";
+ prompt += _(" (NEW)");
set_prompt:
setText(promptColIdx, prompt);
}
@@ -345,7 +346,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
for (i = 0; i < colNr; i++)
colMap[i] = colRevMap[i] = -1;
- addColumn(promptColIdx, "Option");
+ addColumn(promptColIdx, _("Option"));
reinit();
}
@@ -359,14 +360,14 @@ void ConfigList::reinit(void)
removeColumn(nameColIdx);
if (showName)
- addColumn(nameColIdx, "Name");
+ addColumn(nameColIdx, _("Name"));
if (showRange) {
addColumn(noColIdx, "N");
addColumn(modColIdx, "M");
addColumn(yesColIdx, "Y");
}
if (showData)
- addColumn(dataColIdx, "Value");
+ addColumn(dataColIdx, _("Value"));
updateListAll();
}
@@ -605,6 +606,8 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
visible = menu_is_visible(child);
if (showAll || visible) {
+ if (!child->sym && !child->list && !child->prompt)
+ continue;
if (!item || item->menu != child)
item = new ConfigItem(parent, last, child, visible);
else
@@ -800,7 +803,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
QAction *action;
headerPopup = new QPopupMenu(this);
- action = new QAction(NULL, "Show Name", 0, this);
+ action = new QAction(NULL, _("Show Name"), 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowName(bool)));
@@ -808,7 +811,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
action, SLOT(setOn(bool)));
action->setOn(showName);
action->addTo(headerPopup);
- action = new QAction(NULL, "Show Range", 0, this);
+ action = new QAction(NULL, _("Show Range"), 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowRange(bool)));
@@ -816,7 +819,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
action, SLOT(setOn(bool)));
action->setOn(showRange);
action->addTo(headerPopup);
- action = new QAction(NULL, "Show Data", 0, this);
+ action = new QAction(NULL, _("Show Data"), 0, this);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowData(bool)));
@@ -1038,7 +1041,12 @@ void ConfigInfoView::menuInfo(void)
if (showDebug())
debug = debug_info(sym);
- help = print_filter(_(sym->help));
+ help = menu_get_help(menu);
+ /* Gettextize if the help text not empty */
+ if (help.isEmpty())
+ help = print_filter(menu_get_help(menu));
+ else
+ help = print_filter(_(menu_get_help(menu)));
} else if (menu->prompt) {
head += "<big><b>";
head += print_filter(_(menu->prompt->text));
@@ -1080,7 +1088,11 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
debug += "</a><br>";
break;
case P_DEFAULT:
- debug += "default: ";
+ case P_SELECT:
+ case P_RANGE:
+ case P_ENV:
+ debug += prop_get_type_name(prop->type);
+ debug += ": ";
expr_print(prop->expr, expr_print_help, &debug, E_NONE);
debug += "<br>";
break;
@@ -1091,16 +1103,6 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
debug += "<br>";
}
break;
- case P_SELECT:
- debug += "select: ";
- expr_print(prop->expr, expr_print_help, &debug, E_NONE);
- debug += "<br>";
- break;
- case P_RANGE:
- debug += "range: ";
- expr_print(prop->expr, expr_print_help, &debug, E_NONE);
- debug += "<br>";
- break;
default:
debug += "unknown property: ";
debug += prop_get_type_name(prop->type);
@@ -1164,7 +1166,7 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
{
QPopupMenu* popup = Parent::createPopupMenu(pos);
- QAction* action = new QAction(NULL,"Show Debug Info", 0, popup);
+ QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1179,18 +1181,18 @@ void ConfigInfoView::contentsContextMenuEvent(QContextMenuEvent *e)
Parent::contentsContextMenuEvent(e);
}
-ConfigSearchWindow::ConfigSearchWindow(QWidget* parent, const char *name)
+ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name)
: Parent(parent, name), result(NULL)
{
setCaption("Search Config");
QVBoxLayout* layout1 = new QVBoxLayout(this, 11, 6);
QHBoxLayout* layout2 = new QHBoxLayout(0, 0, 6);
- layout2->addWidget(new QLabel("Find:", this));
+ layout2->addWidget(new QLabel(_("Find:"), this));
editField = new QLineEdit(this);
connect(editField, SIGNAL(returnPressed()), SLOT(search()));
layout2->addWidget(editField);
- searchButton = new QPushButton("Search", this);
+ searchButton = new QPushButton(_("Search"), this);
searchButton->setAutoDefault(FALSE);
connect(searchButton, SIGNAL(clicked()), SLOT(search()));
layout2->addWidget(searchButton);
@@ -1203,6 +1205,9 @@ ConfigSearchWindow::ConfigSearchWindow(QWidget* parent, const char *name)
info = new ConfigInfoView(split, name);
connect(list->list, SIGNAL(menuChanged(struct menu *)),
info, SLOT(setInfo(struct menu *)));
+ connect(list->list, SIGNAL(menuChanged(struct menu *)),
+ parent, SLOT(setMenuLink(struct menu *)));
+
layout1->addWidget(split);
if (name) {
@@ -1247,6 +1252,7 @@ void ConfigSearchWindow::search(void)
free(result);
list->list->clear();
+ info->clear();
result = sym_re_search(editField->text().latin1());
if (!result)
@@ -1267,8 +1273,12 @@ ConfigMainWindow::ConfigMainWindow(void)
QMenuBar* menu;
bool ok;
int x, y, width, height;
+ char title[256];
QWidget *d = configApp->desktop();
+ snprintf(title, sizeof(title), _("uClibc v%s Configuration"),
+ getenv("VERSION"));
+ setCaption(title);
width = configSettings->readNumEntry("/window width", d->width() - 64);
height = configSettings->readNumEntry("/window height", d->height() - 64);
@@ -1302,58 +1312,58 @@ ConfigMainWindow::ConfigMainWindow(void)
menu = menuBar();
toolBar = new QToolBar("Tools", this);
- backAction = new QAction("Back", QPixmap(xpm_back), "Back", 0, this);
+ backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this);
connect(backAction, SIGNAL(activated()), SLOT(goBack()));
backAction->setEnabled(FALSE);
- QAction *quitAction = new QAction("Quit", "&Quit", CTRL+Key_Q, this);
+ QAction *quitAction = new QAction("Quit", _("&Quit"), CTRL+Key_Q, this);
connect(quitAction, SIGNAL(activated()), SLOT(close()));
- QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this);
+ QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), CTRL+Key_L, this);
connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
- saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this);
+ saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), CTRL+Key_S, this);
connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
conf_set_changed_callback(conf_changed);
// Set saveAction's initial state
conf_changed();
- QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this);
+ QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this);
connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
- QAction *searchAction = new QAction("Search", "&Search", CTRL+Key_F, this);
+ QAction *searchAction = new QAction("Find", _("&Find"), CTRL+Key_F, this);
connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
- QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this);
+ QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this);
connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
- QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this);
+ QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this);
connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
- QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this);
+ QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this);
connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
- QAction *showNameAction = new QAction(NULL, "Show Name", 0, this);
+ QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
showNameAction->setToggleAction(TRUE);
connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
showNameAction->setOn(configView->showName());
- QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this);
+ QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this);
showRangeAction->setToggleAction(TRUE);
connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
showRangeAction->setOn(configList->showRange);
- QAction *showDataAction = new QAction(NULL, "Show Data", 0, this);
+ QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this);
showDataAction->setToggleAction(TRUE);
connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
showDataAction->setOn(configList->showData);
- QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this);
+ QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this);
showAllAction->setToggleAction(TRUE);
connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool)));
connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool)));
showAllAction->setOn(configList->showAll);
- QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this);
+ QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
showDebugAction->setToggleAction(TRUE);
connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
showDebugAction->setOn(helpText->showDebug());
- QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this);
+ QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this);
connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
- QAction *showAboutAction = new QAction(NULL, "About", 0, this);
+ QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
// init tool bar
@@ -1368,18 +1378,21 @@ ConfigMainWindow::ConfigMainWindow(void)
// create config menu
QPopupMenu* config = new QPopupMenu(this);
- menu->insertItem("&File", config);
+ menu->insertItem(_("&File"), config);
loadAction->addTo(config);
saveAction->addTo(config);
saveAsAction->addTo(config);
config->insertSeparator();
- searchAction->addTo(config);
- config->insertSeparator();
quitAction->addTo(config);
+ // create edit menu
+ QPopupMenu* editMenu = new QPopupMenu(this);
+ menu->insertItem(_("&Edit"), editMenu);
+ searchAction->addTo(editMenu);
+
// create options menu
QPopupMenu* optionMenu = new QPopupMenu(this);
- menu->insertItem("&Option", optionMenu);
+ menu->insertItem(_("&Option"), optionMenu);
showNameAction->addTo(optionMenu);
showRangeAction->addTo(optionMenu);
showDataAction->addTo(optionMenu);
@@ -1390,7 +1403,7 @@ ConfigMainWindow::ConfigMainWindow(void)
// create help menu
QPopupMenu* helpMenu = new QPopupMenu(this);
menu->insertSeparator();
- menu->insertItem("&Help", helpMenu);
+ menu->insertItem(_("&Help"), helpMenu);
showIntroAction->addTo(helpMenu);
showAboutAction->addTo(helpMenu);
@@ -1438,14 +1451,14 @@ void ConfigMainWindow::loadConfig(void)
if (s.isNull())
return;
if (conf_read(QFile::encodeName(s)))
- QMessageBox::information(this, "qconf", "Unable to load configuration!");
+ QMessageBox::information(this, "qconf", _("Unable to load configuration!"));
ConfigView::updateListAll();
}
void ConfigMainWindow::saveConfig(void)
{
if (conf_write(NULL))
- QMessageBox::information(this, "qconf", "Unable to save configuration!");
+ QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
}
void ConfigMainWindow::saveConfigAs(void)
@@ -1454,7 +1467,7 @@ void ConfigMainWindow::saveConfigAs(void)
if (s.isNull())
return;
if (conf_write(QFile::encodeName(s)))
- QMessageBox::information(this, "qconf", "Unable to save configuration!");
+ QMessageBox::information(this, "qconf", _("Unable to save configuration!"));
}
void ConfigMainWindow::searchConfig(void)
@@ -1467,7 +1480,10 @@ void ConfigMainWindow::searchConfig(void)
void ConfigMainWindow::changeMenu(struct menu *menu)
{
configList->setRootMenu(menu);
- backAction->setEnabled(TRUE);
+ if (configList->rootEntry->parent == &rootmenu)
+ backAction->setEnabled(FALSE);
+ else
+ backAction->setEnabled(TRUE);
}
void ConfigMainWindow::setMenuLink(struct menu *menu)
@@ -1595,11 +1611,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
e->accept();
return;
}
- QMessageBox mb("qconf", "Save configuration?", QMessageBox::Warning,
+ QMessageBox mb("qconf", _("Save configuration?"), QMessageBox::Warning,
QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape);
- mb.setButtonText(QMessageBox::Yes, "&Save Changes");
- mb.setButtonText(QMessageBox::No, "&Discard Changes");
- mb.setButtonText(QMessageBox::Cancel, "Cancel Exit");
+ mb.setButtonText(QMessageBox::Yes, _("&Save Changes"));
+ mb.setButtonText(QMessageBox::No, _("&Discard Changes"));
+ mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit"));
switch (mb.exec()) {
case QMessageBox::Yes:
conf_write(NULL);
@@ -1614,7 +1630,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
void ConfigMainWindow::showIntro(void)
{
- static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n"
+ static const QString str = _("Welcome to the qconf graphical configuration tool for uClibc.\n\n"
"For each option, a blank box indicates the feature is disabled, a check\n"
"indicates it is enabled, and a dot indicates that it is to be compiled\n"
"as a module. Clicking on the box will cycle through the three states.\n\n"
@@ -1624,15 +1640,15 @@ void ConfigMainWindow::showIntro(void)
"options must be enabled to support the option you are interested in, you can\n"
"still view the help of a grayed-out option.\n\n"
"Toggling Show Debug Info under the Options menu will show the dependencies,\n"
- "which you can then match by examining other options.\n\n";
+ "which you can then match by examining other options.\n\n");
QMessageBox::information(this, "qconf", str);
}
void ConfigMainWindow::showAbout(void)
{
- static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
- "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n";
+ static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
+ "Bug reports and feature request can also be entered at http://bugs.uClibc.org/\n");
QMessageBox::information(this, "qconf", str);
}
@@ -1690,7 +1706,7 @@ static const char *progname;
static void usage(void)
{
- printf("%s <config>\n", progname);
+ printf(_("%s <config>\n"), progname);
exit(0);
}