summaryrefslogtreecommitdiffstats
path: root/src/tdevideextension.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tdevideextension.cpp')
-rw-r--r--src/tdevideextension.cpp129
1 files changed, 129 insertions, 0 deletions
diff --git a/src/tdevideextension.cpp b/src/tdevideextension.cpp
new file mode 100644
index 00000000..a6b62e12
--- /dev/null
+++ b/src/tdevideextension.cpp
@@ -0,0 +1,129 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+#include "tdevideextension.h"
+
+#include <tqvbox.h>
+#include <tqcheckbox.h>
+#include <tqbuttongroup.h>
+#include <tqradiobutton.h>
+#include <tqcombobox.h>
+#include <klineedit.h>
+
+#include <tdelocale.h>
+#include <tdeconfig.h>
+#include <kdialogbase.h>
+#include <kiconloader.h>
+#include <kurlrequester.h>
+#include <tdeapplication.h>
+#include <tdefontrequester.h>
+
+#include <tdevplugin.h>
+#include <tdevmakefrontend.h>
+#include <tdevplugincontroller.h>
+
+#include "api.h"
+#include "settingswidget.h"
+
+TDevIDEExtension::TDevIDEExtension()
+ : ShellExtension()
+{
+}
+
+void TDevIDEExtension::init()
+{
+ s_instance = new TDevIDEExtension();
+}
+
+void TDevIDEExtension::createGlobalSettingsPage(KDialogBase *dlg)
+{
+ TDEConfig* config = kapp->config();
+ TQVBox *vbox = dlg->addVBoxPage(i18n("General"), i18n("General"), BarIcon("tdevelop", TDEIcon::SizeMedium) );
+ gsw = new SettingsWidget(vbox, "general settings widget");
+
+ gsw->projectsURL->setMode((int)KFile::Directory);
+
+ config->setGroup("General Options");
+ gsw->lastProjectCheckbox->setChecked(config->readBoolEntry("Read Last Project On Startup",true));
+ gsw->outputFont->setFont( config->readFontEntry( "OutputViewFont" ) );
+ config->setGroup("MakeOutputView");
+ gsw->lineWrappingCheckBox->setChecked(config->readBoolEntry("LineWrapping",true));
+ gsw->dirNavigMsgCheckBox->setChecked(config->readBoolEntry("ShowDirNavigMsg",false));
+ gsw->compileOutputCombo->setCurrentItem(config->readNumEntry("CompilerOutputLevel",2));
+ gsw->forceCLocaleRadio->setChecked( config->readBoolEntry( "ForceCLocale", true ) );
+ gsw->userLocaleRadio->setChecked( !config->readBoolEntry( "ForceCLocale", true ) );
+
+ config->setGroup("General Options");
+ gsw->projectsURL->setURL(config->readPathEntry("DefaultProjectsDir", TQDir::homeDirPath()+"/"));
+ gsw->designerButtonGroup->setButton( config->readNumEntry( "DesignerApp", 0 ) );
+
+ TQString DesignerSetting = config->readEntry( "DesignerSetting", "ExternalDesigner" );
+ gsw->qtDesignerRadioButton->setChecked( DesignerSetting == "ExternalDesigner" );
+ gsw->seperateAppRadioButton->setChecked( DesignerSetting == "ExternalTDevDesigner" );
+ gsw->embeddedDesignerRadioButton->setChecked( DesignerSetting == "EmbeddedTDevDesigner" );
+
+ config->setGroup("TerminalEmulator");
+ gsw->terminalEdit->setText( config->readEntry( "TerminalApplication", TQString::fromLatin1("konsole") ) );
+ bool useKDESetting = config->readBoolEntry( "UseKDESetting", true );
+ gsw->useKDETerminal->setChecked( useKDESetting );
+ gsw->useOtherTerminal->setChecked( !useKDESetting );
+}
+
+void TDevIDEExtension::acceptGlobalSettingsPage(KDialogBase *dlg)
+{
+ TDEConfig* config = kapp->config();
+
+ config->setGroup("General Options");
+ config->writeEntry("DesignerApp", gsw->designerButtonGroup->selectedId());
+ config->writeEntry("Read Last Project On Startup",gsw->lastProjectCheckbox->isChecked());
+ config->writePathEntry("DefaultProjectsDir", gsw->projectsURL->url());
+ config->writeEntry("OutputViewFont", gsw->outputFont->font());
+
+ TQString DesignerSetting;
+ if ( gsw->qtDesignerRadioButton->isChecked() ) DesignerSetting = "ExternalDesigner";
+ if ( gsw->seperateAppRadioButton->isChecked() ) DesignerSetting = "ExternalTDevDesigner";
+ if ( gsw->embeddedDesignerRadioButton->isChecked() ) DesignerSetting = "EmbeddedTDevDesigner";
+ config->writeEntry( "DesignerSetting", DesignerSetting );
+
+ config->setGroup("MakeOutputView");
+ config->writeEntry("LineWrapping",gsw->lineWrappingCheckBox->isChecked());
+ config->writeEntry("ShowDirNavigMsg",gsw->dirNavigMsgCheckBox->isChecked());
+ config->writeEntry( "ForceCLocale", gsw->forceCLocaleRadio->isChecked() );
+ //current item id must be in sync with the enum!
+ config->writeEntry("CompilerOutputLevel",gsw->compileOutputCombo->currentItem());
+ config->sync();
+ if( TDevPlugin *makeExt = API::getInstance()->pluginController()->extension("TDevelop/MakeFrontend"))
+ {
+ static_cast<TDevMakeFrontend*>(makeExt)->updateSettingsFromConfig();
+ }
+
+ config->setGroup("TerminalEmulator");
+ config->writeEntry("UseKDESetting", gsw->useKDETerminal->isChecked() );
+ config->writeEntry("TerminalApplication", gsw->terminalEdit->text().stripWhiteSpace() );
+}
+
+TQString TDevIDEExtension::xmlFile()
+{
+ return "tdevelopui.rc";
+}
+
+TQString TDevIDEExtension::defaultProfile()
+{
+ return "IDE";
+}