diff options
Diffstat (limited to 'tdevdesigner/src')
-rw-r--r-- | tdevdesigner/src/CMakeLists.txt | 36 | ||||
-rw-r--r-- | tdevdesigner/src/Makefile.am | 47 | ||||
-rw-r--r-- | tdevdesigner/src/main.cpp | 94 | ||||
-rw-r--r-- | tdevdesigner/src/tdevdesigner.cpp | 216 | ||||
-rw-r--r-- | tdevdesigner/src/tdevdesigner.desktop | 96 | ||||
-rw-r--r-- | tdevdesigner/src/tdevdesigner.h | 97 | ||||
-rw-r--r-- | tdevdesigner/src/tdevdesigner_shell.rc | 37 |
7 files changed, 623 insertions, 0 deletions
diff --git a/tdevdesigner/src/CMakeLists.txt b/tdevdesigner/src/CMakeLists.txt new file mode 100644 index 00000000..e7cf1615 --- /dev/null +++ b/tdevdesigner/src/CMakeLists.txt @@ -0,0 +1,36 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES tdevdesigner.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) +install( FILES tdevdesigner_shell.rc DESTINATION ${DATA_INSTALL_DIR}/tdevdesigner ) + + +##### tdevdesigner (executable) ################# + +tde_add_executable( tdevdesigner AUTOMOC + SOURCES main.cpp tdevdesigner.cpp + LINK tdeparts-shared + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/tdevdesigner/src/Makefile.am b/tdevdesigner/src/Makefile.am new file mode 100644 index 00000000..c88a016d --- /dev/null +++ b/tdevdesigner/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 = tdevdesigner.h + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/tdevdesigner.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 = tdevdesigner + +# the application source, library search path, and link libraries +tdevdesigner_SOURCES = main.cpp tdevdesigner.cpp +tdevdesigner_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor +tdevdesigner_LDADD = $(LIB_TDEPARTS) + +# this is where the desktop file will go +#shelldesktopdir = $(kde_appsdir)/Development +#shelldesktop_DATA = tdevdesigner.desktop +xdg_apps_DATA = tdevdesigner.desktop + +# this is where the shell's XML-GUI resource file goes +shellrcdir = $(kde_datadir)/tdevdesigner +shellrc_DATA = tdevdesigner_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)/tdevdesignerpart diff --git a/tdevdesigner/src/main.cpp b/tdevdesigner/src/main.cpp new file mode 100644 index 00000000..0ada9f98 --- /dev/null +++ b/tdevdesigner/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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ +#include <tqsplashscreen.h> + +#include <kxmlguiclient.h> +#include "tdevdesigner.h" +#include <tdeapplication.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> +#include <tdelocale.h> +#include <kstandarddirs.h> + +static const char description[] = + I18N_NOOP("TDE GUI Designer"); + +static const char version[] = "0.2"; + +static TDECmdLineOptions options[] = +{ + { "+[URL]", I18N_NOOP( "Document to open" ), 0 }, + TDECmdLineLastOption +}; + +int main(int argc, char **argv) +{ + TDEAboutData about("tdevdesigner", I18N_NOOP("TDevDesigner"), version, description, + TDEAboutData::License_GPL, "TDevDesigner Copyright: (C) 2004-2005 Alexander Dymo\nTQt Designer Copyright: (C) 2000-2005 Trolltech AS All Rights Reserved", 0, 0); + about.addAuthor( "Trolltech AS", "TQt Designer code (Free Edition)" ); + about.addAuthor( "Alexander Dymo", "Port to KDE, partification", "adymo@kdevelop.org" ); + TDECmdLineArgs::init(argc, argv, &about); + TDECmdLineArgs::addCmdLineOptions( options ); + TDEApplication app; + + // see if we are starting with session management + if (app.isRestored()) + { + RESTORE(TDevDesigner); + } + else + { + // no session.. just start up normally + TQSplashScreen * splash = 0; + TQString splashFile = locate("data", "tdevelop/pics/tdevdesigner-splash.png"); + if (!splashFile.isNull()) + { + TQPixmap pm; + pm.load(splashFile); + splash = new TQSplashScreen( pm ); + splash->show(); + } + + app.processEvents(); + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + if ( args->count() == 0 ) + { + TDevDesigner *widget = new TDevDesigner; + widget->show(); + } + else + { + int i = 0; + for (; i < args->count(); i++ ) + { + TDevDesigner *widget = new TDevDesigner; + widget->show(); + widget->load( args->url( i ) ); + } + } + args->clear(); + if (splash) + delete splash; + } + + return app.exec(); +} diff --git a/tdevdesigner/src/tdevdesigner.cpp b/tdevdesigner/src/tdevdesigner.cpp new file mode 100644 index 00000000..bcc9423d --- /dev/null +++ b/tdevdesigner/src/tdevdesigner.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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "tdevdesigner.h" + +#include <kxmlguiclient.h> +#include <kkeydialog.h> +#include <tdefiledialog.h> +#include <tdeconfig.h> +#include <kurl.h> +#include <kdebug.h> + +#include <kedittoolbar.h> + +#include <tdeaction.h> +#include <kstdaction.h> + +#include <klibloader.h> +#include <tdemessagebox.h> +#include <kstatusbar.h> +#include <tdelocale.h> + +TDevDesigner::TDevDesigner() + : KParts::MainWindow( 0L, "TDevDesigner" ) +{ + // set the shell's ui resource file + setXMLFile("tdevdesigner_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("libtdevdesignerpart"); + if (factory) + { + // now that the Part is loaded, we cast it to a Part to get + // our hands on it + TQStringList args; + args.append("in shell"); + m_part = static_cast<KParts::ReadWritePart *>(factory->create(TQT_TQOBJECT(this), + "tdevdesigner_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 TDevDesigner 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(); +} + +TDevDesigner::~TDevDesigner() +{ +} + +void TDevDesigner::load(const KURL& url) +{ + m_part->openURL( url ); +} + +void TDevDesigner::setupActions() +{ +/* KStdAction::openNew(TQT_TQOBJECT(this), TQT_SLOT(fileNew()), actionCollection()); + KStdAction::open(TQT_TQOBJECT(this), TQT_SLOT(fileOpen()), actionCollection());*/ + + KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), actionCollection()); + + m_toolbarAction = KStdAction::showToolbar(TQT_TQOBJECT(this), TQT_SLOT(optionsShowToolbar()), actionCollection()); + m_statusbarAction = KStdAction::showStatusbar(TQT_TQOBJECT(this), TQT_SLOT(optionsShowStatusbar()), actionCollection()); + + KStdAction::keyBindings(TQT_TQOBJECT(this), TQT_SLOT(optionsConfigureKeys()), actionCollection()); + KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(optionsConfigureToolbars()), actionCollection()); +} + +void TDevDesigner::saveProperties(TDEConfig* /*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 TDevDesigner::readProperties(TDEConfig* /*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 TDevDesigner::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 TDevDesigner)->show(); + }; +} + + +void TDevDesigner::optionsShowToolbar() +{ + // this is all very cut and paste code for showing/hiding the + // toolbar + if (m_toolbarAction->isChecked()) + toolBar()->show(); + else + toolBar()->hide(); +} + +void TDevDesigner::optionsShowStatusbar() +{ + // this is all very cut and paste code for showing/hiding the + // statusbar + if (m_statusbarAction->isChecked()) + statusBar()->show(); + else + statusBar()->hide(); +} + +void TDevDesigner::optionsConfigureKeys() +{ + KKeyDialog::configureKeys(m_part->actionCollection(), "tdevdesigner_part.rc"); +} + +void TDevDesigner::optionsConfigureToolbars() +{ + saveMainWindowSettings(TDEGlobal::config(), autoSaveGroup()); + + // use the standard toolbar editor + KEditToolbar dlg(factory()); + connect(&dlg, TQT_SIGNAL(newToolbarConfig()), + this, TQT_SLOT(applyNewToolbarConfig())); + dlg.exec(); +} + +void TDevDesigner::applyNewToolbarConfig() +{ + applyMainWindowSettings(TDEGlobal::config(), autoSaveGroup()); +} + +void TDevDesigner::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( TQString(), TQString(), 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... + TDevDesigner* newWin = new TDevDesigner; + newWin->load( url ); + newWin->show(); + } + } +} + +#include "tdevdesigner.moc" diff --git a/tdevdesigner/src/tdevdesigner.desktop b/tdevdesigner/src/tdevdesigner.desktop new file mode 100644 index 00000000..d2989142 --- /dev/null +++ b/tdevdesigner/src/tdevdesigner.desktop @@ -0,0 +1,96 @@ +[Desktop Entry] +Name=TDevelop Designer +Name[el]=Σχεδιαστής TDevelop +Name[es]=Diseñador de TDevelop +Name[et]=TDevelopi Disainer +Name[eu]=TDevelop disenatzailea +Name[fa]=طراح TDevelop +Name[fr]=Concepteur TDevelop +Name[ga]=Dearthóir TDevelop +Name[it]=Designer di TDevelop +Name[ja]=TDevelop デザイナー +Name[ms]=Pereka TDevelop +Name[nds]=TDevelop-Maker +Name[ne]=केडीई विकास डिजाइनर +Name[pl]=Projektant TDevelop +Name[pt]=Desenhador do TDevelop +Name[pt_BR]=Designer do TDevelop +Name[sk]=TDevelop Dizajnér +Name[sl]=Snovalnik TDevelop +Name[sv]=TDevelop designer +Name[ta]=கேமேம்பாட்டு வடிவமைப்பாளர் +Name[tg]=Дизайнгари TDevelop +Name[zh_CN]=TDevelop 设计师 +Name[zh_TW]=TDevelop 設計器 +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=tdevdesigner %i -caption "%c" +Icon=tdevdesigner +Type=Application +DocPath=tdevdesigner/index.html +Comment=GUI Designer for Qt/TDE +Comment[ca]=Dissenyador de IGU per Qt/TDE +Comment[da]=Grafisk brugerfladedesigner til Qt/TDE +Comment[de]=Auf Qt-Designer basierender GUI-Designer +Comment[el]=Σχεδιαστής GUI για Qt/TDE +Comment[es]=Diseñador de interfaces para Qt/TDE +Comment[et]=Qt/TDE graafilise kasutajaliidese disainer +Comment[eu]=GUI diseinatzailea Qt/TDE-rako +Comment[fa]=طراح ونک برای Qt/TDE +Comment[fr]=Concepteur d'interfaces graphiques pour Qt / TDE +Comment[ga]=Dearthóir Comhéadan Grafach le haghaidh Qt/TDE +Comment[gl]=Deseñador GUI para Qt/TDE +Comment[hu]=Qt/TDE felülettervező +Comment[it]=Designer di GUI per Qt/TDE +Comment[ja]=Qt/TDE のための GUI デザイナー +Comment[ms]=Pereka GUI untuk Qt/TDE +Comment[nds]=Böversietmaker för Qt/TDE +Comment[ne]=Qt/TDE का लागि जी यू आई डिजाइनर +Comment[nl]=GUI Designer voor Qt/TDE +Comment[pl]=Projektant graficznego interfejsu użytkownika dla Qt/TDE +Comment[pt]=Editor de Interfaces para Qt/TDE +Comment[pt_BR]=Designer de GUI para o Qt/TDE +Comment[ru]=Среда создания графических форм Qt/TDE +Comment[sk]=GUI Dizajnér pre Qt/TDE +Comment[sl]=Snovalnik grafičnega vmesnika za Qt/TDE +Comment[sr]=Дизајнер GUI-ја за Qt/TDE +Comment[sr@Latn]=Dizajner GUI-ja za Qt/TDE +Comment[sv]=Grafisk gränssnittsdesign för Qt och TDE +Comment[ta]=Qtக்கான GUI வடிவமைப்பாளர் +Comment[tg]=Муҳит барои сохтани Qt/TDE ба шакли графикӣ +Comment[tr]=Qt/TDE için Arayüz Tasarlayıcısı +Comment[zh_CN]=Qt/TDE 的 GUI 设计师 +Comment[zh_TW]=Qt/TDE 的使用者介面設計器 +Terminal=false +Categories=Qt;TDE;Development;GUIDesigner;X-TDE-TDevelopIDE; diff --git a/tdevdesigner/src/tdevdesigner.h b/tdevdesigner/src/tdevdesigner.h new file mode 100644 index 00000000..dc5113fe --- /dev/null +++ b/tdevdesigner/src/tdevdesigner.h @@ -0,0 +1,97 @@ +/*************************************************************************** + * 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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef _TDEVDESIGNER_H_ +#define _TDEVDESIGNER_H_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <kxmlguiclient.h> +#include <tdeapplication.h> +#include <tdeparts/mainwindow.h> + +class TDEToggleAction; + +/** + * 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 TDevDesigner : public KParts::MainWindow +{ + Q_OBJECT + +public: + /** + * Default Constructor + */ + TDevDesigner(); + + /** + * Default Destructor + */ + virtual ~TDevDesigner(); + + /** + * 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(TDEConfig *); + + /** + * This method is called when this app is restored. The TDEConfig + * object points to the session management config file that was saved + * with @ref saveProperties + */ + void readProperties(TDEConfig *); + +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; + + TDEToggleAction *m_toolbarAction; + TDEToggleAction *m_statusbarAction; +}; + +#endif // _TDEVDESIGNER_H_ diff --git a/tdevdesigner/src/tdevdesigner_shell.rc b/tdevdesigner/src/tdevdesigner_shell.rc new file mode 100644 index 00000000..a6a81fd3 --- /dev/null +++ b/tdevdesigner/src/tdevdesigner_shell.rc @@ -0,0 +1,37 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="tdevdesigner_shell" version="2"> +<MenuBar> + <Menu noMerge="1" name="file"><text>&File</text> + <Merge/> + <Separator/> + <Action name="file_quit"/> + </Menu> + <Menu noMerge="1" name="edit"><text>&Edit</text> + <Merge/> + </Menu> + <Menu noMerge="1" name="project"><text>&Project</text> + <Merge/> + </Menu> + <Menu noMerge="1" name="tools"><text>&Tools</text> + <Merge/> + </Menu> + <Menu noMerge="1" name="layout"><text>&Layout</text> + <Merge/> + </Menu> + <Menu noMerge="1" name="window"><text>&Window</text> + <Merge/> + </Menu> + <Merge/> + <Menu noMerge="1" name="settings"><text>&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> |