~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to src/kdevideextension.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2004 by Alexander Dymo                                  *
3
 
 *   adymo@kdevelop.org                                                    *
4
 
 *                                                                         *
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.                                   *
9
 
 *                                                                         *
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.                          *
14
 
 *                                                                         *
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"
21
 
 
22
 
#include <qvbox.h>
23
 
#include <qcheckbox.h>
24
 
#include <qbuttongroup.h>
25
 
#include <qradiobutton.h>
26
 
#include <qcombobox.h>
27
 
#include <klineedit.h>
28
 
 
29
 
#include <klocale.h>
30
 
#include <kconfig.h>
31
 
#include <kdialogbase.h>
32
 
#include <kiconloader.h>
33
 
#include <kurlrequester.h>
34
 
#include <kapplication.h>
35
 
#include <kfontrequester.h>
36
 
 
37
 
#include <kdevplugin.h>
38
 
#include <kdevmakefrontend.h>
39
 
#include <kdevplugincontroller.h>
40
 
 
41
 
#include "api.h"
42
 
#include "settingswidget.h"
43
 
 
44
 
KDevIDEExtension::KDevIDEExtension()
45
 
 : ShellExtension()
46
 
{
47
 
}
48
 
 
49
 
void KDevIDEExtension::init()
50
 
{
51
 
    s_instance = new KDevIDEExtension();
52
 
}
53
 
 
54
 
void KDevIDEExtension::createGlobalSettingsPage(KDialogBase *dlg)
55
 
{
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");
59
 
 
60
 
    gsw->projectsURL->setMode((int)KFile::Directory);
61
 
 
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 ) );
71
 
 
72
 
    config->setGroup("General Options");
73
 
    gsw->projectsURL->setURL(config->readPathEntry("DefaultProjectsDir", QDir::homeDirPath()+"/"));
74
 
    gsw->designerButtonGroup->setButton( config->readNumEntry( "DesignerApp", 0 ) );
75
 
 
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" );
80
 
 
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 );
86
 
}
87
 
 
88
 
void KDevIDEExtension::acceptGlobalSettingsPage(KDialogBase *dlg)
89
 
{
90
 
    KConfig* config = kapp->config();
91
 
 
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());
97
 
 
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 );
103
 
 
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());
110
 
    config->sync();
111
 
    if( KDevPlugin *makeExt = API::getInstance()->pluginController()->extension("KDevelop/MakeFrontend"))
112
 
    {
113
 
        static_cast<KDevMakeFrontend*>(makeExt)->updateSettingsFromConfig();
114
 
    }
115
 
 
116
 
    config->setGroup("TerminalEmulator");
117
 
    config->writeEntry("UseKDESetting", gsw->useKDETerminal->isChecked() );
118
 
    config->writeEntry("TerminalApplication", gsw->terminalEdit->text().stripWhiteSpace() );
119
 
}
120
 
 
121
 
QString KDevIDEExtension::xmlFile()
122
 
{
123
 
    return "kdevelopui.rc";
124
 
}
125
 
 
126
 
QString KDevIDEExtension::defaultProfile()
127
 
{
128
 
    return "IDE";
129
 
}