qconf.cc (daab7fc734a53fdeaf844b7c03053118ad1769da) | qconf.cc (133c5f7c10e4552ba41bcf03b9bda6c4e3413804) |
---|---|
1/* 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Released under the terms of the GNU GPL v2.0. 4 */ 5 | 1/* 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Released under the terms of the GNU GPL v2.0. 4 */ 5 |
6#include <qapplication.h> | 6#include <qglobal.h> 7 8#if QT_VERSION < 0x040000 |
7#include <qmainwindow.h> | 9#include <qmainwindow.h> |
10#include <qvbox.h> 11#include <qvaluelist.h> 12#include <qtextbrowser.h> 13#include <qaction.h> 14#include <qheader.h> 15#include <qfiledialog.h> 16#include <qdragobject.h> 17#include <qpopupmenu.h> 18#else 19#include <q3mainwindow.h> 20#include <q3vbox.h> 21#include <q3valuelist.h> 22#include <q3textbrowser.h> 23#include <q3action.h> 24#include <q3header.h> 25#include <q3filedialog.h> 26#include <q3dragobject.h> 27#include <q3popupmenu.h> 28#endif 29 30#include <qapplication.h> |
|
8#include <qdesktopwidget.h> 9#include <qtoolbar.h> 10#include <qlayout.h> | 31#include <qdesktopwidget.h> 32#include <qtoolbar.h> 33#include <qlayout.h> |
11#include <qvbox.h> | |
12#include <qsplitter.h> | 34#include <qsplitter.h> |
13#include <qlistview.h> 14#include <qtextbrowser.h> | |
15#include <qlineedit.h> 16#include <qlabel.h> 17#include <qpushbutton.h> 18#include <qmenubar.h> 19#include <qmessagebox.h> | 35#include <qlineedit.h> 36#include <qlabel.h> 37#include <qpushbutton.h> 38#include <qmenubar.h> 39#include <qmessagebox.h> |
20#include <qaction.h> 21#include <qheader.h> 22#include <qfiledialog.h> 23#include <qdragobject.h> | |
24#include <qregexp.h> | 40#include <qregexp.h> |
41#include <qevent.h> |
|
25 26#include <stdlib.h> 27 28#include "lkc.h" 29#include "qconf.h" 30 31#include "qconf.moc" 32#include "images.c" 33 34#ifdef _ 35# undef _ 36# define _ qgettext 37#endif 38 39static QApplication *configApp; 40static ConfigSettings *configSettings; 41 | 42 43#include <stdlib.h> 44 45#include "lkc.h" 46#include "qconf.h" 47 48#include "qconf.moc" 49#include "images.c" 50 51#ifdef _ 52# undef _ 53# define _ qgettext 54#endif 55 56static QApplication *configApp; 57static ConfigSettings *configSettings; 58 |
42QAction *ConfigMainWindow::saveAction; | 59Q3Action *ConfigMainWindow::saveAction; |
43 44static inline QString qgettext(const char* str) 45{ 46 return QString::fromLocal8Bit(gettext(str)); 47} 48 49static inline QString qgettext(const QString& str) 50{ 51 return QString::fromLocal8Bit(gettext(str.latin1())); 52} 53 54/** 55 * Reads a list of integer values from the application settings. 56 */ | 60 61static inline QString qgettext(const char* str) 62{ 63 return QString::fromLocal8Bit(gettext(str)); 64} 65 66static inline QString qgettext(const QString& str) 67{ 68 return QString::fromLocal8Bit(gettext(str.latin1())); 69} 70 71/** 72 * Reads a list of integer values from the application settings. 73 */ |
57QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) | 74Q3ValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) |
58{ | 75{ |
59 QValueList<int> result; | 76 Q3ValueList<int> result; |
60 QStringList entryList = readListEntry(key, ok); 61 QStringList::Iterator it; 62 63 for (it = entryList.begin(); it != entryList.end(); ++it) 64 result.push_back((*it).toInt()); 65 66 return result; 67} 68 69/** 70 * Writes a list of integer values to the application settings. 71 */ | 77 QStringList entryList = readListEntry(key, ok); 78 QStringList::Iterator it; 79 80 for (it = entryList.begin(); it != entryList.end(); ++it) 81 result.push_back((*it).toInt()); 82 83 return result; 84} 85 86/** 87 * Writes a list of integer values to the application settings. 88 */ |
72bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value) | 89bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList<int>& value) |
73{ 74 QStringList stringList; | 90{ 91 QStringList stringList; |
75 QValueList<int>::ConstIterator it; | 92 Q3ValueList<int>::ConstIterator it; |
76 77 for (it = value.begin(); it != value.end(); ++it) 78 stringList.push_back(QString::number(*it)); 79 return writeEntry(key, stringList); 80} 81 82 | 93 94 for (it = value.begin(); it != value.end(); ++it) 95 stringList.push_back(QString::number(*it)); 96 return writeEntry(key, stringList); 97} 98 99 |
83#if QT_VERSION >= 300 | |
84/* 85 * set the new data 86 * TODO check the value 87 */ 88void ConfigItem::okRename(int col) 89{ 90 Parent::okRename(col); 91 sym_set_string_value(menu->sym, text(dataColIdx).latin1()); 92 listView()->updateList(this); 93} | 100/* 101 * set the new data 102 * TODO check the value 103 */ 104void ConfigItem::okRename(int col) 105{ 106 Parent::okRename(col); 107 sym_set_string_value(menu->sym, text(dataColIdx).latin1()); 108 listView()->updateList(this); 109} |
94#endif | |
95 96/* 97 * update the displayed of a menu entry 98 */ 99void ConfigItem::updateMenu(void) 100{ 101 ConfigList* list; 102 struct symbol* sym; --- 87 unchanged lines hidden (view full) --- 190 break; 191 case S_INT: 192 case S_HEX: 193 case S_STRING: 194 const char* data; 195 196 data = sym_get_string_value(sym); 197 | 110 111/* 112 * update the displayed of a menu entry 113 */ 114void ConfigItem::updateMenu(void) 115{ 116 ConfigList* list; 117 struct symbol* sym; --- 87 unchanged lines hidden (view full) --- 205 break; 206 case S_INT: 207 case S_HEX: 208 case S_STRING: 209 const char* data; 210 211 data = sym_get_string_value(sym); 212 |
198#if QT_VERSION >= 300 | |
199 int i = list->mapIdx(dataColIdx); 200 if (i >= 0) 201 setRenameEnabled(i, TRUE); | 213 int i = list->mapIdx(dataColIdx); 214 if (i >= 0) 215 setRenameEnabled(i, TRUE); |
202#endif | |
203 setText(dataColIdx, data); 204 if (type == S_STRING) 205 prompt = QString("%1: %2").arg(prompt).arg(data); 206 else 207 prompt = QString("(%2) %1").arg(prompt).arg(data); 208 break; 209 } 210 if (!sym_has_value(sym) && visible) --- 216 unchanged lines hidden (view full) --- 427 428void ConfigList::updateList(ConfigItem* item) 429{ 430 ConfigItem* last = 0; 431 432 if (!rootEntry) { 433 if (mode != listMode) 434 goto update; | 216 setText(dataColIdx, data); 217 if (type == S_STRING) 218 prompt = QString("%1: %2").arg(prompt).arg(data); 219 else 220 prompt = QString("(%2) %1").arg(prompt).arg(data); 221 break; 222 } 223 if (!sym_has_value(sym) && visible) --- 216 unchanged lines hidden (view full) --- 440 441void ConfigList::updateList(ConfigItem* item) 442{ 443 ConfigItem* last = 0; 444 445 if (!rootEntry) { 446 if (mode != listMode) 447 goto update; |
435 QListViewItemIterator it(this); | 448 Q3ListViewItemIterator it(this); |
436 ConfigItem* item; 437 438 for (; it.current(); ++it) { 439 item = (ConfigItem*)it.current(); 440 if (!item->menu) 441 continue; 442 item->testUpdateMenu(menu_is_visible(item->menu)); 443 } --- 78 unchanged lines hidden (view full) --- 522 item->setOpen(TRUE); 523 } 524 if (oldexpr != newexpr) 525 parent()->updateList(item); 526 break; 527 case S_INT: 528 case S_HEX: 529 case S_STRING: | 449 ConfigItem* item; 450 451 for (; it.current(); ++it) { 452 item = (ConfigItem*)it.current(); 453 if (!item->menu) 454 continue; 455 item->testUpdateMenu(menu_is_visible(item->menu)); 456 } --- 78 unchanged lines hidden (view full) --- 535 item->setOpen(TRUE); 536 } 537 if (oldexpr != newexpr) 538 parent()->updateList(item); 539 break; 540 case S_INT: 541 case S_HEX: 542 case S_STRING: |
530#if QT_VERSION >= 300 | |
531 if (colMap[dataColIdx] >= 0) 532 item->startRename(colMap[dataColIdx]); 533 else | 543 if (colMap[dataColIdx] >= 0) 544 item->startRename(colMap[dataColIdx]); 545 else |
534#endif | |
535 parent()->lineEdit->show(item); 536 break; 537 } 538} 539 540void ConfigList::setRootMenu(struct menu *menu) 541{ 542 enum prop_type type; --- 15 unchanged lines hidden (view full) --- 558 ConfigItem* item; 559 struct menu *oldroot; 560 561 oldroot = rootEntry; 562 if (rootEntry == &rootmenu) 563 return; 564 setRootMenu(menu_get_parent_menu(rootEntry->parent)); 565 | 546 parent()->lineEdit->show(item); 547 break; 548 } 549} 550 551void ConfigList::setRootMenu(struct menu *menu) 552{ 553 enum prop_type type; --- 15 unchanged lines hidden (view full) --- 569 ConfigItem* item; 570 struct menu *oldroot; 571 572 oldroot = rootEntry; 573 if (rootEntry == &rootmenu) 574 return; 575 setRootMenu(menu_get_parent_menu(rootEntry->parent)); 576 |
566 QListViewItemIterator it(this); | 577 Q3ListViewItemIterator it(this); |
567 for (; (item = (ConfigItem*)it.current()); it++) { 568 if (item->menu == oldroot) { 569 setCurrentItem(item); 570 ensureItemVisible(item); 571 break; 572 } 573 } 574} --- 65 unchanged lines hidden (view full) --- 640 last = last->nextSibling(); 641 delete item; 642 } 643 } 644} 645 646void ConfigList::keyPressEvent(QKeyEvent* ev) 647{ | 578 for (; (item = (ConfigItem*)it.current()); it++) { 579 if (item->menu == oldroot) { 580 setCurrentItem(item); 581 ensureItemVisible(item); 582 break; 583 } 584 } 585} --- 65 unchanged lines hidden (view full) --- 651 last = last->nextSibling(); 652 delete item; 653 } 654 } 655} 656 657void ConfigList::keyPressEvent(QKeyEvent* ev) 658{ |
648 QListViewItem* i = currentItem(); | 659 Q3ListViewItem* i = currentItem(); |
649 ConfigItem* item; 650 struct menu *menu; 651 enum prop_type type; 652 653 if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) { 654 emit parentSelected(); 655 ev->accept(); 656 return; --- 149 unchanged lines hidden (view full) --- 806 } 807 emit gotFocus(menu); 808} 809 810void ConfigList::contextMenuEvent(QContextMenuEvent *e) 811{ 812 if (e->y() <= header()->geometry().bottom()) { 813 if (!headerPopup) { | 660 ConfigItem* item; 661 struct menu *menu; 662 enum prop_type type; 663 664 if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) { 665 emit parentSelected(); 666 ev->accept(); 667 return; --- 149 unchanged lines hidden (view full) --- 817 } 818 emit gotFocus(menu); 819} 820 821void ConfigList::contextMenuEvent(QContextMenuEvent *e) 822{ 823 if (e->y() <= header()->geometry().bottom()) { 824 if (!headerPopup) { |
814 QAction *action; | 825 Q3Action *action; |
815 | 826 |
816 headerPopup = new QPopupMenu(this); 817 action = new QAction(NULL, _("Show Name"), 0, this); | 827 headerPopup = new Q3PopupMenu(this); 828 action = new Q3Action(NULL, _("Show Name"), 0, this); |
818 action->setToggleAction(TRUE); 819 connect(action, SIGNAL(toggled(bool)), 820 parent(), SLOT(setShowName(bool))); 821 connect(parent(), SIGNAL(showNameChanged(bool)), 822 action, SLOT(setOn(bool))); 823 action->setOn(showName); 824 action->addTo(headerPopup); | 829 action->setToggleAction(TRUE); 830 connect(action, SIGNAL(toggled(bool)), 831 parent(), SLOT(setShowName(bool))); 832 connect(parent(), SIGNAL(showNameChanged(bool)), 833 action, SLOT(setOn(bool))); 834 action->setOn(showName); 835 action->addTo(headerPopup); |
825 action = new QAction(NULL, _("Show Range"), 0, this); | 836 action = new Q3Action(NULL, _("Show Range"), 0, this); |
826 action->setToggleAction(TRUE); 827 connect(action, SIGNAL(toggled(bool)), 828 parent(), SLOT(setShowRange(bool))); 829 connect(parent(), SIGNAL(showRangeChanged(bool)), 830 action, SLOT(setOn(bool))); 831 action->setOn(showRange); 832 action->addTo(headerPopup); | 837 action->setToggleAction(TRUE); 838 connect(action, SIGNAL(toggled(bool)), 839 parent(), SLOT(setShowRange(bool))); 840 connect(parent(), SIGNAL(showRangeChanged(bool)), 841 action, SLOT(setOn(bool))); 842 action->setOn(showRange); 843 action->addTo(headerPopup); |
833 action = new QAction(NULL, _("Show Data"), 0, this); | 844 action = new Q3Action(NULL, _("Show Data"), 0, this); |
834 action->setToggleAction(TRUE); 835 connect(action, SIGNAL(toggled(bool)), 836 parent(), SLOT(setShowData(bool))); 837 connect(parent(), SIGNAL(showDataChanged(bool)), 838 action, SLOT(setOn(bool))); 839 action->setOn(showData); 840 action->addTo(headerPopup); 841 } --- 67 unchanged lines hidden (view full) --- 909 list->showData = b; 910 list->reinit(); 911 emit showDataChanged(b); 912 } 913} 914 915void ConfigList::setAllOpen(bool open) 916{ | 845 action->setToggleAction(TRUE); 846 connect(action, SIGNAL(toggled(bool)), 847 parent(), SLOT(setShowData(bool))); 848 connect(parent(), SIGNAL(showDataChanged(bool)), 849 action, SLOT(setOn(bool))); 850 action->setOn(showData); 851 action->addTo(headerPopup); 852 } --- 67 unchanged lines hidden (view full) --- 920 list->showData = b; 921 list->reinit(); 922 emit showDataChanged(b); 923 } 924} 925 926void ConfigList::setAllOpen(bool open) 927{ |
917 QListViewItemIterator it(this); | 928 Q3ListViewItemIterator it(this); |
918 919 for (; it.current(); it++) 920 it.current()->setOpen(open); 921} 922 923void ConfigView::updateList(ConfigItem* item) 924{ 925 ConfigView* v; --- 6 unchanged lines hidden (view full) --- 932{ 933 ConfigView* v; 934 935 for (v = viewList; v; v = v->nextView) 936 v->list->updateListAll(); 937} 938 939ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) | 929 930 for (; it.current(); it++) 931 it.current()->setOpen(open); 932} 933 934void ConfigView::updateList(ConfigItem* item) 935{ 936 ConfigView* v; --- 6 unchanged lines hidden (view full) --- 943{ 944 ConfigView* v; 945 946 for (v = viewList; v; v = v->nextView) 947 v->list->updateListAll(); 948} 949 950ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) |
940 : Parent(parent, name), sym(0), menu(0) | 951 : Parent(parent, name), sym(0), _menu(0) |
941{ 942 if (name) { 943 configSettings->beginGroup(name); 944 _showDebug = configSettings->readBoolEntry("/showDebug", false); 945 configSettings->endGroup(); 946 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); 947 } 948} --- 6 unchanged lines hidden (view full) --- 955 configSettings->endGroup(); 956 } 957} 958 959void ConfigInfoView::setShowDebug(bool b) 960{ 961 if (_showDebug != b) { 962 _showDebug = b; | 952{ 953 if (name) { 954 configSettings->beginGroup(name); 955 _showDebug = configSettings->readBoolEntry("/showDebug", false); 956 configSettings->endGroup(); 957 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); 958 } 959} --- 6 unchanged lines hidden (view full) --- 966 configSettings->endGroup(); 967 } 968} 969 970void ConfigInfoView::setShowDebug(bool b) 971{ 972 if (_showDebug != b) { 973 _showDebug = b; |
963 if (menu) | 974 if (_menu) |
964 menuInfo(); 965 else if (sym) 966 symbolInfo(); 967 emit showDebugChanged(b); 968 } 969} 970 971void ConfigInfoView::setInfo(struct menu *m) 972{ | 975 menuInfo(); 976 else if (sym) 977 symbolInfo(); 978 emit showDebugChanged(b); 979 } 980} 981 982void ConfigInfoView::setInfo(struct menu *m) 983{ |
973 if (menu == m) | 984 if (_menu == m) |
974 return; | 985 return; |
975 menu = m; | 986 _menu = m; |
976 sym = NULL; | 987 sym = NULL; |
977 if (!menu) | 988 if (!_menu) |
978 clear(); 979 else 980 menuInfo(); 981} 982 983void ConfigInfoView::symbolInfo(void) 984{ 985 QString str; --- 10 unchanged lines hidden (view full) --- 996 setText(str); 997} 998 999void ConfigInfoView::menuInfo(void) 1000{ 1001 struct symbol* sym; 1002 QString head, debug, help; 1003 | 989 clear(); 990 else 991 menuInfo(); 992} 993 994void ConfigInfoView::symbolInfo(void) 995{ 996 QString str; --- 10 unchanged lines hidden (view full) --- 1007 setText(str); 1008} 1009 1010void ConfigInfoView::menuInfo(void) 1011{ 1012 struct symbol* sym; 1013 QString head, debug, help; 1014 |
1004 sym = menu->sym; | 1015 sym = _menu->sym; |
1005 if (sym) { | 1016 if (sym) { |
1006 if (menu->prompt) { | 1017 if (_menu->prompt) { |
1007 head += "<big><b>"; | 1018 head += "<big><b>"; |
1008 head += print_filter(_(menu->prompt->text)); | 1019 head += print_filter(_(_menu->prompt->text)); |
1009 head += "</b></big>"; 1010 if (sym->name) { 1011 head += " ("; 1012 if (showDebug()) 1013 head += QString().sprintf("<a href=\"s%p\">", sym); 1014 head += print_filter(sym->name); 1015 if (showDebug()) 1016 head += "</a>"; --- 9 unchanged lines hidden (view full) --- 1026 head += "</b></big>"; 1027 } 1028 head += "<br><br>"; 1029 1030 if (showDebug()) 1031 debug = debug_info(sym); 1032 1033 struct gstr help_gstr = str_new(); | 1020 head += "</b></big>"; 1021 if (sym->name) { 1022 head += " ("; 1023 if (showDebug()) 1024 head += QString().sprintf("<a href=\"s%p\">", sym); 1025 head += print_filter(sym->name); 1026 if (showDebug()) 1027 head += "</a>"; --- 9 unchanged lines hidden (view full) --- 1037 head += "</b></big>"; 1038 } 1039 head += "<br><br>"; 1040 1041 if (showDebug()) 1042 debug = debug_info(sym); 1043 1044 struct gstr help_gstr = str_new(); |
1034 menu_get_ext_help(menu, &help_gstr); | 1045 menu_get_ext_help(_menu, &help_gstr); |
1035 help = print_filter(str_get(&help_gstr)); 1036 str_free(&help_gstr); | 1046 help = print_filter(str_get(&help_gstr)); 1047 str_free(&help_gstr); |
1037 } else if (menu->prompt) { | 1048 } else if (_menu->prompt) { |
1038 head += "<big><b>"; | 1049 head += "<big><b>"; |
1039 head += print_filter(_(menu->prompt->text)); | 1050 head += print_filter(_(_menu->prompt->text)); |
1040 head += "</b></big><br><br>"; 1041 if (showDebug()) { | 1051 head += "</b></big><br><br>"; 1052 if (showDebug()) { |
1042 if (menu->prompt->visible.expr) { | 1053 if (_menu->prompt->visible.expr) { |
1043 debug += " dep: "; | 1054 debug += " dep: "; |
1044 expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); | 1055 expr_print(_menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); |
1045 debug += "<br><br>"; 1046 } 1047 } 1048 } 1049 if (showDebug()) | 1056 debug += "<br><br>"; 1057 } 1058 } 1059 } 1060 if (showDebug()) |
1050 debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno); | 1061 debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno); |
1051 1052 setText(head + debug + help); 1053} 1054 1055QString ConfigInfoView::debug_info(struct symbol *sym) 1056{ 1057 QString debug; 1058 --- 86 unchanged lines hidden (view full) --- 1145 if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) { 1146 *text += QString().sprintf("<a href=\"s%p\">", sym); 1147 *text += str2; 1148 *text += "</a>"; 1149 } else 1150 *text += str2; 1151} 1152 | 1062 1063 setText(head + debug + help); 1064} 1065 1066QString ConfigInfoView::debug_info(struct symbol *sym) 1067{ 1068 QString debug; 1069 --- 86 unchanged lines hidden (view full) --- 1156 if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) { 1157 *text += QString().sprintf("<a href=\"s%p\">", sym); 1158 *text += str2; 1159 *text += "</a>"; 1160 } else 1161 *text += str2; 1162} 1163 |
1153QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) | 1164Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) |
1154{ | 1165{ |
1155 QPopupMenu* popup = Parent::createPopupMenu(pos); 1156 QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup); | 1166 Q3PopupMenu* popup = Parent::createPopupMenu(pos); 1167 Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup); |
1157 action->setToggleAction(TRUE); 1158 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 1159 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); 1160 action->setOn(showDebug()); 1161 popup->insertSeparator(); 1162 action->addTo(popup); 1163 return popup; 1164} --- 40 unchanged lines hidden (view full) --- 1205 width = configSettings->readNumEntry("/window width", parent->width() / 2); 1206 height = configSettings->readNumEntry("/window height", parent->height() / 2); 1207 resize(width, height); 1208 x = configSettings->readNumEntry("/window x", 0, &ok); 1209 if (ok) 1210 y = configSettings->readNumEntry("/window y", 0, &ok); 1211 if (ok) 1212 move(x, y); | 1168 action->setToggleAction(TRUE); 1169 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 1170 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); 1171 action->setOn(showDebug()); 1172 popup->insertSeparator(); 1173 action->addTo(popup); 1174 return popup; 1175} --- 40 unchanged lines hidden (view full) --- 1216 width = configSettings->readNumEntry("/window width", parent->width() / 2); 1217 height = configSettings->readNumEntry("/window height", parent->height() / 2); 1218 resize(width, height); 1219 x = configSettings->readNumEntry("/window x", 0, &ok); 1220 if (ok) 1221 y = configSettings->readNumEntry("/window y", 0, &ok); 1222 if (ok) 1223 move(x, y); |
1213 QValueList<int> sizes = configSettings->readSizes("/split", &ok); | 1224 Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok); |
1214 if (ok) 1215 split->setSizes(sizes); 1216 configSettings->endGroup(); 1217 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); 1218 } 1219} 1220 1221void ConfigSearchWindow::saveSettings(void) --- 70 unchanged lines hidden (view full) --- 1292 1293 helpText = new ConfigInfoView(split2, "help"); 1294 helpText->setTextFormat(Qt::RichText); 1295 1296 setTabOrder(configList, helpText); 1297 configList->setFocus(); 1298 1299 menu = menuBar(); | 1225 if (ok) 1226 split->setSizes(sizes); 1227 configSettings->endGroup(); 1228 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); 1229 } 1230} 1231 1232void ConfigSearchWindow::saveSettings(void) --- 70 unchanged lines hidden (view full) --- 1303 1304 helpText = new ConfigInfoView(split2, "help"); 1305 helpText->setTextFormat(Qt::RichText); 1306 1307 setTabOrder(configList, helpText); 1308 configList->setFocus(); 1309 1310 menu = menuBar(); |
1300 toolBar = new QToolBar("Tools", this); | 1311 toolBar = new Q3ToolBar("Tools", this); |
1301 | 1312 |
1302 backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this); | 1313 backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this); |
1303 connect(backAction, SIGNAL(activated()), SLOT(goBack())); 1304 backAction->setEnabled(FALSE); | 1314 connect(backAction, SIGNAL(activated()), SLOT(goBack())); 1315 backAction->setEnabled(FALSE); |
1305 QAction *quitAction = new QAction("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); | 1316 Q3Action *quitAction = new Q3Action("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); |
1306 connect(quitAction, SIGNAL(activated()), SLOT(close())); | 1317 connect(quitAction, SIGNAL(activated()), SLOT(close())); |
1307 QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); | 1318 Q3Action *loadAction = new Q3Action("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); |
1308 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); | 1319 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); |
1309 saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); | 1320 saveAction = new Q3Action("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); |
1310 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); 1311 conf_set_changed_callback(conf_changed); 1312 // Set saveAction's initial state 1313 conf_changed(); | 1321 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); 1322 conf_set_changed_callback(conf_changed); 1323 // Set saveAction's initial state 1324 conf_changed(); |
1314 QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this); | 1325 Q3Action *saveAsAction = new Q3Action("Save As...", _("Save &As..."), 0, this); |
1315 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); | 1326 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); |
1316 QAction *searchAction = new QAction("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); | 1327 Q3Action *searchAction = new Q3Action("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); |
1317 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); | 1328 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); |
1318 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); | 1329 Q3Action *singleViewAction = new Q3Action("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); |
1319 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); | 1330 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); |
1320 QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this); | 1331 Q3Action *splitViewAction = new Q3Action("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this); |
1321 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); | 1332 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); |
1322 QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this); | 1333 Q3Action *fullViewAction = new Q3Action("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this); |
1323 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); 1324 | 1334 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); 1335 |
1325 QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this); | 1336 Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this); |
1326 showNameAction->setToggleAction(TRUE); 1327 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); 1328 connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); 1329 showNameAction->setOn(configView->showName()); | 1337 showNameAction->setToggleAction(TRUE); 1338 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); 1339 connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); 1340 showNameAction->setOn(configView->showName()); |
1330 QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this); | 1341 Q3Action *showRangeAction = new Q3Action(NULL, _("Show Range"), 0, this); |
1331 showRangeAction->setToggleAction(TRUE); 1332 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); 1333 connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); 1334 showRangeAction->setOn(configList->showRange); | 1342 showRangeAction->setToggleAction(TRUE); 1343 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); 1344 connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); 1345 showRangeAction->setOn(configList->showRange); |
1335 QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this); | 1346 Q3Action *showDataAction = new Q3Action(NULL, _("Show Data"), 0, this); |
1336 showDataAction->setToggleAction(TRUE); 1337 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); 1338 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); 1339 showDataAction->setOn(configList->showData); 1340 1341 QActionGroup *optGroup = new QActionGroup(this); 1342 optGroup->setExclusive(TRUE); 1343 connect(optGroup, SIGNAL(selected(QAction *)), configView, 1344 SLOT(setOptionMode(QAction *))); 1345 connect(optGroup, SIGNAL(selected(QAction *)), menuView, 1346 SLOT(setOptionMode(QAction *))); 1347 | 1347 showDataAction->setToggleAction(TRUE); 1348 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); 1349 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); 1350 showDataAction->setOn(configList->showData); 1351 1352 QActionGroup *optGroup = new QActionGroup(this); 1353 optGroup->setExclusive(TRUE); 1354 connect(optGroup, SIGNAL(selected(QAction *)), configView, 1355 SLOT(setOptionMode(QAction *))); 1356 connect(optGroup, SIGNAL(selected(QAction *)), menuView, 1357 SLOT(setOptionMode(QAction *))); 1358 |
1348 configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup); 1349 configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup); 1350 configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup); | 1359#if QT_VERSION >= 0x040000 1360 configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup); 1361 configView->showAllAction = new QAction(_("Show All Options"), optGroup); 1362 configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup); 1363#else 1364 configView->showNormalAction = new QAction(_("Show Normal Options"), 0, optGroup); 1365 configView->showAllAction = new QAction(_("Show All Options"), 0, optGroup); 1366 configView->showPromptAction = new QAction(_("Show Prompt Options"), 0, optGroup); 1367#endif |
1351 configView->showNormalAction->setToggleAction(TRUE); 1352 configView->showNormalAction->setOn(configList->optMode == normalOpt); 1353 configView->showAllAction->setToggleAction(TRUE); 1354 configView->showAllAction->setOn(configList->optMode == allOpt); 1355 configView->showPromptAction->setToggleAction(TRUE); 1356 configView->showPromptAction->setOn(configList->optMode == promptOpt); 1357 | 1368 configView->showNormalAction->setToggleAction(TRUE); 1369 configView->showNormalAction->setOn(configList->optMode == normalOpt); 1370 configView->showAllAction->setToggleAction(TRUE); 1371 configView->showAllAction->setOn(configList->optMode == allOpt); 1372 configView->showPromptAction->setToggleAction(TRUE); 1373 configView->showPromptAction->setOn(configList->optMode == promptOpt); 1374 |
1358 QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); | 1375 Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this); |
1359 showDebugAction->setToggleAction(TRUE); 1360 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); 1361 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); 1362 showDebugAction->setOn(helpText->showDebug()); 1363 | 1376 showDebugAction->setToggleAction(TRUE); 1377 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); 1378 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); 1379 showDebugAction->setOn(helpText->showDebug()); 1380 |
1364 QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this); | 1381 Q3Action *showIntroAction = new Q3Action(NULL, _("Introduction"), 0, this); |
1365 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); | 1382 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); |
1366 QAction *showAboutAction = new QAction(NULL, _("About"), 0, this); | 1383 Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this); |
1367 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); 1368 1369 // init tool bar 1370 backAction->addTo(toolBar); 1371 toolBar->addSeparator(); 1372 loadAction->addTo(toolBar); 1373 saveAction->addTo(toolBar); 1374 toolBar->addSeparator(); 1375 singleViewAction->addTo(toolBar); 1376 splitViewAction->addTo(toolBar); 1377 fullViewAction->addTo(toolBar); 1378 1379 // create config menu | 1384 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); 1385 1386 // init tool bar 1387 backAction->addTo(toolBar); 1388 toolBar->addSeparator(); 1389 loadAction->addTo(toolBar); 1390 saveAction->addTo(toolBar); 1391 toolBar->addSeparator(); 1392 singleViewAction->addTo(toolBar); 1393 splitViewAction->addTo(toolBar); 1394 fullViewAction->addTo(toolBar); 1395 1396 // create config menu |
1380 QPopupMenu* config = new QPopupMenu(this); | 1397 Q3PopupMenu* config = new Q3PopupMenu(this); |
1381 menu->insertItem(_("&File"), config); 1382 loadAction->addTo(config); 1383 saveAction->addTo(config); 1384 saveAsAction->addTo(config); 1385 config->insertSeparator(); 1386 quitAction->addTo(config); 1387 1388 // create edit menu | 1398 menu->insertItem(_("&File"), config); 1399 loadAction->addTo(config); 1400 saveAction->addTo(config); 1401 saveAsAction->addTo(config); 1402 config->insertSeparator(); 1403 quitAction->addTo(config); 1404 1405 // create edit menu |
1389 QPopupMenu* editMenu = new QPopupMenu(this); | 1406 Q3PopupMenu* editMenu = new Q3PopupMenu(this); |
1390 menu->insertItem(_("&Edit"), editMenu); 1391 searchAction->addTo(editMenu); 1392 1393 // create options menu | 1407 menu->insertItem(_("&Edit"), editMenu); 1408 searchAction->addTo(editMenu); 1409 1410 // create options menu |
1394 QPopupMenu* optionMenu = new QPopupMenu(this); | 1411 Q3PopupMenu* optionMenu = new Q3PopupMenu(this); |
1395 menu->insertItem(_("&Option"), optionMenu); 1396 showNameAction->addTo(optionMenu); 1397 showRangeAction->addTo(optionMenu); 1398 showDataAction->addTo(optionMenu); 1399 optionMenu->insertSeparator(); 1400 optGroup->addTo(optionMenu); 1401 optionMenu->insertSeparator(); | 1412 menu->insertItem(_("&Option"), optionMenu); 1413 showNameAction->addTo(optionMenu); 1414 showRangeAction->addTo(optionMenu); 1415 showDataAction->addTo(optionMenu); 1416 optionMenu->insertSeparator(); 1417 optGroup->addTo(optionMenu); 1418 optionMenu->insertSeparator(); |
1402 showDebugAction->addTo(optionMenu); | |
1403 1404 // create help menu | 1419 1420 // create help menu |
1405 QPopupMenu* helpMenu = new QPopupMenu(this); | 1421 Q3PopupMenu* helpMenu = new Q3PopupMenu(this); |
1406 menu->insertSeparator(); 1407 menu->insertItem(_("&Help"), helpMenu); 1408 showIntroAction->addTo(helpMenu); 1409 showAboutAction->addTo(helpMenu); 1410 1411 connect(configList, SIGNAL(menuChanged(struct menu *)), 1412 helpText, SLOT(setInfo(struct menu *))); 1413 connect(configList, SIGNAL(menuSelected(struct menu *)), --- 18 unchanged lines hidden (view full) --- 1432 if (listMode == "single") 1433 showSingleView(); 1434 else if (listMode == "full") 1435 showFullView(); 1436 else /*if (listMode == "split")*/ 1437 showSplitView(); 1438 1439 // UI setup done, restore splitter positions | 1422 menu->insertSeparator(); 1423 menu->insertItem(_("&Help"), helpMenu); 1424 showIntroAction->addTo(helpMenu); 1425 showAboutAction->addTo(helpMenu); 1426 1427 connect(configList, SIGNAL(menuChanged(struct menu *)), 1428 helpText, SLOT(setInfo(struct menu *))); 1429 connect(configList, SIGNAL(menuSelected(struct menu *)), --- 18 unchanged lines hidden (view full) --- 1448 if (listMode == "single") 1449 showSingleView(); 1450 else if (listMode == "full") 1451 showFullView(); 1452 else /*if (listMode == "split")*/ 1453 showSplitView(); 1454 1455 // UI setup done, restore splitter positions |
1440 QValueList<int> sizes = configSettings->readSizes("/split1", &ok); | 1456 Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok); |
1441 if (ok) 1442 split1->setSizes(sizes); 1443 1444 sizes = configSettings->readSizes("/split2", &ok); 1445 if (ok) 1446 split2->setSizes(sizes); 1447} 1448 1449void ConfigMainWindow::loadConfig(void) 1450{ | 1457 if (ok) 1458 split1->setSizes(sizes); 1459 1460 sizes = configSettings->readSizes("/split2", &ok); 1461 if (ok) 1462 split2->setSizes(sizes); 1463} 1464 1465void ConfigMainWindow::loadConfig(void) 1466{ |
1451 QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); | 1467 QString s = Q3FileDialog::getOpenFileName(conf_get_configname(), NULL, this); |
1452 if (s.isNull()) 1453 return; 1454 if (conf_read(QFile::encodeName(s))) 1455 QMessageBox::information(this, "qconf", _("Unable to load configuration!")); 1456 ConfigView::updateListAll(); 1457} 1458 1459void ConfigMainWindow::saveConfig(void) 1460{ 1461 if (conf_write(NULL)) 1462 QMessageBox::information(this, "qconf", _("Unable to save configuration!")); 1463} 1464 1465void ConfigMainWindow::saveConfigAs(void) 1466{ | 1468 if (s.isNull()) 1469 return; 1470 if (conf_read(QFile::encodeName(s))) 1471 QMessageBox::information(this, "qconf", _("Unable to load configuration!")); 1472 ConfigView::updateListAll(); 1473} 1474 1475void ConfigMainWindow::saveConfig(void) 1476{ 1477 if (conf_write(NULL)) 1478 QMessageBox::information(this, "qconf", _("Unable to save configuration!")); 1479} 1480 1481void ConfigMainWindow::saveConfigAs(void) 1482{ |
1467 QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); | 1483 QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this); |
1468 if (s.isNull()) 1469 return; 1470 if (conf_write(QFile::encodeName(s))) 1471 QMessageBox::information(this, "qconf", _("Unable to save configuration!")); 1472} 1473 1474void ConfigMainWindow::searchConfig(void) 1475{ --- 290 unchanged lines hidden --- | 1484 if (s.isNull()) 1485 return; 1486 if (conf_write(QFile::encodeName(s))) 1487 QMessageBox::information(this, "qconf", _("Unable to save configuration!")); 1488} 1489 1490void ConfigMainWindow::searchConfig(void) 1491{ --- 290 unchanged lines hidden --- |