KateConfigDialog::KateConfigDialog(KateMainWindow *parent, Kate::View *view) : KDialogBase(KDialogBase::TreeList, i18n("Configure"), KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel | KDialogBase::Help, KDialogBase::Ok, parent, "configdialog") { KConfig *config = KateApp::self()->config(); KWin::setIcons(winId(), KateApp::self()->icon(), KateApp::self()->miniIcon()); actionButton(KDialogBase::Apply)->setEnabled(false); mainWindow = parent; setMinimumSize(600, 400); v = view; pluginPages.setAutoDelete(false); editorPages.setAutoDelete(false); QStringList path; setShowIconsInTreeList(true); path.clear(); path << i18n("Application"); setFolderIcon(path, SmallIcon("kate", KIcon::SizeSmall)); path.clear(); // BEGIN General page path << i18n("Application") << i18n("General"); QFrame *frGeneral = addPage(path, i18n("General Options"), BarIcon("gohome", KIcon::SizeSmall)); QVBoxLayout *lo = new QVBoxLayout(frGeneral); lo->setSpacing(KDialog::spacingHint()); config->setGroup("General"); // GROUP with the one below: "Appearance" QButtonGroup *bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("&Appearance"), frGeneral); lo->addWidget(bgStartup); // show full path in title config->setGroup("General"); cb_fullPath = new QCheckBox(i18n("&Show full path in title"), bgStartup); cb_fullPath->setChecked(mainWindow->viewManager()->getShowFullPath()); QWhatsThis::add(cb_fullPath, i18n("If this option is checked, the full document path will be shown in the window caption.")); connect(cb_fullPath, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // GROUP with the one below: "Behavior" bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("&Behavior"), frGeneral); lo->addWidget(bgStartup); // sync the konsole ? cb_syncKonsole = new QCheckBox(bgStartup); cb_syncKonsole->setText(i18n("Sync &terminal emulator with active document")); cb_syncKonsole->setChecked(parent->syncKonsole); QWhatsThis::add(cb_syncKonsole, i18n("If this is checked, the built in Konsole will <code>cd</code> to the directory " "of the active document when started and whenever the active document changes, " "if the document is a local file.")); connect(cb_syncKonsole, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // modified files notification cb_modNotifications = new QCheckBox(i18n("Wa&rn about files modified by foreign processes"), bgStartup); cb_modNotifications->setChecked(parent->modNotification); QWhatsThis::add(cb_modNotifications, i18n("If enabled, when Kate receives focus you will be asked what to do with " "files that have been modified on the hard disk. If not enabled, you will " "be asked what to do with a file that has been modified on the hard disk only " "when that file gains focus inside Kate.")); connect(cb_modNotifications, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // GROUP with the one below: "Meta-informations" bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("Meta-Information"), frGeneral); lo->addWidget(bgStartup); // save meta infos cb_saveMetaInfos = new QCheckBox(bgStartup); cb_saveMetaInfos->setText(i18n("Keep &meta-information past sessions")); cb_saveMetaInfos->setChecked(KateDocManager::self()->getSaveMetaInfos()); QWhatsThis::add(cb_saveMetaInfos, i18n("Check this if you want document configuration like for example " "bookmarks to be saved past editor sessions. The configuration will be " "restored if the document has not changed when reopened.")); connect(cb_saveMetaInfos, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // meta infos days QHBox *hbDmf = new QHBox(bgStartup); hbDmf->setEnabled(KateDocManager::self()->getSaveMetaInfos()); QLabel *lDmf = new QLabel(i18n("&Delete unused meta-information after:"), hbDmf); sb_daysMetaInfos = new QSpinBox(0, 180, 1, hbDmf); sb_daysMetaInfos->setSpecialValueText(i18n("(never)")); sb_daysMetaInfos->setSuffix(i18n(" day(s)")); sb_daysMetaInfos->setValue(KateDocManager::self()->getDaysMetaInfos()); lDmf->setBuddy(sb_daysMetaInfos); connect(cb_saveMetaInfos, SIGNAL(toggled(bool)), hbDmf, SLOT(setEnabled(bool))); connect(sb_daysMetaInfos, SIGNAL(valueChanged(int)), this, SLOT(slotChanged())); lo->addStretch(1); // :-] works correct without autoadd // END General page path.clear(); // BEGIN Session page path << i18n("Application") << i18n("Sessions"); QFrame *frSessions = addPage(path, i18n("Session Management"), BarIcon("history", KIcon::SizeSmall)); lo = new QVBoxLayout(frSessions); lo->setSpacing(KDialog::spacingHint()); // GROUP with the one below: "Startup" bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("Elements of Sessions"), frSessions); lo->addWidget(bgStartup); // restore view config cb_restoreVC = new QCheckBox(bgStartup); cb_restoreVC->setText(i18n("Include &window configuration")); config->setGroup("General"); cb_restoreVC->setChecked(config->readBoolEntry("Restore Window Configuration", true)); QWhatsThis::add(cb_restoreVC, i18n("Check this if you want all your views and frames restored each time you open Kate")); connect(cb_restoreVC, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); QRadioButton *rb1, *rb2, *rb3; sessions_start = new QButtonGroup(1, Qt::Horizontal, i18n("Behavior on Application Startup"), frSessions); lo->add(sessions_start); sessions_start->setRadioButtonExclusive(true); sessions_start->insert(rb1 = new QRadioButton(i18n("&Start new session"), sessions_start), 0); sessions_start->insert(rb2 = new QRadioButton(i18n("&Load last-used session"), sessions_start), 1); sessions_start->insert(rb3 = new QRadioButton(i18n("&Manually choose a session"), sessions_start), 2); config->setGroup("General"); QString sesStart(config->readEntry("Startup Session", "manual")); if(sesStart == "new") sessions_start->setButton(0); else if(sesStart == "last") sessions_start->setButton(1); else sessions_start->setButton(2); connect(rb1, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb2, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb3, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); sessions_exit = new QButtonGroup(1, Qt::Horizontal, i18n("Behavior on Application Exit or Session Switch"), frSessions); lo->add(sessions_exit); sessions_exit->setRadioButtonExclusive(true); sessions_exit->insert(rb1 = new QRadioButton(i18n("&Do not save session"), sessions_exit), 0); sessions_exit->insert(rb2 = new QRadioButton(i18n("&Save session"), sessions_exit), 1); sessions_exit->insert(rb3 = new QRadioButton(i18n("&Ask user"), sessions_exit), 2); config->setGroup("General"); QString sesExit(config->readEntry("Session Exit", "save")); if(sesExit == "discard") sessions_exit->setButton(0); else if(sesExit == "save") sessions_exit->setButton(1); else sessions_exit->setButton(2); connect(rb1, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb2, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb3, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); lo->addStretch(1); // :-] works correct without autoadd // END Session page path.clear(); // file selector page path << i18n("Application") << i18n("File Selector"); QVBox *page = addVBoxPage(path, i18n("File Selector Settings"), BarIcon("fileopen", KIcon::SizeSmall)); fileSelConfigPage = new KFSConfigPage(page, "file selector config page", mainWindow->fileselector); connect(fileSelConfigPage, SIGNAL(changed()), this, SLOT(slotChanged())); path.clear(); path << i18n("Application") << i18n("Document List"); page = addVBoxPage(path, i18n("Document List Settings"), BarIcon("view_text", KIcon::SizeSmall)); filelistConfigPage = new KFLConfigPage(page, "file list config page", mainWindow->filelist); connect(filelistConfigPage, SIGNAL(changed()), this, SLOT(slotChanged())); path.clear(); path << i18n("Application") << i18n("Plugins"); /*QVBox **/ page = addVBoxPage(path, i18n("Plugin Manager"), BarIcon("connect_established", KIcon::SizeSmall)); KateConfigPluginPage *configPluginPage = new KateConfigPluginPage(page, this); connect(configPluginPage, SIGNAL(changed()), this, SLOT(slotChanged())); // Tools->External Tools menu path.clear(); path << i18n("Application") << i18n("External Tools"); page = addVBoxPage(path, i18n("External Tools"), BarIcon("configure", KIcon::SizeSmall)); configExternalToolsPage = new KateExternalToolsConfigWidget(page, "external tools config page"); connect(configExternalToolsPage, SIGNAL(changed()), this, SLOT(slotChanged())); // editor widgets from kwrite/kwdialog path.clear(); path << i18n("Editor"); setFolderIcon(path, SmallIcon("edit", KIcon::SizeSmall)); for(uint i = 0; i < KTextEditor::configInterfaceExtension(v->document())->configPages(); i++) { path.clear(); path << i18n("Editor") << KTextEditor::configInterfaceExtension(v->document())->configPageName(i); /*QVBox **/ page = addVBoxPage(path, KTextEditor::configInterfaceExtension(v->document())->configPageFullName(i), KTextEditor::configInterfaceExtension(v->document())->configPagePixmap(i, KIcon::SizeSmall)); KTextEditor::ConfigPage *cPage = KTextEditor::configInterfaceExtension(v->document())->configPage(i, page); connect(cPage, SIGNAL(changed()), this, SLOT(slotChanged())); editorPages.append(cPage); } KatePluginList &pluginList(KatePluginManager::self()->pluginList()); for(unsigned int i = 0; i < pluginList.size(); ++i) { if(pluginList[i].load && Kate::pluginConfigInterfaceExtension(pluginList[i].plugin)) addPluginPage(pluginList[i].plugin); } enableButtonSeparator(true); dataChanged = false; unfoldTreeList(); }
void SmartPlaylistEditor::init(QString defaultName) { makeVBoxMainWidget(); m_fields.clear(); m_fields << i18n("Artist") << i18n("Album") << i18n("Genre") << i18n("Title") << i18n("Length") << i18n("Track #") << i18n("Year") << i18n("Comment") << i18n("Play Counter") << i18n("Score") << i18n( "Rating" ) << i18n("First Play") << i18n("Last Play") << i18n("Modified Date") << i18n("File Path"); m_dbFields.clear(); m_dbFields << "artist.name" << "album.name" << "genre.name" << "tags.title" << "tags.length" << "tags.track" << "year.name" << "tags.comment" << "statistics.playcounter" << "statistics.percentage" << "statistics.rating" << "statistics.createdate" << "statistics.accessdate" << "tags.createdate" << "tags.url" << "tags.sampler"; m_expandableFields.clear(); m_expandableFields << i18n("Artist") << i18n("Album") << i18n("Genre") << i18n("Year"); m_expandableDbFields.clear(); m_expandableDbFields << "artist.name" << "album.name" << "genre.name" << "year.name"; QHBox *hbox = new QHBox( mainWidget() ); hbox->setSpacing( 5 ); new QLabel( i18n("Playlist name:"), hbox ); m_nameLineEdit = new KLineEdit( defaultName, hbox ); QFrame *sep = new QFrame( mainWidget() ); sep->setFrameStyle( QFrame::HLine | QFrame::Sunken ); //match box (any) QHBox *matchAnyBox = new QHBox( mainWidget() ); m_matchAnyCheck = new QCheckBox( i18n("Match Any of the following conditions" ), matchAnyBox ); matchAnyBox->setStretchFactor( new QWidget( matchAnyBox ), 1 ); //criteria box m_criteriaAnyGroupBox = new QVGroupBox( QString::null, mainWidget() ); //match box (all) QHBox *matchAllBox = new QHBox( mainWidget() ); m_matchAllCheck = new QCheckBox( i18n("Match All of the following conditions" ), matchAllBox ); matchAllBox->setStretchFactor( new QWidget( matchAllBox ), 1 ); //criteria box m_criteriaAllGroupBox = new QVGroupBox( QString::null, mainWidget() ); //order box QHBox *hbox2 = new QHBox( mainWidget() ); m_orderCheck = new QCheckBox( i18n("Order by"), hbox2 ); QHBox *orderBox = new QHBox( hbox2 ); orderBox->setSpacing( 5 ); //fields combo m_orderCombo = new KComboBox( orderBox ); m_orderCombo->insertStringList( m_fields ); m_orderCombo->insertItem( i18n("Random") ); //order type m_orderTypeCombo = new KComboBox( orderBox ); updateOrderTypes(0); // populate the new m_orderTypeCombo hbox2->setStretchFactor( new QWidget( hbox2 ), 1 ); //limit box QHBox *hbox1 = new QHBox( mainWidget() ); m_limitCheck = new QCheckBox( i18n("Limit to"), hbox1 ); QHBox *limitBox = new QHBox( hbox1 ); limitBox->setSpacing( 5 ); m_limitSpin = new KIntSpinBox( limitBox ); m_limitSpin->setMinValue( 1 ); m_limitSpin->setMaxValue( 1000 ); m_limitSpin->setValue( 15 ); new QLabel( i18n("tracks"), limitBox ); hbox1->setStretchFactor( new QWidget( hbox1 ), 1 ); //Expand By QHBox *hbox3 = new QHBox( mainWidget() ); m_expandCheck = new QCheckBox( i18n("Expand by"), hbox3 ); QHBox *expandBox = new QHBox( hbox3 ); expandBox->setSpacing( 5 ); m_expandCombo = new KComboBox( expandBox ); m_expandCombo->insertStringList( m_expandableFields ); hbox3->setStretchFactor( new QWidget( hbox3 ), 1 ); //add stretch static_cast<QHBox *>(mainWidget())->setStretchFactor(new QWidget(mainWidget()), 1); connect( m_matchAnyCheck, SIGNAL( toggled(bool) ), m_criteriaAnyGroupBox, SLOT( setEnabled(bool) ) ); connect( m_matchAllCheck, SIGNAL( toggled(bool) ), m_criteriaAllGroupBox, SLOT( setEnabled(bool) ) ); connect( m_orderCheck, SIGNAL( toggled(bool) ), orderBox, SLOT( setEnabled(bool) ) ); connect( m_limitCheck, SIGNAL( toggled(bool) ), limitBox, SLOT( setEnabled(bool) ) ); connect( m_expandCheck, SIGNAL( toggled(bool) ), expandBox, SLOT( setEnabled(bool) ) ); connect( m_orderCombo, SIGNAL( activated(int) ), this, SLOT( updateOrderTypes(int) ) ); m_criteriaAnyGroupBox->setEnabled( false ); m_criteriaAllGroupBox->setEnabled( false ); orderBox->setEnabled( false ); limitBox->setEnabled( false ); expandBox->setEnabled( false ); m_nameLineEdit->setFocus(); resize( 550, 200 ); }