[Kde-cygwin-cvs] CVS: tools/installer installwizard.h,NONE,1.1 pagebase.h,NONE,1.1 simplewizard.cpp,
Status: Inactive
Brought to you by:
habacker
From: Ralf H. <hab...@us...> - 2006-01-22 18:33:32
|
Update of /cvsroot/kde-cygwin/tools/installer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4533/installer Modified Files: installer.pro main.cpp Added Files: installwizard.h pagebase.h simplewizard.cpp simplewizard.h Removed Files: package.cpp package.h packagelist.cpp packagelist.h packages.h Log Message: version 0.3 --- NEW FILE: installwizard.h --- /**************************************************************************** ** ** Copyright (C) 2004-2005 Trolltech AS. All rights reserved. ** ** This file is part of the example classes of the Qt Toolkit. ** ** This file may be used under the terms of the GNU General Public ** License version 2.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of ** this file. Please review the following information to ensure GNU ** General Public Licensing requirements will be met: ** http://www.trolltech.com/products/qt/opensource.html ** ** If you are unsure which license is appropriate for your use, please ** review the following information: ** http://www.trolltech.com/products/qt/licensing.html or contact the ** sales department at sa...@tr.... ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #ifndef INSTALLWIZARD_H #define INSTALLWIZARD_H #include "simplewizard.h" class QCheckBox; class QGroupBox; class QLabel; class QLineEdit; class QRadioButton; class QComboBox; class Installer; class QProgressDialog; class InstallWizard; class PageBase : public QWidget { public: PageBase(InstallWizard *wizard); virtual bool postAction() { return true; } protected: Installer *installer; private: }; #include "ui_page1.h" class Page1 : public PageBase { Q_OBJECT public: Page1(InstallWizard *wizard); private: bool postAction(); Ui::Page1 ui; friend class InstallWizard; }; #include "ui_page2.h" class Page2 : public PageBase { Q_OBJECT public: Page2(InstallWizard *wizard); private: Ui::Page2 ui; }; #include "ui_page3.h" class Page3 : public PageBase { Q_OBJECT public: Page3(InstallWizard *wizard); private: Ui::Page3 ui; }; class InstallWizard : public SimpleWizard { Q_OBJECT public: InstallWizard(QWidget *parent = 0); Installer *installer; protected: PageBase *createPage(int index); void accept(); QWidget *parent; private: Page1 *page1; Page2 *page2; Page3 *page3; // QProgressDialog *progressDialog; friend class Page1; friend class Page2; friend class Page3; friend class Installer; }; #endif --- NEW FILE: pagebase.h --- #include "installwizard.h" --- NEW FILE: simplewizard.cpp --- /**************************************************************************** ** ** Copyright (C) 2004-2005 Trolltech AS. All rights reserved. ** ** This file is part of the example classes of the Qt Toolkit. ** ** This file may be used under the terms of the GNU General Public ** License version 2.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of ** this file. Please review the following information to ensure GNU ** General Public Licensing requirements will be met: ** http://www.trolltech.com/products/qt/opensource.html ** ** If you are unsure which license is appropriate for your use, please ** review the following information: ** http://www.trolltech.com/products/qt/licensing.html or contact the ** sales department at sa...@tr.... ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #include <QtGui> #include "simplewizard.h" #include "installwizard.h" SimpleWizard::SimpleWizard(QWidget *parent) : QDialog(parent) { cancelButton = new QPushButton(tr("Cancel")); backButton = new QPushButton(tr("< &Back")); nextButton = new QPushButton(tr("Next >")); finishButton = new QPushButton(tr("&Finish")); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); connect(backButton, SIGNAL(clicked()), this, SLOT(backButtonClicked())); connect(nextButton, SIGNAL(clicked()), this, SLOT(nextButtonClicked())); connect(finishButton, SIGNAL(clicked()), this, SLOT(accept())); buttonLayout = new QHBoxLayout; buttonLayout->addStretch(1); buttonLayout->addWidget(cancelButton); buttonLayout->addWidget(backButton); buttonLayout->addWidget(nextButton); buttonLayout->addWidget(finishButton); mainLayout = new QVBoxLayout; mainLayout->addLayout(buttonLayout); setLayout(mainLayout); } void SimpleWizard::setButtonEnabled(bool enable) { if (history.size() == numPages) finishButton->setEnabled(enable); else nextButton->setEnabled(enable); } void SimpleWizard::setNumPages(int n) { numPages = n; history.append(createPage(0)); switchPage(0); } void SimpleWizard::backButtonClicked() { nextButton->setEnabled(true); finishButton->setEnabled(true); PageBase *oldPage = history.takeLast(); switchPage(oldPage); delete oldPage; } void SimpleWizard::nextButtonClicked() { PageBase *oldPage = history.last(); if (!oldPage->postAction()) return; nextButton->setEnabled(true); finishButton->setEnabled(history.size() == numPages - 1); history.append(createPage(history.size())); switchPage(oldPage); } void SimpleWizard::switchPage(PageBase *oldPage) { if (oldPage) { oldPage->hide(); mainLayout->removeWidget(oldPage); } PageBase *newPage = history.last(); mainLayout->insertWidget(0, newPage); newPage->show(); newPage->setFocus(); backButton->setEnabled(history.size() != 1); if (history.size() == numPages) { nextButton->setEnabled(false); finishButton->setDefault(true); } else { nextButton->setDefault(true); finishButton->setEnabled(false); } setWindowTitle(tr("Simple Wizard - Step %1 of %2") .arg(history.size()) .arg(numPages)); } --- NEW FILE: simplewizard.h --- /**************************************************************************** ** ** Copyright (C) 2004-2005 Trolltech AS. All rights reserved. ** ** This file is part of the example classes of the Qt Toolkit. ** ** This file may be used under the terms of the GNU General Public ** License version 2.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of ** this file. Please review the following information to ensure GNU ** General Public Licensing requirements will be met: ** http://www.trolltech.com/products/qt/opensource.html ** ** If you are unsure which license is appropriate for your use, please ** review the following information: ** http://www.trolltech.com/products/qt/licensing.html or contact the ** sales department at sa...@tr.... ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #ifndef SIMPLEWIZARD_H #define SIMPLEWIZARD_H #include <QDialog> #include <QList> class QHBoxLayout; class QPushButton; class QVBoxLayout; class PageBase; class SimpleWizard : public QDialog { Q_OBJECT public: SimpleWizard(QWidget *parent = 0); void setButtonEnabled(bool enable); protected: virtual PageBase *createPage(int index) = 0; void setNumPages(int n); private slots: void backButtonClicked(); void nextButtonClicked(); private: void switchPage(PageBase *oldPage); QList<PageBase *> history; int numPages; QPushButton *cancelButton; QPushButton *backButton; QPushButton *nextButton; QPushButton *finishButton; QHBoxLayout *buttonLayout; QVBoxLayout *mainLayout; }; #endif Index: installer.pro =================================================================== RCS file: /cvsroot/kde-cygwin/tools/installer/installer.pro,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- installer.pro 22 Jan 2006 18:29:10 -0000 1.2 +++ installer.pro 22 Jan 2006 18:33:24 -0000 1.3 @@ -1,13 +1,20 @@ HEADERS += installer.h \ - package.h \ - packagelist.h + installwizard.h \ + simplewizard.h \ + shared/package.h \ + shared/packagelist.h SOURCES += installer.cpp \ - package.cpp \ - packagelist.cpp \ + installwizard.cpp \ + simplewizard.cpp \ + shared/package.cpp \ + shared/packagelist.cpp \ main.cpp +FORMS = page1.ui page2.ui page3.ui + QT += network CONFIG += +INCLUDEPATH = shared # install target.path = $$[QT_INSTALL_EXAMPLES]/network/http Index: main.cpp =================================================================== RCS file: /cvsroot/kde-cygwin/tools/installer/main.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- main.cpp 22 Jan 2006 18:28:27 -0000 1.1 +++ main.cpp 22 Jan 2006 18:33:24 -0000 1.2 @@ -23,12 +23,11 @@ #include <QApplication> -#include "Installer.h" +#include "installwizard.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); - Installer httpWin; - httpWin.show(); - return httpWin.exec(); + InstallWizard wizard; + return wizard.exec(); } --- package.cpp DELETED --- --- package.h DELETED --- --- packagelist.cpp DELETED --- --- packagelist.h DELETED --- --- packages.h DELETED --- |