1
/***************************************************************************
2
* Copyright (C) 2004 by Alexander Dymo *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
20
#include "kdevideextension.h"
23
#include <qcheckbox.h>
24
#include <qbuttongroup.h>
25
#include <qradiobutton.h>
26
#include <qcombobox.h>
27
#include <klineedit.h>
31
#include <kdialogbase.h>
32
#include <kiconloader.h>
33
#include <kurlrequester.h>
34
#include <kapplication.h>
35
#include <kfontrequester.h>
37
#include <kdevplugin.h>
38
#include <kdevmakefrontend.h>
39
#include <kdevplugincontroller.h>
42
#include "settingswidget.h"
44
KDevIDEExtension::KDevIDEExtension()
49
void KDevIDEExtension::init()
51
s_instance = new KDevIDEExtension();
54
void KDevIDEExtension::createGlobalSettingsPage(KDialogBase *dlg)
56
KConfig* config = kapp->config();
57
QVBox *vbox = dlg->addVBoxPage(i18n("General"), i18n("General"), BarIcon("kdevelop", KIcon::SizeMedium) );
58
gsw = new SettingsWidget(vbox, "general settings widget");
60
gsw->projectsURL->setMode((int)KFile::Directory);
62
config->setGroup("General Options");
63
gsw->lastProjectCheckbox->setChecked(config->readBoolEntry("Read Last Project On Startup",true));
64
gsw->outputFont->setFont( config->readFontEntry( "OutputViewFont" ) );
65
config->setGroup("MakeOutputView");
66
gsw->lineWrappingCheckBox->setChecked(config->readBoolEntry("LineWrapping",true));
67
gsw->dirNavigMsgCheckBox->setChecked(config->readBoolEntry("ShowDirNavigMsg",false));
68
gsw->compileOutputCombo->setCurrentItem(config->readNumEntry("CompilerOutputLevel",2));
69
gsw->forceCLocaleRadio->setChecked( config->readBoolEntry( "ForceCLocale", true ) );
70
gsw->userLocaleRadio->setChecked( !config->readBoolEntry( "ForceCLocale", true ) );
72
config->setGroup("General Options");
73
gsw->projectsURL->setURL(config->readPathEntry("DefaultProjectsDir", QDir::homeDirPath()+"/"));
74
gsw->designerButtonGroup->setButton( config->readNumEntry( "DesignerApp", 0 ) );
76
QString DesignerSetting = config->readEntry( "DesignerSetting", "ExternalDesigner" );
77
gsw->qtDesignerRadioButton->setChecked( DesignerSetting == "ExternalDesigner" );
78
gsw->seperateAppRadioButton->setChecked( DesignerSetting == "ExternalKDevDesigner" );
79
gsw->embeddedDesignerRadioButton->setChecked( DesignerSetting == "EmbeddedKDevDesigner" );
81
config->setGroup("TerminalEmulator");
82
gsw->terminalEdit->setText( config->readEntry( "TerminalApplication", QString::fromLatin1("konsole") ) );
83
bool useKDESetting = config->readBoolEntry( "UseKDESetting", true );
84
gsw->useKDETerminal->setChecked( useKDESetting );
85
gsw->useOtherTerminal->setChecked( !useKDESetting );
88
void KDevIDEExtension::acceptGlobalSettingsPage(KDialogBase *dlg)
90
KConfig* config = kapp->config();
92
config->setGroup("General Options");
93
config->writeEntry("DesignerApp", gsw->designerButtonGroup->selectedId());
94
config->writeEntry("Read Last Project On Startup",gsw->lastProjectCheckbox->isChecked());
95
config->writePathEntry("DefaultProjectsDir", gsw->projectsURL->url());
96
config->writeEntry("OutputViewFont", gsw->outputFont->font());
98
QString DesignerSetting;
99
if ( gsw->qtDesignerRadioButton->isChecked() ) DesignerSetting = "ExternalDesigner";
100
if ( gsw->seperateAppRadioButton->isChecked() ) DesignerSetting = "ExternalKDevDesigner";
101
if ( gsw->embeddedDesignerRadioButton->isChecked() ) DesignerSetting = "EmbeddedKDevDesigner";
102
config->writeEntry( "DesignerSetting", DesignerSetting );
104
config->setGroup("MakeOutputView");
105
config->writeEntry("LineWrapping",gsw->lineWrappingCheckBox->isChecked());
106
config->writeEntry("ShowDirNavigMsg",gsw->dirNavigMsgCheckBox->isChecked());
107
config->writeEntry( "ForceCLocale", gsw->forceCLocaleRadio->isChecked() );
108
//current item id must be in sync with the enum!
109
config->writeEntry("CompilerOutputLevel",gsw->compileOutputCombo->currentItem());
111
if( KDevPlugin *makeExt = API::getInstance()->pluginController()->extension("KDevelop/MakeFrontend"))
113
static_cast<KDevMakeFrontend*>(makeExt)->updateSettingsFromConfig();
116
config->setGroup("TerminalEmulator");
117
config->writeEntry("UseKDESetting", gsw->useKDETerminal->isChecked() );
118
config->writeEntry("TerminalApplication", gsw->terminalEdit->text().stripWhiteSpace() );
121
QString KDevIDEExtension::xmlFile()
123
return "kdevelopui.rc";
126
QString KDevIDEExtension::defaultProfile()