summaryrefslogtreecommitdiffstats
path: root/kdevdesigner/src
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /kdevdesigner/src
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdevdesigner/src')
-rw-r--r--kdevdesigner/src/Makefile.am47
-rw-r--r--kdevdesigner/src/kdevdesigner.cpp216
-rw-r--r--kdevdesigner/src/kdevdesigner.desktop96
-rw-r--r--kdevdesigner/src/kdevdesigner.h96
-rw-r--r--kdevdesigner/src/kdevdesigner_shell.rc37
-rw-r--r--kdevdesigner/src/main.cpp94
6 files changed, 586 insertions, 0 deletions
diff --git a/kdevdesigner/src/Makefile.am b/kdevdesigner/src/Makefile.am
new file mode 100644
index 00000000..f6e1b854
--- /dev/null
+++ b/kdevdesigner/src/Makefile.am
@@ -0,0 +1,47 @@
+# set the include path for X, qt and KDE
+INCLUDES = $(all_includes)
+
+# these are the headers for your project
+noinst_HEADERS = kdevdesigner.h
+
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kdevdesigner.pot
+
+
+# this Makefile creates both a KPart application and a KPart
+#########################################################################
+# APPLICATION SECTION
+#########################################################################
+# this is the program that gets installed. it's name is used for all
+# of the other Makefile.am variables
+bin_PROGRAMS = kdevdesigner
+
+# the application source, library search path, and link libraries
+kdevdesigner_SOURCES = main.cpp kdevdesigner.cpp
+kdevdesigner_LDFLAGS = $(KDE_RPATH) $(all_libraries)
+kdevdesigner_LDADD = $(LIB_KPARTS)
+
+# this is where the desktop file will go
+#shelldesktopdir = $(kde_appsdir)/Development
+#shelldesktop_DATA = kdevdesigner.desktop
+xdg_apps_DATA = kdevdesigner.desktop
+
+# this is where the shell's XML-GUI resource file goes
+shellrcdir = $(kde_datadir)/kdevdesigner
+shellrc_DATA = kdevdesigner_shell.rc
+
+#########################################################################
+# KPART SECTION
+#########################################################################
+
+# the Part's source, library search path, and link libraries
+
+
+# this is where the desktop file will go
+partdesktopdir = $(kde_servicesdir)
+
+# this is where the part's XML-GUI resource file goes
+partrcdir = $(kde_datadir)/kdevdesignerpart
diff --git a/kdevdesigner/src/kdevdesigner.cpp b/kdevdesigner/src/kdevdesigner.cpp
new file mode 100644
index 00000000..4e2b0d0d
--- /dev/null
+++ b/kdevdesigner/src/kdevdesigner.cpp
@@ -0,0 +1,216 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "kdevdesigner.h"
+
+#include <kxmlguiclient.h>
+#include <kkeydialog.h>
+#include <kfiledialog.h>
+#include <kconfig.h>
+#include <kurl.h>
+#include <kdebug.h>
+
+#include <kedittoolbar.h>
+
+#include <kaction.h>
+#include <kstdaction.h>
+
+#include <klibloader.h>
+#include <kmessagebox.h>
+#include <kstatusbar.h>
+#include <klocale.h>
+
+KDevDesigner::KDevDesigner()
+ : KParts::MainWindow( 0L, "KDevDesigner" )
+{
+ // set the shell's ui resource file
+ setXMLFile("kdevdesigner_shell.rc");
+
+ // then, setup our actions
+ setupActions();
+
+ // and a status bar
+ statusBar()->show();
+
+ // this routine will find and load our Part. it finds the Part by
+ // name which is a bad idea usually.. but it's alright in this
+ // case since our Part is made for this Shell
+ KLibFactory *factory = KLibLoader::self()->factory("libkdevdesignerpart");
+ if (factory)
+ {
+ // now that the Part is loaded, we cast it to a Part to get
+ // our hands on it
+ QStringList args;
+ args.append("in shell");
+ m_part = static_cast<KParts::ReadWritePart *>(factory->create(this,
+ "kdevdesigner_part", "KParts::ReadWritePart", args));
+
+ if (m_part)
+ {
+ // tell the KParts::MainWindow that this is indeed the main widget
+ setCentralWidget(m_part->widget());
+
+ // and integrate the part's GUI with the shell's
+ createGUI(m_part);
+ }
+ }
+ else
+ {
+ // if we couldn't find our Part, we exit since the Shell by
+ // itself can't do anything useful
+ KMessageBox::error(this, i18n("Could not find the KDevDesigner part."));
+ kapp->quit();
+ // we return here, cause kapp->quit() only means "exit the
+ // next time we enter the event loop...
+ return;
+ }
+
+ // apply the saved mainwindow settings, if any, and ask the mainwindow
+ // to automatically save settings if changed: window size, toolbar
+ // position, icon size, etc.
+ setAutoSaveSettings();
+}
+
+KDevDesigner::~KDevDesigner()
+{
+}
+
+void KDevDesigner::load(const KURL& url)
+{
+ m_part->openURL( url );
+}
+
+void KDevDesigner::setupActions()
+{
+/* KStdAction::openNew(this, SLOT(fileNew()), actionCollection());
+ KStdAction::open(this, SLOT(fileOpen()), actionCollection());*/
+
+ KStdAction::quit(kapp, SLOT(quit()), actionCollection());
+
+ m_toolbarAction = KStdAction::showToolbar(this, SLOT(optionsShowToolbar()), actionCollection());
+ m_statusbarAction = KStdAction::showStatusbar(this, SLOT(optionsShowStatusbar()), actionCollection());
+
+ KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
+ KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
+}
+
+void KDevDesigner::saveProperties(KConfig* /*config*/)
+{
+ // the 'config' object points to the session managed
+ // config file. anything you write here will be available
+ // later when this app is restored
+}
+
+void KDevDesigner::readProperties(KConfig* /*config*/)
+{
+ // the 'config' object points to the session managed
+ // config file. this function is automatically called whenever
+ // the app is being restored. read in here whatever you wrote
+ // in 'saveProperties'
+}
+
+void KDevDesigner::fileNew()
+{
+ // this slot is called whenever the File->New menu is selected,
+ // the New shortcut is pressed (usually CTRL+N) or the New toolbar
+ // button is clicked
+
+ // About this function, the style guide (
+ // http://developer.kde.org/documentation/standards/kde/style/basics/index.html )
+ // says that it should open a new window if the document is _not_
+ // in its initial state. This is what we do here..
+ if ( ! m_part->url().isEmpty() || m_part->isModified() )
+ {
+ (new KDevDesigner)->show();
+ };
+}
+
+
+void KDevDesigner::optionsShowToolbar()
+{
+ // this is all very cut and paste code for showing/hiding the
+ // toolbar
+ if (m_toolbarAction->isChecked())
+ toolBar()->show();
+ else
+ toolBar()->hide();
+}
+
+void KDevDesigner::optionsShowStatusbar()
+{
+ // this is all very cut and paste code for showing/hiding the
+ // statusbar
+ if (m_statusbarAction->isChecked())
+ statusBar()->show();
+ else
+ statusBar()->hide();
+}
+
+void KDevDesigner::optionsConfigureKeys()
+{
+ KKeyDialog::configureKeys(m_part->actionCollection(), "kdevdesigner_part.rc");
+}
+
+void KDevDesigner::optionsConfigureToolbars()
+{
+ saveMainWindowSettings(KGlobal::config(), autoSaveGroup());
+
+ // use the standard toolbar editor
+ KEditToolbar dlg(factory());
+ connect(&dlg, SIGNAL(newToolbarConfig()),
+ this, SLOT(applyNewToolbarConfig()));
+ dlg.exec();
+}
+
+void KDevDesigner::applyNewToolbarConfig()
+{
+ applyMainWindowSettings(KGlobal::config(), autoSaveGroup());
+}
+
+void KDevDesigner::fileOpen()
+{
+ // this slot is called whenever the File->Open menu is selected,
+ // the Open shortcut is pressed (usually CTRL+O) or the Open toolbar
+ // button is clicked
+ KURL url =
+ KFileDialog::getOpenURL( QString::null, QString::null, this );
+
+ if (url.isEmpty() == false)
+ {
+ // About this function, the style guide (
+ // http://developer.kde.org/documentation/standards/kde/style/basics/index.html )
+ // says that it should open a new window if the document is _not_
+ // in its initial state. This is what we do here..
+ if ( m_part->url().isEmpty() && ! m_part->isModified() )
+ {
+ // we open the file in this window...
+ load( url );
+ }
+ else
+ {
+ // we open the file in a new window...
+ KDevDesigner* newWin = new KDevDesigner;
+ newWin->load( url );
+ newWin->show();
+ }
+ }
+}
+
+#include "kdevdesigner.moc"
diff --git a/kdevdesigner/src/kdevdesigner.desktop b/kdevdesigner/src/kdevdesigner.desktop
new file mode 100644
index 00000000..7bced6fb
--- /dev/null
+++ b/kdevdesigner/src/kdevdesigner.desktop
@@ -0,0 +1,96 @@
+[Desktop Entry]
+Name=KDevelop Designer
+Name[el]=Σχεδιαστής KDevelop
+Name[es]=Diseñador de KDevelop
+Name[et]=KDevelopi Disainer
+Name[eu]=KDevelop disenatzailea
+Name[fa]=طراح KDevelop
+Name[fr]=Concepteur KDevelop
+Name[ga]=Dearthóir KDevelop
+Name[it]=Designer di KDevelop
+Name[ja]=KDevelop デザイナー
+Name[ms]=Pereka KDevelop
+Name[nds]=KDevelop-Maker
+Name[ne]=केडीई विकास डिजाइनर
+Name[pl]=Projektant KDevelop
+Name[pt]=Desenhador do KDevelop
+Name[pt_BR]=Designer do KDevelop
+Name[sk]=KDevelop Dizajnér
+Name[sl]=Snovalnik KDevelop
+Name[sv]=KDevelop designer
+Name[ta]=கேமேம்பாட்டு வடிவமைப்பாளர்
+Name[tg]=Дизайнгари KDevelop
+Name[zh_CN]=KDevelop 设计师
+Name[zh_TW]=KDevelop 設計器
+GenericName=Interface Designer
+GenericName[br]=Ergrafer etrefas
+GenericName[ca]=Dissenyador de interfícies
+GenericName[cy]=Dylunydd Rhyngwyneb
+GenericName[de]=Oberflächen-Designer
+GenericName[el]=Σχεδιαστής διασυνδέσεων
+GenericName[es]=Diseñador de interfaces
+GenericName[et]=Liidesedisainer
+GenericName[eu]=Interfazeen diseinatzailea
+GenericName[fa]=طراح واسط
+GenericName[fr]=Concepteur d'interfaces graphiques
+GenericName[ga]=Dearthóir Comhéadain
+GenericName[gl]=Deseñador de interfaces
+GenericName[hu]=Felülettervező
+GenericName[it]=Interfaccia del Designer
+GenericName[ja]=インターフェースデザイナー
+GenericName[lt]=Sąsajos redaktorius
+GenericName[ms]=Pereka Antaramuka
+GenericName[nds]=Böversietmaker
+GenericName[ne]=इन्टरफेस डिजाइनर
+GenericName[pl]=Projektowanie interfejsu
+GenericName[pt]=Editor de Interfaces
+GenericName[pt_BR]=Desenhador de Interface
+GenericName[ru]=Дизайнер пользовательского интерфейса
+GenericName[rw]=Umuhanzi w'Imigaragarire
+GenericName[sk]=Interface Dizajnér
+GenericName[sl]=Snovalnik vmesnikov
+GenericName[sr]=Дизајнер интерфејса
+GenericName[sr@Latn]=Dizajner interfejsa
+GenericName[sv]=Gränssnittsdesign
+GenericName[tr]=Arayüz Tasarlayıcısı
+GenericName[zh_CN]=界面设计师
+GenericName[zh_TW]=介面設計器
+Exec=kdevdesigner %i -caption "%c"
+Icon=kdevdesigner
+Type=Application
+X-DocPath=kdevdesigner/kdevdesigner.html
+Comment=GUI Designer for Qt/KDE
+Comment[ca]=Dissenyador de IGU per Qt/KDE
+Comment[da]=Grafisk brugerfladedesigner til Qt/KDE
+Comment[de]=Auf Qt-Designer basierender GUI-Designer
+Comment[el]=Σχεδιαστής GUI για Qt/KDE
+Comment[es]=Diseñador de interfaces para Qt/KDE
+Comment[et]=Qt/KDE graafilise kasutajaliidese disainer
+Comment[eu]=GUI diseinatzailea Qt/KDE-rako
+Comment[fa]=طراح ونک برای Qt/KDE
+Comment[fr]=Concepteur d'interfaces graphiques pour Qt / KDE
+Comment[ga]=Dearthóir Comhéadan Grafach le haghaidh Qt/KDE
+Comment[gl]=Deseñador GUI para Qt/KDE
+Comment[hu]=Qt/KDE felülettervező
+Comment[it]=Designer di GUI per Qt/KDE
+Comment[ja]=Qt/KDE のための GUI デザイナー
+Comment[ms]=Pereka GUI untuk Qt/KDE
+Comment[nds]=Böversietmaker för Qt/KDE
+Comment[ne]=Qt/KDE का लागि जी यू आई डिजाइनर
+Comment[nl]=GUI Designer voor Qt/KDE
+Comment[pl]=Projektant graficznego interfejsu użytkownika dla Qt/KDE
+Comment[pt]=Editor de Interfaces para Qt/KDE
+Comment[pt_BR]=Designer de GUI para o Qt/KDE
+Comment[ru]=Среда создания графических форм Qt/KDE
+Comment[sk]=GUI Dizajnér pre Qt/KDE
+Comment[sl]=Snovalnik grafičnega vmesnika za Qt/KDE
+Comment[sr]=Дизајнер GUI-ја за Qt/KDE
+Comment[sr@Latn]=Dizajner GUI-ja za Qt/KDE
+Comment[sv]=Grafisk gränssnittsdesign för Qt och KDE
+Comment[ta]=Qtக்கான GUI வடிவமைப்பாளர்
+Comment[tg]=Муҳит барои сохтани Qt/KDE ба шакли графикӣ
+Comment[tr]=Qt/KDE için Arayüz Tasarlayıcısı
+Comment[zh_CN]=Qt/KDE 的 GUI 设计师
+Comment[zh_TW]=Qt/KDE 的使用者介面設計器
+Terminal=false
+Categories=Qt;KDE;Development;GUIDesigner;X-KDE-KDevelopIDE;
diff --git a/kdevdesigner/src/kdevdesigner.h b/kdevdesigner/src/kdevdesigner.h
new file mode 100644
index 00000000..52a5a259
--- /dev/null
+++ b/kdevdesigner/src/kdevdesigner.h
@@ -0,0 +1,96 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef _KDEVDESIGNER_H_
+#define _KDEVDESIGNER_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <kxmlguiclient.h>
+#include <kapplication.h>
+#include <kparts/mainwindow.h>
+
+class KToggleAction;
+
+/**
+ * This is the application "Shell". It has a menubar, toolbar, and
+ * statusbar but relies on the "Part" to do all the real work.
+ *
+ * @short Application Shell
+ * @author Alexander Dymo <cloudtemple@mksat.net>
+ * @version 0.1
+ */
+class KDevDesigner : public KParts::MainWindow
+{
+ Q_OBJECT
+public:
+ /**
+ * Default Constructor
+ */
+ KDevDesigner();
+
+ /**
+ * Default Destructor
+ */
+ virtual ~KDevDesigner();
+
+ /**
+ * Use this method to load whatever file/URL you have
+ */
+ void load(const KURL& url);
+
+protected:
+ /**
+ * This method is called when it is time for the app to save its
+ * properties for session management purposes.
+ */
+ void saveProperties(KConfig *);
+
+ /**
+ * This method is called when this app is restored. The KConfig
+ * object points to the session management config file that was saved
+ * with @ref saveProperties
+ */
+ void readProperties(KConfig *);
+
+private slots:
+ void fileNew();
+ void fileOpen();
+ void optionsShowToolbar();
+ void optionsShowStatusbar();
+ void optionsConfigureKeys();
+ void optionsConfigureToolbars();
+
+ void applyNewToolbarConfig();
+
+private:
+ void setupAccel();
+ void setupActions();
+
+private:
+ KParts::ReadWritePart *m_part;
+
+ KToggleAction *m_toolbarAction;
+ KToggleAction *m_statusbarAction;
+};
+
+#endif // _KDEVDESIGNER_H_
diff --git a/kdevdesigner/src/kdevdesigner_shell.rc b/kdevdesigner/src/kdevdesigner_shell.rc
new file mode 100644
index 00000000..1bb33a25
--- /dev/null
+++ b/kdevdesigner/src/kdevdesigner_shell.rc
@@ -0,0 +1,37 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="kdevdesigner_shell" version="2">
+<MenuBar>
+ <Menu noMerge="1" name="file"><text>&amp;File</text>
+ <Merge/>
+ <Separator/>
+ <Action name="file_quit"/>
+ </Menu>
+ <Menu noMerge="1" name="edit"><text>&amp;Edit</text>
+ <Merge/>
+ </Menu>
+ <Menu noMerge="1" name="project"><text>&amp;Project</text>
+ <Merge/>
+ </Menu>
+ <Menu noMerge="1" name="tools"><text>&amp;Tools</text>
+ <Merge/>
+ </Menu>
+ <Menu noMerge="1" name="layout"><text>&amp;Layout</text>
+ <Merge/>
+ </Menu>
+ <Menu noMerge="1" name="window"><text>&amp;Window</text>
+ <Merge/>
+ </Menu>
+ <Merge/>
+ <Menu noMerge="1" name="settings"><text>&amp;Settings</text>
+ <Action name="options_show_toolbar"/>
+ <Action name="options_show_statusbar"/>
+ <Merge name="show_merge"/>
+ <Separator/>
+ <Action name="options_configure_keybinding"/>
+ <Action name="options_configure_toolbars"/>
+ <Action name="options_configure"/>
+ <Merge name="configure_merge"/>
+ <Separator/>
+ </Menu>
+</MenuBar>
+</kpartgui>
diff --git a/kdevdesigner/src/main.cpp b/kdevdesigner/src/main.cpp
new file mode 100644
index 00000000..cf432f9d
--- /dev/null
+++ b/kdevdesigner/src/main.cpp
@@ -0,0 +1,94 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * 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., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include <qsplashscreen.h>
+
+#include <kxmlguiclient.h>
+#include "kdevdesigner.h"
+#include <kapplication.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+
+static const char description[] =
+ I18N_NOOP("KDE GUI Designer");
+
+static const char version[] = "0.2";
+
+static KCmdLineOptions options[] =
+{
+ { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
+ KCmdLineLastOption
+};
+
+int main(int argc, char **argv)
+{
+ KAboutData about("kdevdesigner", I18N_NOOP("KDevDesigner"), version, description,
+ KAboutData::License_GPL, "KDevDesigner Copyright: (C) 2004-2005 Alexander Dymo\nQt Designer Copyright: (C) 2000-2005 Trolltech AS All Rights Reserved", 0, 0);
+ about.addAuthor( "Trolltech AS", "Qt Designer code (Free Edition)" );
+ about.addAuthor( "Alexander Dymo", "Port to KDE, partification", "adymo@kdevelop.org" );
+ KCmdLineArgs::init(argc, argv, &about);
+ KCmdLineArgs::addCmdLineOptions( options );
+ KApplication app;
+
+ // see if we are starting with session management
+ if (app.isRestored())
+ {
+ RESTORE(KDevDesigner);
+ }
+ else
+ {
+ // no session.. just start up normally
+ QSplashScreen * splash = 0;
+ QString splashFile = locate("data", "kdevelop/pics/kdevdesigner-splash.png");
+ if (!splashFile.isNull())
+ {
+ QPixmap pm;
+ pm.load(splashFile);
+ splash = new QSplashScreen( pm );
+ splash->show();
+ }
+
+ app.processEvents();
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ if ( args->count() == 0 )
+ {
+ KDevDesigner *widget = new KDevDesigner;
+ widget->show();
+ }
+ else
+ {
+ int i = 0;
+ for (; i < args->count(); i++ )
+ {
+ KDevDesigner *widget = new KDevDesigner;
+ widget->show();
+ widget->load( args->url( i ) );
+ }
+ }
+ args->clear();
+ if (splash)
+ delete splash;
+ }
+
+ return app.exec();
+}