qconf.cc (9095bf25ea08135a5b74875dd0e3eeaddc4218a0) | qconf.cc (694c49a7c01cc87194be40cb26404b58b68c291c) |
---|---|
1/* 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com> 4 * Released under the terms of the GNU GPL v2.0. 5 */ 6 7#include <qglobal.h> 8 --- 20 unchanged lines hidden (view full) --- 29#include <stdlib.h> 30 31#include "lkc.h" 32#include "qconf.h" 33 34#include "qconf.moc" 35#include "images.c" 36 | 1/* 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com> 4 * Released under the terms of the GNU GPL v2.0. 5 */ 6 7#include <qglobal.h> 8 --- 20 unchanged lines hidden (view full) --- 29#include <stdlib.h> 30 31#include "lkc.h" 32#include "qconf.h" 33 34#include "qconf.moc" 35#include "images.c" 36 |
37#ifdef _ 38# undef _ 39# define _ qgettext 40#endif | |
41 42static QApplication *configApp; 43static ConfigSettings *configSettings; 44 45QAction *ConfigMainWindow::saveAction; 46 47static inline QString qgettext(const char* str) 48{ | 37 38static QApplication *configApp; 39static ConfigSettings *configSettings; 40 41QAction *ConfigMainWindow::saveAction; 42 43static inline QString qgettext(const char* str) 44{ |
49 return QString::fromLocal8Bit(gettext(str)); | 45 return QString::fromLocal8Bit(str); |
50} 51 | 46} 47 |
52static inline QString qgettext(const QString& str) 53{ 54 return QString::fromLocal8Bit(gettext(str.toLatin1())); 55} 56 | |
57ConfigSettings::ConfigSettings() 58 : QSettings("kernel.org", "qconf") 59{ 60} 61 62/** 63 * Reads a list of integer values from the application settings. 64 */ --- 57 unchanged lines hidden (view full) --- 122 if (goParent) { 123 setPixmap(promptColIdx, list->menuBackPix); 124 prompt = ".."; 125 goto set_prompt; 126 } 127 128 sym = menu->sym; 129 prop = menu->prompt; | 48ConfigSettings::ConfigSettings() 49 : QSettings("kernel.org", "qconf") 50{ 51} 52 53/** 54 * Reads a list of integer values from the application settings. 55 */ --- 57 unchanged lines hidden (view full) --- 113 if (goParent) { 114 setPixmap(promptColIdx, list->menuBackPix); 115 prompt = ".."; 116 goto set_prompt; 117 } 118 119 sym = menu->sym; 120 prop = menu->prompt; |
130 prompt = _(menu_get_prompt(menu)); | 121 prompt = qgettext(menu_get_prompt(menu)); |
131 132 if (prop) switch (prop->type) { 133 case P_MENU: 134 if (list->mode == singleMode || list->mode == symbolMode) { 135 /* a menuconfig entry is displayed differently 136 * depending whether it's at the view root or a child. 137 */ 138 if (sym && list->rootEntry == menu) --- 72 unchanged lines hidden (view full) --- 211 setText(dataColIdx, data); 212 if (type == S_STRING) 213 prompt = QString("%1: %2").arg(prompt).arg(data); 214 else 215 prompt = QString("(%2) %1").arg(prompt).arg(data); 216 break; 217 } 218 if (!sym_has_value(sym) && visible) | 122 123 if (prop) switch (prop->type) { 124 case P_MENU: 125 if (list->mode == singleMode || list->mode == symbolMode) { 126 /* a menuconfig entry is displayed differently 127 * depending whether it's at the view root or a child. 128 */ 129 if (sym && list->rootEntry == menu) --- 72 unchanged lines hidden (view full) --- 202 setText(dataColIdx, data); 203 if (type == S_STRING) 204 prompt = QString("%1: %2").arg(prompt).arg(data); 205 else 206 prompt = QString("(%2) %1").arg(prompt).arg(data); 207 break; 208 } 209 if (!sym_has_value(sym) && visible) |
219 prompt += _(" (NEW)"); | 210 prompt += " (NEW)"; |
220set_prompt: 221 setText(promptColIdx, prompt); 222} 223 224void ConfigItem::testUpdateMenu(bool v) 225{ 226 ConfigItem* i; 227 --- 94 unchanged lines hidden (view full) --- 322 323 setObjectName(name); 324 setSortingEnabled(false); 325 setRootIsDecorated(true); 326 327 setVerticalScrollMode(ScrollPerPixel); 328 setHorizontalScrollMode(ScrollPerPixel); 329 | 211set_prompt: 212 setText(promptColIdx, prompt); 213} 214 215void ConfigItem::testUpdateMenu(bool v) 216{ 217 ConfigItem* i; 218 --- 94 unchanged lines hidden (view full) --- 313 314 setObjectName(name); 315 setSortingEnabled(false); 316 setRootIsDecorated(true); 317 318 setVerticalScrollMode(ScrollPerPixel); 319 setHorizontalScrollMode(ScrollPerPixel); 320 |
330 setHeaderLabels(QStringList() << _("Option") << _("Name") << "N" << "M" << "Y" << _("Value")); | 321 setHeaderLabels(QStringList() << "Option" << "Name" << "N" << "M" << "Y" << "Value"); |
331 332 connect(this, SIGNAL(itemSelectionChanged(void)), 333 SLOT(updateSelection(void))); 334 335 if (name) { 336 configSettings->beginGroup(name); 337 showName = configSettings->value("/showName", false).toBool(); 338 showRange = configSettings->value("/showRange", false).toBool(); --- 539 unchanged lines hidden (view full) --- 878 879void ConfigList::contextMenuEvent(QContextMenuEvent *e) 880{ 881 if (e->y() <= header()->geometry().bottom()) { 882 if (!headerPopup) { 883 QAction *action; 884 885 headerPopup = new QMenu(this); | 322 323 connect(this, SIGNAL(itemSelectionChanged(void)), 324 SLOT(updateSelection(void))); 325 326 if (name) { 327 configSettings->beginGroup(name); 328 showName = configSettings->value("/showName", false).toBool(); 329 showRange = configSettings->value("/showRange", false).toBool(); --- 539 unchanged lines hidden (view full) --- 869 870void ConfigList::contextMenuEvent(QContextMenuEvent *e) 871{ 872 if (e->y() <= header()->geometry().bottom()) { 873 if (!headerPopup) { 874 QAction *action; 875 876 headerPopup = new QMenu(this); |
886 action = new QAction(_("Show Name"), this); | 877 action = new QAction("Show Name", this); |
887 action->setCheckable(true); 888 connect(action, SIGNAL(toggled(bool)), 889 parent(), SLOT(setShowName(bool))); 890 connect(parent(), SIGNAL(showNameChanged(bool)), 891 action, SLOT(setOn(bool))); 892 action->setChecked(showName); 893 headerPopup->addAction(action); | 878 action->setCheckable(true); 879 connect(action, SIGNAL(toggled(bool)), 880 parent(), SLOT(setShowName(bool))); 881 connect(parent(), SIGNAL(showNameChanged(bool)), 882 action, SLOT(setOn(bool))); 883 action->setChecked(showName); 884 headerPopup->addAction(action); |
894 action = new QAction(_("Show Range"), this); | 885 action = new QAction("Show Range", this); |
895 action->setCheckable(true); 896 connect(action, SIGNAL(toggled(bool)), 897 parent(), SLOT(setShowRange(bool))); 898 connect(parent(), SIGNAL(showRangeChanged(bool)), 899 action, SLOT(setOn(bool))); 900 action->setChecked(showRange); 901 headerPopup->addAction(action); | 886 action->setCheckable(true); 887 connect(action, SIGNAL(toggled(bool)), 888 parent(), SLOT(setShowRange(bool))); 889 connect(parent(), SIGNAL(showRangeChanged(bool)), 890 action, SLOT(setOn(bool))); 891 action->setChecked(showRange); 892 headerPopup->addAction(action); |
902 action = new QAction(_("Show Data"), this); | 893 action = new QAction("Show Data", this); |
903 action->setCheckable(true); 904 connect(action, SIGNAL(toggled(bool)), 905 parent(), SLOT(setShowData(bool))); 906 connect(parent(), SIGNAL(showDataChanged(bool)), 907 action, SLOT(setOn(bool))); 908 action->setChecked(showData); 909 headerPopup->addAction(action); 910 } --- 170 unchanged lines hidden (view full) --- 1081{ 1082 struct symbol* sym; 1083 QString head, debug, help; 1084 1085 sym = _menu->sym; 1086 if (sym) { 1087 if (_menu->prompt) { 1088 head += "<big><b>"; | 894 action->setCheckable(true); 895 connect(action, SIGNAL(toggled(bool)), 896 parent(), SLOT(setShowData(bool))); 897 connect(parent(), SIGNAL(showDataChanged(bool)), 898 action, SLOT(setOn(bool))); 899 action->setChecked(showData); 900 headerPopup->addAction(action); 901 } --- 170 unchanged lines hidden (view full) --- 1072{ 1073 struct symbol* sym; 1074 QString head, debug, help; 1075 1076 sym = _menu->sym; 1077 if (sym) { 1078 if (_menu->prompt) { 1079 head += "<big><b>"; |
1089 head += print_filter(_(_menu->prompt->text)); | 1080 head += print_filter(_menu->prompt->text); |
1090 head += "</b></big>"; 1091 if (sym->name) { 1092 head += " ("; 1093 if (showDebug()) 1094 head += QString().sprintf("<a href=\"s%p\">", sym); 1095 head += print_filter(sym->name); 1096 if (showDebug()) 1097 head += "</a>"; --- 14 unchanged lines hidden (view full) --- 1112 debug = debug_info(sym); 1113 1114 struct gstr help_gstr = str_new(); 1115 menu_get_ext_help(_menu, &help_gstr); 1116 help = print_filter(str_get(&help_gstr)); 1117 str_free(&help_gstr); 1118 } else if (_menu->prompt) { 1119 head += "<big><b>"; | 1081 head += "</b></big>"; 1082 if (sym->name) { 1083 head += " ("; 1084 if (showDebug()) 1085 head += QString().sprintf("<a href=\"s%p\">", sym); 1086 head += print_filter(sym->name); 1087 if (showDebug()) 1088 head += "</a>"; --- 14 unchanged lines hidden (view full) --- 1103 debug = debug_info(sym); 1104 1105 struct gstr help_gstr = str_new(); 1106 menu_get_ext_help(_menu, &help_gstr); 1107 help = print_filter(str_get(&help_gstr)); 1108 str_free(&help_gstr); 1109 } else if (_menu->prompt) { 1110 head += "<big><b>"; |
1120 head += print_filter(_(_menu->prompt->text)); | 1111 head += print_filter(_menu->prompt->text); |
1121 head += "</b></big><br><br>"; 1122 if (showDebug()) { 1123 if (_menu->prompt->visible.expr) { 1124 debug += " dep: "; 1125 expr_print(_menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); 1126 debug += "<br><br>"; 1127 } 1128 } --- 18 unchanged lines hidden (view full) --- 1147 expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE); 1148 debug += "<br>"; 1149 } 1150 for (struct property *prop = sym->prop; prop; prop = prop->next) { 1151 switch (prop->type) { 1152 case P_PROMPT: 1153 case P_MENU: 1154 debug += QString().sprintf("prompt: <a href=\"m%p\">", prop->menu); | 1112 head += "</b></big><br><br>"; 1113 if (showDebug()) { 1114 if (_menu->prompt->visible.expr) { 1115 debug += " dep: "; 1116 expr_print(_menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); 1117 debug += "<br><br>"; 1118 } 1119 } --- 18 unchanged lines hidden (view full) --- 1138 expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE); 1139 debug += "<br>"; 1140 } 1141 for (struct property *prop = sym->prop; prop; prop = prop->next) { 1142 switch (prop->type) { 1143 case P_PROMPT: 1144 case P_MENU: 1145 debug += QString().sprintf("prompt: <a href=\"m%p\">", prop->menu); |
1155 debug += print_filter(_(prop->text)); | 1146 debug += print_filter(prop->text); |
1156 debug += "</a><br>"; 1157 break; 1158 case P_DEFAULT: 1159 case P_SELECT: 1160 case P_RANGE: 1161 case P_ENV: 1162 debug += prop_get_type_name(prop->type); 1163 debug += ": "; --- 65 unchanged lines hidden (view full) --- 1229 *text += "</a>"; 1230 } else 1231 *text += str2; 1232} 1233 1234QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) 1235{ 1236 QMenu* popup = Parent::createStandardContextMenu(pos); | 1147 debug += "</a><br>"; 1148 break; 1149 case P_DEFAULT: 1150 case P_SELECT: 1151 case P_RANGE: 1152 case P_ENV: 1153 debug += prop_get_type_name(prop->type); 1154 debug += ": "; --- 65 unchanged lines hidden (view full) --- 1220 *text += "</a>"; 1221 } else 1222 *text += str2; 1223} 1224 1225QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) 1226{ 1227 QMenu* popup = Parent::createStandardContextMenu(pos); |
1237 QAction* action = new QAction(_("Show Debug Info"), popup); | 1228 QAction* action = new QAction("Show Debug Info", popup); |
1238 action->setCheckable(true); 1239 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 1240 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); 1241 action->setChecked(showDebug()); 1242 popup->addSeparator(); 1243 popup->addAction(action); 1244 return popup; 1245} --- 10 unchanged lines hidden (view full) --- 1256 setWindowTitle("Search Config"); 1257 1258 QVBoxLayout* layout1 = new QVBoxLayout(this); 1259 layout1->setContentsMargins(11, 11, 11, 11); 1260 layout1->setSpacing(6); 1261 QHBoxLayout* layout2 = new QHBoxLayout(0); 1262 layout2->setContentsMargins(0, 0, 0, 0); 1263 layout2->setSpacing(6); | 1229 action->setCheckable(true); 1230 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 1231 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); 1232 action->setChecked(showDebug()); 1233 popup->addSeparator(); 1234 popup->addAction(action); 1235 return popup; 1236} --- 10 unchanged lines hidden (view full) --- 1247 setWindowTitle("Search Config"); 1248 1249 QVBoxLayout* layout1 = new QVBoxLayout(this); 1250 layout1->setContentsMargins(11, 11, 11, 11); 1251 layout1->setSpacing(6); 1252 QHBoxLayout* layout2 = new QHBoxLayout(0); 1253 layout2->setContentsMargins(0, 0, 0, 0); 1254 layout2->setSpacing(6); |
1264 layout2->addWidget(new QLabel(_("Find:"), this)); | 1255 layout2->addWidget(new QLabel("Find:", this)); |
1265 editField = new QLineEdit(this); 1266 connect(editField, SIGNAL(returnPressed()), SLOT(search())); 1267 layout2->addWidget(editField); | 1256 editField = new QLineEdit(this); 1257 connect(editField, SIGNAL(returnPressed()), SLOT(search())); 1258 layout2->addWidget(editField); |
1268 searchButton = new QPushButton(_("Search"), this); | 1259 searchButton = new QPushButton("Search", this); |
1269 searchButton->setAutoDefault(false); 1270 connect(searchButton, SIGNAL(clicked()), SLOT(search())); 1271 layout2->addWidget(searchButton); 1272 layout1->addLayout(layout2); 1273 1274 split = new QSplitter(this); 1275 split->setOrientation(Qt::Vertical); 1276 list = new ConfigView(split, name); --- 105 unchanged lines hidden (view full) --- 1382 1383 setTabOrder(configList, helpText); 1384 configList->setFocus(); 1385 1386 menu = menuBar(); 1387 toolBar = new QToolBar("Tools", this); 1388 addToolBar(toolBar); 1389 | 1260 searchButton->setAutoDefault(false); 1261 connect(searchButton, SIGNAL(clicked()), SLOT(search())); 1262 layout2->addWidget(searchButton); 1263 layout1->addLayout(layout2); 1264 1265 split = new QSplitter(this); 1266 split->setOrientation(Qt::Vertical); 1267 list = new ConfigView(split, name); --- 105 unchanged lines hidden (view full) --- 1373 1374 setTabOrder(configList, helpText); 1375 configList->setFocus(); 1376 1377 menu = menuBar(); 1378 toolBar = new QToolBar("Tools", this); 1379 addToolBar(toolBar); 1380 |
1390 backAction = new QAction(QPixmap(xpm_back), _("Back"), this); | 1381 backAction = new QAction(QPixmap(xpm_back), "Back", this); |
1391 connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack())); 1392 backAction->setEnabled(false); | 1382 connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack())); 1383 backAction->setEnabled(false); |
1393 QAction *quitAction = new QAction(_("&Quit"), this); | 1384 QAction *quitAction = new QAction("&Quit", this); |
1394 quitAction->setShortcut(Qt::CTRL + Qt::Key_Q); 1395 connect(quitAction, SIGNAL(triggered(bool)), SLOT(close())); | 1385 quitAction->setShortcut(Qt::CTRL + Qt::Key_Q); 1386 connect(quitAction, SIGNAL(triggered(bool)), SLOT(close())); |
1396 QAction *loadAction = new QAction(QPixmap(xpm_load), _("&Load"), this); | 1387 QAction *loadAction = new QAction(QPixmap(xpm_load), "&Load", this); |
1397 loadAction->setShortcut(Qt::CTRL + Qt::Key_L); 1398 connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig())); | 1388 loadAction->setShortcut(Qt::CTRL + Qt::Key_L); 1389 connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig())); |
1399 saveAction = new QAction(QPixmap(xpm_save), _("&Save"), this); | 1390 saveAction = new QAction(QPixmap(xpm_save), "&Save", this); |
1400 saveAction->setShortcut(Qt::CTRL + Qt::Key_S); 1401 connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig())); 1402 conf_set_changed_callback(conf_changed); 1403 // Set saveAction's initial state 1404 conf_changed(); | 1391 saveAction->setShortcut(Qt::CTRL + Qt::Key_S); 1392 connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig())); 1393 conf_set_changed_callback(conf_changed); 1394 // Set saveAction's initial state 1395 conf_changed(); |
1405 QAction *saveAsAction = new QAction(_("Save &As..."), this); | 1396 QAction *saveAsAction = new QAction("Save &As...", this); |
1406 connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs())); | 1397 connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs())); |
1407 QAction *searchAction = new QAction(_("&Find"), this); | 1398 QAction *searchAction = new QAction("&Find", this); |
1408 searchAction->setShortcut(Qt::CTRL + Qt::Key_F); 1409 connect(searchAction, SIGNAL(triggered(bool)), SLOT(searchConfig())); | 1399 searchAction->setShortcut(Qt::CTRL + Qt::Key_F); 1400 connect(searchAction, SIGNAL(triggered(bool)), SLOT(searchConfig())); |
1410 singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this); | 1401 singleViewAction = new QAction(QPixmap(xpm_single_view), "Single View", this); |
1411 singleViewAction->setCheckable(true); 1412 connect(singleViewAction, SIGNAL(triggered(bool)), SLOT(showSingleView())); | 1402 singleViewAction->setCheckable(true); 1403 connect(singleViewAction, SIGNAL(triggered(bool)), SLOT(showSingleView())); |
1413 splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this); | 1404 splitViewAction = new QAction(QPixmap(xpm_split_view), "Split View", this); |
1414 splitViewAction->setCheckable(true); 1415 connect(splitViewAction, SIGNAL(triggered(bool)), SLOT(showSplitView())); | 1405 splitViewAction->setCheckable(true); 1406 connect(splitViewAction, SIGNAL(triggered(bool)), SLOT(showSplitView())); |
1416 fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this); | 1407 fullViewAction = new QAction(QPixmap(xpm_tree_view), "Full View", this); |
1417 fullViewAction->setCheckable(true); 1418 connect(fullViewAction, SIGNAL(triggered(bool)), SLOT(showFullView())); 1419 | 1408 fullViewAction->setCheckable(true); 1409 connect(fullViewAction, SIGNAL(triggered(bool)), SLOT(showFullView())); 1410 |
1420 QAction *showNameAction = new QAction(_("Show Name"), this); | 1411 QAction *showNameAction = new QAction("Show Name", this); |
1421 showNameAction->setCheckable(true); 1422 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); 1423 showNameAction->setChecked(configView->showName()); | 1412 showNameAction->setCheckable(true); 1413 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); 1414 showNameAction->setChecked(configView->showName()); |
1424 QAction *showRangeAction = new QAction(_("Show Range"), this); | 1415 QAction *showRangeAction = new QAction("Show Range", this); |
1425 showRangeAction->setCheckable(true); 1426 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); | 1416 showRangeAction->setCheckable(true); 1417 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); |
1427 QAction *showDataAction = new QAction(_("Show Data"), this); | 1418 QAction *showDataAction = new QAction("Show Data", this); |
1428 showDataAction->setCheckable(true); 1429 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); 1430 1431 QActionGroup *optGroup = new QActionGroup(this); 1432 optGroup->setExclusive(true); 1433 connect(optGroup, SIGNAL(triggered(QAction*)), configView, 1434 SLOT(setOptionMode(QAction *))); 1435 connect(optGroup, SIGNAL(triggered(QAction *)), menuView, 1436 SLOT(setOptionMode(QAction *))); 1437 | 1419 showDataAction->setCheckable(true); 1420 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); 1421 1422 QActionGroup *optGroup = new QActionGroup(this); 1423 optGroup->setExclusive(true); 1424 connect(optGroup, SIGNAL(triggered(QAction*)), configView, 1425 SLOT(setOptionMode(QAction *))); 1426 connect(optGroup, SIGNAL(triggered(QAction *)), menuView, 1427 SLOT(setOptionMode(QAction *))); 1428 |
1438 configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup); 1439 configView->showAllAction = new QAction(_("Show All Options"), optGroup); 1440 configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup); | 1429 configView->showNormalAction = new QAction("Show Normal Options", optGroup); 1430 configView->showAllAction = new QAction("Show All Options", optGroup); 1431 configView->showPromptAction = new QAction("Show Prompt Options", optGroup); |
1441 configView->showNormalAction->setCheckable(true); 1442 configView->showAllAction->setCheckable(true); 1443 configView->showPromptAction->setCheckable(true); 1444 | 1432 configView->showNormalAction->setCheckable(true); 1433 configView->showAllAction->setCheckable(true); 1434 configView->showPromptAction->setCheckable(true); 1435 |
1445 QAction *showDebugAction = new QAction( _("Show Debug Info"), this); | 1436 QAction *showDebugAction = new QAction("Show Debug Info", this); |
1446 showDebugAction->setCheckable(true); 1447 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); 1448 showDebugAction->setChecked(helpText->showDebug()); 1449 | 1437 showDebugAction->setCheckable(true); 1438 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); 1439 showDebugAction->setChecked(helpText->showDebug()); 1440 |
1450 QAction *showIntroAction = new QAction( _("Introduction"), this); | 1441 QAction *showIntroAction = new QAction("Introduction", this); |
1451 connect(showIntroAction, SIGNAL(triggered(bool)), SLOT(showIntro())); | 1442 connect(showIntroAction, SIGNAL(triggered(bool)), SLOT(showIntro())); |
1452 QAction *showAboutAction = new QAction( _("About"), this); | 1443 QAction *showAboutAction = new QAction("About", this); |
1453 connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout())); 1454 1455 // init tool bar 1456 toolBar->addAction(backAction); 1457 toolBar->addSeparator(); 1458 toolBar->addAction(loadAction); 1459 toolBar->addAction(saveAction); 1460 toolBar->addSeparator(); 1461 toolBar->addAction(singleViewAction); 1462 toolBar->addAction(splitViewAction); 1463 toolBar->addAction(fullViewAction); 1464 1465 // create config menu | 1444 connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout())); 1445 1446 // init tool bar 1447 toolBar->addAction(backAction); 1448 toolBar->addSeparator(); 1449 toolBar->addAction(loadAction); 1450 toolBar->addAction(saveAction); 1451 toolBar->addSeparator(); 1452 toolBar->addAction(singleViewAction); 1453 toolBar->addAction(splitViewAction); 1454 toolBar->addAction(fullViewAction); 1455 1456 // create config menu |
1466 QMenu* config = menu->addMenu(_("&File")); | 1457 QMenu* config = menu->addMenu("&File"); |
1467 config->addAction(loadAction); 1468 config->addAction(saveAction); 1469 config->addAction(saveAsAction); 1470 config->addSeparator(); 1471 config->addAction(quitAction); 1472 1473 // create edit menu | 1458 config->addAction(loadAction); 1459 config->addAction(saveAction); 1460 config->addAction(saveAsAction); 1461 config->addSeparator(); 1462 config->addAction(quitAction); 1463 1464 // create edit menu |
1474 QMenu* editMenu = menu->addMenu(_("&Edit")); | 1465 QMenu* editMenu = menu->addMenu("&Edit"); |
1475 editMenu->addAction(searchAction); 1476 1477 // create options menu | 1466 editMenu->addAction(searchAction); 1467 1468 // create options menu |
1478 QMenu* optionMenu = menu->addMenu(_("&Option")); | 1469 QMenu* optionMenu = menu->addMenu("&Option"); |
1479 optionMenu->addAction(showNameAction); 1480 optionMenu->addAction(showRangeAction); 1481 optionMenu->addAction(showDataAction); 1482 optionMenu->addSeparator(); 1483 optionMenu->addActions(optGroup->actions()); 1484 optionMenu->addSeparator(); 1485 optionMenu->addAction(showDebugAction); 1486 1487 // create help menu 1488 menu->addSeparator(); | 1470 optionMenu->addAction(showNameAction); 1471 optionMenu->addAction(showRangeAction); 1472 optionMenu->addAction(showDataAction); 1473 optionMenu->addSeparator(); 1474 optionMenu->addActions(optGroup->actions()); 1475 optionMenu->addSeparator(); 1476 optionMenu->addAction(showDebugAction); 1477 1478 // create help menu 1479 menu->addSeparator(); |
1489 QMenu* helpMenu = menu->addMenu(_("&Help")); | 1480 QMenu* helpMenu = menu->addMenu("&Help"); |
1490 helpMenu->addAction(showIntroAction); 1491 helpMenu->addAction(showAboutAction); 1492 1493 connect(configList, SIGNAL(menuChanged(struct menu *)), 1494 helpText, SLOT(setInfo(struct menu *))); 1495 connect(configList, SIGNAL(menuSelected(struct menu *)), 1496 SLOT(changeMenu(struct menu *))); 1497 connect(configList, SIGNAL(parentSelected()), --- 31 unchanged lines hidden (view full) --- 1529} 1530 1531void ConfigMainWindow::loadConfig(void) 1532{ 1533 QString s = QFileDialog::getOpenFileName(this, "", conf_get_configname()); 1534 if (s.isNull()) 1535 return; 1536 if (conf_read(QFile::encodeName(s))) | 1481 helpMenu->addAction(showIntroAction); 1482 helpMenu->addAction(showAboutAction); 1483 1484 connect(configList, SIGNAL(menuChanged(struct menu *)), 1485 helpText, SLOT(setInfo(struct menu *))); 1486 connect(configList, SIGNAL(menuSelected(struct menu *)), 1487 SLOT(changeMenu(struct menu *))); 1488 connect(configList, SIGNAL(parentSelected()), --- 31 unchanged lines hidden (view full) --- 1520} 1521 1522void ConfigMainWindow::loadConfig(void) 1523{ 1524 QString s = QFileDialog::getOpenFileName(this, "", conf_get_configname()); 1525 if (s.isNull()) 1526 return; 1527 if (conf_read(QFile::encodeName(s))) |
1537 QMessageBox::information(this, "qconf", _("Unable to load configuration!")); | 1528 QMessageBox::information(this, "qconf", "Unable to load configuration!"); |
1538 ConfigView::updateListAll(); 1539} 1540 1541bool ConfigMainWindow::saveConfig(void) 1542{ 1543 if (conf_write(NULL)) { | 1529 ConfigView::updateListAll(); 1530} 1531 1532bool ConfigMainWindow::saveConfig(void) 1533{ 1534 if (conf_write(NULL)) { |
1544 QMessageBox::information(this, "qconf", _("Unable to save configuration!")); | 1535 QMessageBox::information(this, "qconf", "Unable to save configuration!"); |
1545 return false; 1546 } 1547 return true; 1548} 1549 1550void ConfigMainWindow::saveConfigAs(void) 1551{ 1552 QString s = QFileDialog::getSaveFileName(this, "", conf_get_configname()); --- 165 unchanged lines hidden (view full) --- 1718 * TODO ask only when something changed 1719 */ 1720void ConfigMainWindow::closeEvent(QCloseEvent* e) 1721{ 1722 if (!conf_get_changed()) { 1723 e->accept(); 1724 return; 1725 } | 1536 return false; 1537 } 1538 return true; 1539} 1540 1541void ConfigMainWindow::saveConfigAs(void) 1542{ 1543 QString s = QFileDialog::getSaveFileName(this, "", conf_get_configname()); --- 165 unchanged lines hidden (view full) --- 1709 * TODO ask only when something changed 1710 */ 1711void ConfigMainWindow::closeEvent(QCloseEvent* e) 1712{ 1713 if (!conf_get_changed()) { 1714 e->accept(); 1715 return; 1716 } |
1726 QMessageBox mb("qconf", _("Save configuration?"), QMessageBox::Warning, | 1717 QMessageBox mb("qconf", "Save configuration?", QMessageBox::Warning, |
1727 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); | 1718 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); |
1728 mb.setButtonText(QMessageBox::Yes, _("&Save Changes")); 1729 mb.setButtonText(QMessageBox::No, _("&Discard Changes")); 1730 mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); | 1719 mb.setButtonText(QMessageBox::Yes, "&Save Changes"); 1720 mb.setButtonText(QMessageBox::No, "&Discard Changes"); 1721 mb.setButtonText(QMessageBox::Cancel, "Cancel Exit"); |
1731 switch (mb.exec()) { 1732 case QMessageBox::Yes: 1733 if (saveConfig()) 1734 e->accept(); 1735 else 1736 e->ignore(); 1737 break; 1738 case QMessageBox::No: 1739 e->accept(); 1740 break; 1741 case QMessageBox::Cancel: 1742 e->ignore(); 1743 break; 1744 } 1745} 1746 1747void ConfigMainWindow::showIntro(void) 1748{ | 1722 switch (mb.exec()) { 1723 case QMessageBox::Yes: 1724 if (saveConfig()) 1725 e->accept(); 1726 else 1727 e->ignore(); 1728 break; 1729 case QMessageBox::No: 1730 e->accept(); 1731 break; 1732 case QMessageBox::Cancel: 1733 e->ignore(); 1734 break; 1735 } 1736} 1737 1738void ConfigMainWindow::showIntro(void) 1739{ |
1749 static const QString str = _("Welcome to the qconf graphical configuration tool.\n\n" | 1740 static const QString str = "Welcome to the qconf graphical configuration tool.\n\n" |
1750 "For each option, a blank box indicates the feature is disabled, a check\n" 1751 "indicates it is enabled, and a dot indicates that it is to be compiled\n" 1752 "as a module. Clicking on the box will cycle through the three states.\n\n" 1753 "If you do not see an option (e.g., a device driver) that you believe\n" 1754 "should be present, try turning on Show All Options under the Options menu.\n" 1755 "Although there is no cross reference yet to help you figure out what other\n" 1756 "options must be enabled to support the option you are interested in, you can\n" 1757 "still view the help of a grayed-out option.\n\n" 1758 "Toggling Show Debug Info under the Options menu will show the dependencies,\n" | 1741 "For each option, a blank box indicates the feature is disabled, a check\n" 1742 "indicates it is enabled, and a dot indicates that it is to be compiled\n" 1743 "as a module. Clicking on the box will cycle through the three states.\n\n" 1744 "If you do not see an option (e.g., a device driver) that you believe\n" 1745 "should be present, try turning on Show All Options under the Options menu.\n" 1746 "Although there is no cross reference yet to help you figure out what other\n" 1747 "options must be enabled to support the option you are interested in, you can\n" 1748 "still view the help of a grayed-out option.\n\n" 1749 "Toggling Show Debug Info under the Options menu will show the dependencies,\n" |
1759 "which you can then match by examining other options.\n\n"); | 1750 "which you can then match by examining other options.\n\n"; |
1760 1761 QMessageBox::information(this, "qconf", str); 1762} 1763 1764void ConfigMainWindow::showAbout(void) 1765{ | 1751 1752 QMessageBox::information(this, "qconf", str); 1753} 1754 1755void ConfigMainWindow::showAbout(void) 1756{ |
1766 static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n" | 1757 static const QString str = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n" |
1767 "Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>.\n\n" | 1758 "Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>.\n\n" |
1768 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"); | 1759 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"; |
1769 1770 QMessageBox::information(this, "qconf", str); 1771} 1772 1773void ConfigMainWindow::saveSettings(void) 1774{ 1775 configSettings->setValue("/window x", pos().x()); 1776 configSettings->setValue("/window y", pos().y()); --- 44 unchanged lines hidden (view full) --- 1821 fixup_rootmenu(child); 1822 } 1823} 1824 1825static const char *progname; 1826 1827static void usage(void) 1828{ | 1760 1761 QMessageBox::information(this, "qconf", str); 1762} 1763 1764void ConfigMainWindow::saveSettings(void) 1765{ 1766 configSettings->setValue("/window x", pos().x()); 1767 configSettings->setValue("/window y", pos().y()); --- 44 unchanged lines hidden (view full) --- 1812 fixup_rootmenu(child); 1813 } 1814} 1815 1816static const char *progname; 1817 1818static void usage(void) 1819{ |
1829 printf(_("%s [-s] <config>\n").toLatin1().constData(), progname); | 1820 printf("%s [-s] <config>\n", progname); |
1830 exit(0); 1831} 1832 1833int main(int ac, char** av) 1834{ 1835 ConfigMainWindow* v; 1836 const char *name; 1837 | 1821 exit(0); 1822} 1823 1824int main(int ac, char** av) 1825{ 1826 ConfigMainWindow* v; 1827 const char *name; 1828 |
1838 bindtextdomain(PACKAGE, LOCALEDIR); 1839 textdomain(PACKAGE); 1840 | |
1841 progname = av[0]; 1842 configApp = new QApplication(ac, av); 1843 if (ac > 1 && av[1][0] == '-') { 1844 switch (av[1][1]) { 1845 case 's': 1846 conf_set_message_callback(NULL); 1847 break; 1848 case 'h': --- 31 unchanged lines hidden --- | 1829 progname = av[0]; 1830 configApp = new QApplication(ac, av); 1831 if (ac > 1 && av[1][0] == '-') { 1832 switch (av[1][1]) { 1833 case 's': 1834 conf_set_message_callback(NULL); 1835 break; 1836 case 'h': --- 31 unchanged lines hidden --- |