summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2011-05-24 23:15:05 +0200
committerkh1 <qt-info@nokia.com>2011-05-24 23:15:05 +0200
commit5c6ab233652ba2bcb116269d60711753e4d4cc8b (patch)
tree55488c1cc2be44f72ecbd8a5717f22ef9fa74198
parent37702a9650d2bd79bf36992638d29e621eff932b (diff)
Make it compile again. Still does not work.
-rw-r--r--examples/testapp/componentselectiondialog.cpp32
-rw-r--r--examples/testapp/componentselectiondialog.h25
-rw-r--r--examples/testapp/componentselectiondialog.ui8
-rw-r--r--examples/testapp/mainwindow.cpp60
-rw-r--r--examples/testapp/mainwindow.h3
-rw-r--r--examples/testapp/testapp.pro5
-rw-r--r--installerfw.pro2
7 files changed, 71 insertions, 64 deletions
diff --git a/examples/testapp/componentselectiondialog.cpp b/examples/testapp/componentselectiondialog.cpp
index a45524ee0..35b5e9ceb 100644
--- a/examples/testapp/componentselectiondialog.cpp
+++ b/examples/testapp/componentselectiondialog.cpp
@@ -36,9 +36,9 @@
#include <QPushButton>
#include <QHeaderView>
-#include "qinstaller.h"
-#include "qinstallercomponent.h"
-#include "qinstallercomponentmodel.h"
+#include <componentmodel.h>
+#include <qinstaller.h>
+#include <qinstallercomponent.h>
using namespace QInstaller;
@@ -59,7 +59,7 @@ public:
int selectionCount = 0;
for( QList< Component* >::const_iterator it = components.begin(); it != components.end(); ++it )
{
- if( (*it)->isSelected( UpdaterMode ) )
+ if( (*it)->isSelected() )
++selectionCount;
}
@@ -118,7 +118,7 @@ void ComponentSelectionDialog::Private::selectAll()
QList< Component* > updaterComponents = installer->components( false, UpdaterMode );
Q_FOREACH( Component* comp, updaterComponents )
{
- comp->setSelected( true, UpdaterMode );
+ comp->setSelected( true );
}
}
@@ -127,21 +127,17 @@ void ComponentSelectionDialog::Private::deselectAll()
QList< Component* > updaterComponents = installer->components( false, UpdaterMode );
Q_FOREACH( Component* comp, updaterComponents )
{
- comp->setSelected( false, UpdaterMode );
+ comp->setSelected( false );
}
}
-void ComponentSelectionDialog::refreshDialog()
-{
- d->selectionChanged();
-}
ComponentSelectionDialog::ComponentSelectionDialog( Installer* installer, QWidget* parent )
: QDialog( parent ),
d( new Private( this, installer ) )
{
d->ui.setupUi( this );
- d->componentModel = new ComponentModel( installer, UpdaterMode );
+ d->componentModel = new ComponentModel( 5, installer );
d->ui.treeView->setModel( d->componentModel );
d->ui.labelLicenseBlurb->setAttribute( Qt::WA_MacSmallSize );
@@ -162,8 +158,8 @@ ComponentSelectionDialog::ComponentSelectionDialog( Installer* installer, QWidge
connect( d->ui.treeView->selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ),
this, SLOT( selectionChanged() ) );
connect( d->installBtn, SIGNAL( clicked() ), this, SIGNAL( requestUpdate() ) );
- connect( d->ui.selectAll, SIGNAL( clicked() ), d.get(), SLOT( selectAll() ), Qt::QueuedConnection );
- connect( d->ui.deselectAll, SIGNAL( clicked() ), d.get(), SLOT( deselectAll() ), Qt::QueuedConnection );
+ connect( d->ui.selectAll, SIGNAL( clicked() ), d, SLOT( selectAll() ), Qt::QueuedConnection );
+ connect( d->ui.deselectAll, SIGNAL( clicked() ), d, SLOT( deselectAll() ), Qt::QueuedConnection );
d->ui.treeView->setCurrentIndex( d->ui.treeView->model()->index( 0, 0 ) );
@@ -178,6 +174,7 @@ ComponentSelectionDialog::ComponentSelectionDialog( Installer* installer, QWidge
ComponentSelectionDialog::~ComponentSelectionDialog()
{
+ delete d;
}
void ComponentSelectionDialog::selectAll() {
@@ -193,18 +190,23 @@ void ComponentSelectionDialog::install() {
}
void ComponentSelectionDialog::selectComponent( const QString& id ) {
- const QModelIndex idx = d->componentModel->findComponent( id );
+ const QModelIndex idx = d->componentModel->indexFromComponentName( id );
if ( !idx.isValid() )
return;
d->componentModel->setData( idx, Qt::Checked );
}
void ComponentSelectionDialog::deselectComponent( const QString& id ) {
- const QModelIndex idx = d->componentModel->findComponent( id );
+ const QModelIndex idx = d->componentModel->indexFromComponentName( id );
if ( !idx.isValid() )
return;
d->componentModel->setData( idx, Qt::Unchecked );
}
+void ComponentSelectionDialog::refreshDialog()
+{
+ d->selectionChanged();
+}
+
#include "moc_componentselectiondialog.cpp"
#include "componentselectiondialog.moc"
diff --git a/examples/testapp/componentselectiondialog.h b/examples/testapp/componentselectiondialog.h
index 0b67084c6..f75a62c7b 100644
--- a/examples/testapp/componentselectiondialog.h
+++ b/examples/testapp/componentselectiondialog.h
@@ -28,20 +28,17 @@
#include <QtGui/QDialog>
-#include <KDToolsCore/pimpl_ptr>
-
-#include "installer_global.h"
-
-namespace QInstaller
-{
-class Installer;
+namespace QInstaller {
+ class Installer;
+}
-class INSTALLER_EXPORT ComponentSelectionDialog : public QDialog
+class ComponentSelectionDialog : public QDialog
{
Q_OBJECT
+
public:
explicit ComponentSelectionDialog( QInstaller::Installer* installer, QWidget* parent = 0 );
- ~ComponentSelectionDialog();
+ virtual ~ComponentSelectionDialog();
Q_INVOKABLE void selectComponent( const QString& compoenent );
Q_INVOKABLE void deselectComponent( const QString& component );
Q_INVOKABLE void selectAll();
@@ -55,13 +52,11 @@ Q_SIGNALS:
void requestUpdate();
private:
- Q_PRIVATE_SLOT( d, void selectionChanged() );
- Q_PRIVATE_SLOT( d, void modelReset() );
-
class Private;
- kdtools::pimpl_ptr< Private > d;
-};
+ Private *d;
-}
+ Q_PRIVATE_SLOT( d, void selectionChanged() )
+ Q_PRIVATE_SLOT( d, void modelReset() )
+};
#endif
diff --git a/examples/testapp/componentselectiondialog.ui b/examples/testapp/componentselectiondialog.ui
index a161612ac..2fde9722e 100644
--- a/examples/testapp/componentselectiondialog.ui
+++ b/examples/testapp/componentselectiondialog.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>656</width>
- <height>406</height>
+ <height>408</height>
</rect>
</property>
<property name="windowTitle">
@@ -25,7 +25,7 @@
</sizepolicy>
</property>
<property name="pixmap">
- <pixmap>:/logo.png</pixmap>
+ <pixmap resource="testapp.qrc">:/logo.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
@@ -160,7 +160,9 @@
</item>
</layout>
</widget>
- <resources/>
+ <resources>
+ <include location="testapp.qrc"/>
+ </resources>
<connections>
<connection>
<sender>buttonBox</sender>
diff --git a/examples/testapp/mainwindow.cpp b/examples/testapp/mainwindow.cpp
index 25b64e90a..46b2423f7 100644
--- a/examples/testapp/mainwindow.cpp
+++ b/examples/testapp/mainwindow.cpp
@@ -51,23 +51,27 @@
#include <KDUpdater/UpdateFinder>
#include <KDUpdater/UpdateSourcesInfo>
-#include "common/binaryformatenginehandler.h"
-#include "common/binaryformat.h"
+#include <common/binaryformatenginehandler.h>
+#include <common/binaryformat.h>
#include "componentselectiondialog.h"
-#include "getrepositorymetainfojob.h"
-#include "common/errors.h"
-#include "common/fileutils.h"
-#include "init.h"
-#include "updateagent.h"
+#include <getrepositorymetainfojob.h>
+#include <common/errors.h>
+#include <common/fileutils.h>
+#include <init.h>
+//#include "updateagent.h"
-#include "updatesettings.h"
-#include "updatesettingsdialog.h"
+#include <updatesettings.h>
+//#include "updatesettingsdialog.h"
using namespace QInstaller;
-MainWindow::MainWindow( const QStringList& args, QWidget* parent ) : QMainWindow( parent ) {
+MainWindow::MainWindow( const QStringList& args, QWidget* parent )
+ : QMainWindow( parent )
+ , m_installer(new Installer(QInstaller::MagicUpdaterMarker))
+{
QInstaller::init();
+ m_installer->setUpdaterApplication(&updaterapp);
QMenuBar* mbar = menuBar();
QMenu* fm = mbar->addMenu( QObject::tr("File") );
@@ -77,19 +81,19 @@ MainWindow::MainWindow( const QStringList& args, QWidget* parent ) : QMainWindow
QLabel* label = new QLabel( this );
label->setAlignment( Qt::AlignCenter );
setCentralWidget( label );
- label->setText( QString::fromLatin1("Version: %1\n").arg( m_installer.settings().applicationVersion() ) + args.join( QLatin1String(" ") ) );
+ label->setText( QString::fromLatin1("Version: %1\n").arg( m_installer->settings().applicationVersion() ) + args.join( QLatin1String(" ") ) );
updaterapp.packagesInfo()->setApplicationName( m_settings.applicationName() );
updaterapp.packagesInfo()->setApplicationVersion( m_settings.applicationVersion() );
- UpdateAgent* const agent = new UpdateAgent( this );
- connect( agent, SIGNAL( updatesAvailable() ), this, SLOT( updatesAvailable() ) );
+// UpdateAgent* const agent = new UpdateAgent( this );
+// connect( agent, SIGNAL( updatesAvailable() ), this, SLOT( updatesAvailable() ) );
}
void MainWindow::editUpdateSettings()
{
- UpdateSettingsDialog dialog( this );
- connect( &dialog, SIGNAL( checkForUpdates() ), this, SLOT( checkForUpdates() ) );
- dialog.exec();
+// UpdateSettingsDialog dialog( this );
+// connect( &dialog, SIGNAL( checkForUpdates() ), this, SLOT( checkForUpdates() ) );
+// dialog.exec();
}
void MainWindow::checkForUpdates() {
@@ -100,43 +104,45 @@ void MainWindow::checkForUpdates() {
try
{
- m_installer.setRemoteRepositories( settings.repositories() );
+ m_installer->setTemporaryRepositories( settings.repositories() );
settings.setLastCheck( QDateTime::currentDateTime() );
-
+
+ m_installer->fetchUpdaterPackages();
+
// no updates for us
- if( m_installer.components(false, UpdaterMode).isEmpty() )
+ if( m_installer->components(false, UpdaterMode).isEmpty() )
{
QMessageBox::information( this, tr( "Check for Updates" ), tr( "There are currently no updates available for you." ) );
return;
}
// set the target directory to the actual one
- m_installer.setValue( QLatin1String( "TargetDir" ), QFileInfo( updaterapp.packagesInfo()->fileName() ).absolutePath() );
+ m_installer->setValue( QLatin1String( "TargetDir" ), QFileInfo( updaterapp.packagesInfo()->fileName() ).absolutePath() );
// this will automatically mork components as to get installed
- ComponentSelectionDialog componentSelection( &m_installer, this );
+ ComponentSelectionDialog componentSelection( m_installer, this );
if( componentSelection.exec() == QDialog::Rejected )
return;
QProgressDialog dialog( this );
dialog.setRange( 0, 100 );
dialog.show();
- connect( &dialog, SIGNAL( canceled() ), &m_installer, SLOT( interrupt() ) );
- connect( &m_installer, SIGNAL( installationProgressTextChanged( QString ) ), &dialog, SLOT( setLabelText( QString ) ) );
- connect( &m_installer, SIGNAL( installationProgressChanged( int ) ), &dialog, SLOT( setValue( int ) ) );
- m_installer.installSelectedComponents();
+ connect( &dialog, SIGNAL( canceled() ), m_installer, SLOT( interrupt() ) );
+ connect( m_installer, SIGNAL( installationProgressTextChanged( QString ) ), &dialog, SLOT( setLabelText( QString ) ) );
+ connect( m_installer, SIGNAL( installationProgressChanged( int ) ), &dialog, SLOT( setValue( int ) ) );
+ m_installer->installSelectedComponents();
updatesInstalled();
}
catch( const QInstaller::Error& error )
{
QMessageBox::critical( this, tr( "Check for Updates" ), tr( "Error while installing updates:\n%1" ).arg( error.what() ) );
- m_installer.rollBackInstallation();
+ m_installer->rollBackInstallation();
settings.setLastResult( tr( "Software Update failed." ) );
}
catch( ... )
{
QMessageBox::critical( this, tr( "Check for Updates" ), tr( "Unknown error while installing updates." ) );
- m_installer.rollBackInstallation();
+ m_installer->rollBackInstallation();
settings.setLastResult( tr( "Software Update failed." ) );
}
}
diff --git a/examples/testapp/mainwindow.h b/examples/testapp/mainwindow.h
index c0611eaab..27af19c97 100644
--- a/examples/testapp/mainwindow.h
+++ b/examples/testapp/mainwindow.h
@@ -34,6 +34,7 @@ class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow( const QStringList& args, QWidget* parent=0 );
+ ~MainWindow() { delete m_installer; }
private Q_SLOTS:
void editUpdateSettings();
@@ -43,6 +44,6 @@ private Q_SLOTS:
private:
KDUpdater::Application updaterapp;
- QInstaller::Installer m_installer;
+ QInstaller::Installer *m_installer;
QInstaller::InstallerSettings m_settings;
};
diff --git a/examples/testapp/testapp.pro b/examples/testapp/testapp.pro
index 7c1bc85f9..0d5c8dbc3 100644
--- a/examples/testapp/testapp.pro
+++ b/examples/testapp/testapp.pro
@@ -11,8 +11,9 @@ CONFIG += uitools help
QTPLUGIN += qsqlite
# Input
-HEADERS += mainwindow.h
-SOURCES += main.cpp mainwindow.cpp
+FORMS += componentselectiondialog.ui
+HEADERS += mainwindow.h componentselectiondialog.h
+SOURCES += main.cpp mainwindow.cpp componentselectiondialog.cpp
RESOURCES += testapp.qrc
macx:QMAKE_POST_LINK = ($$OUT_PWD/../../installerbuilder/bin/binarycreator -p packages -c config -t ../../installerbuilder/bin/installerbase TestAppInstaller.app com.nokia.testapp)
diff --git a/installerfw.pro b/installerfw.pro
index e6138d9e7..7009c613f 100644
--- a/installerfw.pro
+++ b/installerfw.pro
@@ -1,6 +1,6 @@
TEMPLATE=subdirs
CONFIG += ordered
-SUBDIRS += installerbuilder
+SUBDIRS += installerbuilder examples
test.target=test