• Skip to content
  • Skip to link menu
KDE 4.5 API Reference
  • KDE API Reference
  • kdesdk
  • Sitemap
  • Contact Us
 

kapptemplate

kapptemplate.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright  2008 by Anne-Marie Mahfouf <annma@kde.org>                 *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, or     *
00007  *   (at your option) any later version.                                   *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU General Public License     *
00015  *   along with this program; if not, write to the                         *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
00018  ***************************************************************************/
00019 
00020 #include <QPixmap>
00021 #include <QRegExpValidator>
00022 
00023 #include <kapplication.h>
00024 #include <KLocale>
00025 #include <KDebug>
00026 #include <ktoolinvocation.h>
00027 
00028 #include "choicepage.h"
00029 #include "generatepage.h"
00030 #include "kapptemplate.h"
00031 #include "prefs.h"
00032 
00033 
00034 KAppTemplate::KAppTemplate( QWidget *parent )
00035     : QWizard()
00036 {
00037     Q_UNUSED(parent);
00038     setWindowTitle(i18n("KDE 4 Template Generator"));
00039     setOption(HaveHelpButton, true);
00040     connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp()));
00041     addPage(new IntroPage);
00042     addPage(new ChoicePage);
00043     addPage(new PropertiesPage);
00044     addPage(new GeneratePage);
00045 }
00046 
00047 KAppTemplate::~KAppTemplate()
00048 {
00049 }
00050 
00051 void KAppTemplate::showHelp()
00052 {
00053     KToolInvocation::invokeHelp( "kapptemplate-index", "kapptemplate" );
00054 }
00055 
00056 
00057 IntroPage::IntroPage(QWidget *parent)
00058     : QWizardPage(parent)
00059 {
00060     setTitle(i18n("Introduction"));
00061     ui_introduction.setupUi(this);
00062 }
00063 
00064 PropertiesPage::PropertiesPage(QWidget *parent) //in its own file?
00065     : QWizardPage(parent)
00066 {
00067     setTitle(i18n("Set the project properties"));
00068     ui_properties.setupUi(this);
00069     //float version = Prefs::appVersion().toFloat();
00070     ui_properties.kcfg_appVersion->setText(Prefs::appVersion());//TODO appVersion+0.1 if already exists
00071     ui_properties.kcfg_url->setMode(KFile::Directory);
00072     ui_properties.kcfg_url->setUrl(Prefs::url());
00073     ui_properties.kcfg_name->setText(Prefs::name());
00074     ui_properties.kcfg_email->setText(Prefs::email());
00075 
00076     registerField("author",  ui_properties.kcfg_name);
00077     registerField("email", ui_properties.kcfg_email);
00078     registerField("version", ui_properties.kcfg_appVersion);
00079     registerField("url", ui_properties.kcfg_url->lineEdit());
00080 
00081     //get from emaildefaults [PROFILE_Default]
00082     connect(ui_properties.kcfg_appVersion, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
00083     connect(ui_properties.kcfg_url, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
00084     connect(ui_properties.kcfg_name, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
00085     connect(ui_properties.kcfg_email, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
00086     connect(this, SIGNAL(completeChanged()), this, SLOT(saveConfig()));
00087     // TODO make some fields mandatory?
00088 }
00089 
00090 void PropertiesPage::initializePage()
00091 {
00092     appNameString = field("appName").toString();
00093     QString message = i18n("Your project name is : %1", appNameString);
00094     ui_properties.appNameLabel->setText(message);
00095 }
00096 
00097 void PropertiesPage::saveConfig()
00098 {
00099     Prefs::setAppVersion(ui_properties.kcfg_appVersion->text());
00100     Prefs::setUrl(ui_properties.kcfg_url->url().path());
00101     Prefs::setName(ui_properties.kcfg_name->text());
00102     Prefs::setEmail(ui_properties.kcfg_email->text());
00103     Prefs::setAppName(appNameString);
00104     Prefs::self()->writeConfig();
00105 }
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 

kapptemplate

Skip menu "kapptemplate"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

kdesdk

Skip menu "kdesdk"
  • kapptemplate
  • kate
  •     kate
  • kbugbuster
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello
Generated for kdesdk by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal