From 4b3e11b3e7d00881878f45cddbfe8f4bf07d1ebe Mon Sep 17 00:00:00 2001 From: Alper Yildirim Date: Mon, 20 Jul 2009 18:50:58 +0200 Subject: config: Update package/config to Kconfig 2.6.30 Update the package/config stuff with the code available in the Linux kernel 2.6.30. Signed-off-by: Alper Yildirim --- package/config/qconf.cc | 149 +++++++++++++++++++++++++----------------------- 1 file changed, 77 insertions(+), 72 deletions(-) (limited to 'package/config/qconf.cc') diff --git a/package/config/qconf.cc b/package/config/qconf.cc index b9bb32dfd..ce7d508c7 100644 --- a/package/config/qconf.cc +++ b/package/config/qconf.cc @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -114,7 +115,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: @@ -208,7 +209,7 @@ void ConfigItem::updateMenu(void) break; } if (!sym_has_value(sym) && visible) - prompt += " (NEW)"; + prompt += _(" (NEW)"); set_prompt: setText(promptColIdx, prompt); } @@ -297,10 +298,10 @@ void ConfigLineEdit::show(ConfigItem* i) void ConfigLineEdit::keyPressEvent(QKeyEvent* e) { switch (e->key()) { - case Key_Escape: + case Qt::Key_Escape: break; - case Key_Return: - case Key_Enter: + case Qt::Key_Return: + case Qt::Key_Enter: sym_set_string_value(item->menu->sym, text().latin1()); parent()->updateList(item); break; @@ -346,7 +347,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(); } @@ -360,14 +361,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(); } @@ -639,7 +640,7 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) struct menu *menu; enum prop_type type; - if (ev->key() == Key_Escape && mode != fullMode && mode != listMode) { + if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) { emit parentSelected(); ev->accept(); return; @@ -652,8 +653,8 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) item = (ConfigItem*)i; switch (ev->key()) { - case Key_Return: - case Key_Enter: + case Qt::Key_Return: + case Qt::Key_Enter: if (item->goParent) { emit parentSelected(); break; @@ -667,16 +668,16 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) emit menuSelected(menu); break; } - case Key_Space: + case Qt::Key_Space: changeValue(item); break; - case Key_N: + case Qt::Key_N: setValue(item, no); break; - case Key_M: + case Qt::Key_M: setValue(item, mod); break; - case Key_Y: + case Qt::Key_Y: setValue(item, yes); break; default: @@ -803,7 +804,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))); @@ -811,7 +812,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))); @@ -819,7 +820,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))); @@ -920,7 +921,7 @@ void ConfigView::updateListAll(void) } ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) - : Parent(parent, name), menu(0), sym(0) + : Parent(parent, name), sym(0), menu(0) { if (name) { configSettings->beginGroup(name); @@ -1041,7 +1042,12 @@ void ConfigInfoView::menuInfo(void) if (showDebug()) debug = debug_info(sym); - help = print_filter(_(menu_get_help(menu))); + 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 += ""; head += print_filter(_(menu->prompt->text)); @@ -1083,7 +1089,11 @@ QString ConfigInfoView::debug_info(struct symbol *sym) debug += "
"; 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 += "
"; break; @@ -1094,16 +1104,6 @@ QString ConfigInfoView::debug_info(struct symbol *sym) debug += "
"; } break; - case P_SELECT: - debug += "select: "; - expr_print(prop->expr, expr_print_help, &debug, E_NONE); - debug += "
"; - break; - case P_RANGE: - debug += "range: "; - expr_print(prop->expr, expr_print_help, &debug, E_NONE); - debug += "
"; - break; default: debug += "unknown property: "; debug += prop_get_type_name(prop->type); @@ -1167,7 +1167,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))); @@ -1189,18 +1189,18 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam 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); layout1->addLayout(layout2); split = new QSplitter(this); - split->setOrientation(QSplitter::Vertical); + split->setOrientation(Qt::Vertical); list = new ConfigView(split, name); list->list->mode = listMode; info = new ConfigInfoView(split, name); @@ -1276,7 +1276,7 @@ ConfigMainWindow::ConfigMainWindow(void) int x, y, width, height; char title[256]; - QWidget *d = configApp->desktop(); + QDesktopWidget *d = configApp->desktop(); snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"), getenv("KERNELVERSION")); setCaption(title); @@ -1291,14 +1291,14 @@ ConfigMainWindow::ConfigMainWindow(void) move(x, y); split1 = new QSplitter(this); - split1->setOrientation(QSplitter::Horizontal); + split1->setOrientation(Qt::Horizontal); setCentralWidget(split1); menuView = new ConfigView(split1, "menu"); menuList = menuView->list; split2 = new QSplitter(split1); - split2->setOrientation(QSplitter::Vertical); + split2->setOrientation(Qt::Vertical); // create config tree configView = new ConfigView(split2, "config"); @@ -1313,58 +1313,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"), Qt::CTRL + Qt::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"), Qt::CTRL + Qt::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"), Qt::CTRL + Qt::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("Find", "&Find", CTRL+Key_F, this); + QAction *searchAction = new QAction("Find", _("&Find"), Qt::CTRL + Qt::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 @@ -1379,7 +1379,7 @@ 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); @@ -1388,12 +1388,12 @@ ConfigMainWindow::ConfigMainWindow(void) // create edit menu QPopupMenu* editMenu = new QPopupMenu(this); - menu->insertItem("&Edit", editMenu); + 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); @@ -1404,7 +1404,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); @@ -1448,27 +1448,27 @@ ConfigMainWindow::ConfigMainWindow(void) void ConfigMainWindow::loadConfig(void) { - QString s = QFileDialog::getOpenFileName(".config", NULL, this); + QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); 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) { - QString s = QFileDialog::getSaveFileName(".config", NULL, this); + QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); 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) @@ -1525,6 +1525,8 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) case fullMode: list = configList; break; + default: + break; } if (list) { @@ -1612,11 +1614,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); @@ -1631,7 +1633,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 kernel configuration tool for Linux.\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" @@ -1641,15 +1643,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 .\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 .\n\n" + "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"); QMessageBox::information(this, "qconf", str); } @@ -1674,6 +1676,9 @@ void ConfigMainWindow::saveSettings(void) case fullMode : entry = "full"; break; + + default: + break; } configSettings->writeEntry("/listMode", entry); @@ -1707,7 +1712,7 @@ static const char *progname; static void usage(void) { - printf("%s \n", progname); + printf(_("%s \n"), progname); exit(0); } -- cgit v1.2.3