diff options
author | kh1 <qt-info@nokia.com> | 2011-06-14 16:24:50 +0200 |
---|---|---|
committer | kh1 <qt-info@nokia.com> | 2011-06-14 16:24:50 +0200 |
commit | 787eb763bd9603c15bc05cff15088426d23c1961 (patch) | |
tree | 94069001ff20b65dc2e1d80b2a02bf5c06479431 /examples | |
parent | 5ed81415ac1d2c2ade8a69203842e82ddd058a4c (diff) |
Rename from Installer to PackageManagerCore.
Note: Might break on any other platform than windows,
needs some more tests. No break on windows so far...
Diffstat (limited to 'examples')
-rw-r--r-- | examples/testapp/componentselectiondialog.cpp | 12 | ||||
-rw-r--r-- | examples/testapp/componentselectiondialog.h | 4 | ||||
-rw-r--r-- | examples/testapp/mainwindow.cpp | 28 | ||||
-rw-r--r-- | examples/testapp/mainwindow.h | 2 | ||||
-rw-r--r-- | examples/testapp/updateagent.cpp | 10 |
5 files changed, 28 insertions, 28 deletions
diff --git a/examples/testapp/componentselectiondialog.cpp b/examples/testapp/componentselectiondialog.cpp index cad923b52..d1e7f5105 100644 --- a/examples/testapp/componentselectiondialog.cpp +++ b/examples/testapp/componentselectiondialog.cpp @@ -47,9 +47,9 @@ class ComponentSelectionDialog::Private : public QObject Q_OBJECT public: - Private(ComponentSelectionDialog *qq, Installer *inst) + Private(ComponentSelectionDialog *qq, PackageManagerCore *core) : q(qq), - installer(inst) + m_core(core) { } @@ -90,7 +90,7 @@ private: public: Ui::ComponentSelectionDialog ui; - Installer *const installer; + PackageManagerCore *const m_core; ComponentModel *componentModel; QPushButton *installBtn; @@ -112,9 +112,9 @@ void ComponentSelectionDialog::Private::deselectAll() // -- ComponentSelectionDialog -ComponentSelectionDialog::ComponentSelectionDialog(Installer *installer, QWidget *parent) +ComponentSelectionDialog::ComponentSelectionDialog(PackageManagerCore *core, QWidget *parent) : QDialog(parent), - d(new Private(this, installer)) + d(new Private(this, core)) { d->ui.setupUi(this); d->ui.icon->setPixmap(windowIcon().pixmap(48, 48)); @@ -123,7 +123,7 @@ ComponentSelectionDialog::ComponentSelectionDialog(Installer *installer, QWidget d->ui.splitter->setStretchFactor(1, 1); d->ui.splitter->setCollapsible(0, false); - d->componentModel = new ComponentModel(5, installer); + d->componentModel = new ComponentModel(5, core); d->componentModel->setHeaderData(0, Qt::Horizontal, tr("Name")); d->componentModel->setHeaderData(1, Qt::Horizontal, tr("Installed Version")); d->componentModel->setHeaderData(2, Qt::Horizontal, tr("New Version")); diff --git a/examples/testapp/componentselectiondialog.h b/examples/testapp/componentselectiondialog.h index 609d08eb4..16937159a 100644 --- a/examples/testapp/componentselectiondialog.h +++ b/examples/testapp/componentselectiondialog.h @@ -29,7 +29,7 @@ #include <QtGui/QDialog> namespace QInstaller { - class Installer; + class PackageManagerCore; } class ComponentSelectionDialog : public QDialog @@ -37,7 +37,7 @@ class ComponentSelectionDialog : public QDialog Q_OBJECT public: - explicit ComponentSelectionDialog(QInstaller::Installer *installer, QWidget *parent = 0); + explicit ComponentSelectionDialog(QInstaller::PackageManagerCore *core, QWidget *parent = 0); virtual ~ComponentSelectionDialog(); Q_INVOKABLE void selectComponent(const QString &compoenent); diff --git a/examples/testapp/mainwindow.cpp b/examples/testapp/mainwindow.cpp index c63cb55bb..0bb387edb 100644 --- a/examples/testapp/mainwindow.cpp +++ b/examples/testapp/mainwindow.cpp @@ -55,8 +55,8 @@ MainWindow::MainWindow(const QStringList &args, QWidget *parent) : QMainWindow(parent) , m_dialog(new UpdateSettingsDialog(this)) { - m_installer.setUpdater(); - m_installer.setUpdaterApplication(&updaterapp); + m_core.setUpdater(); + m_core.setUpdaterApplication(&updaterapp); QMenu *fm = menuBar()->addMenu(QObject::tr("File")); fm->addAction(QObject::tr("Check for Updates"), this, SLOT(checkForUpdates()), @@ -69,7 +69,7 @@ MainWindow::MainWindow(const QStringList &args, QWidget *parent) label->setWordWrap(true); label->setAlignment(Qt::AlignCenter); setCentralWidget(label); - label->setText(QString::fromLatin1("Version: %1\n").arg(m_installer.settings().applicationVersion()) + label->setText(QString::fromLatin1("Version: %1\n").arg(m_core.settings().applicationVersion()) + args.join(QLatin1String(" "))); updaterapp.packagesInfo()->setApplicationName(m_settings.applicationName()); @@ -92,47 +92,47 @@ void MainWindow::checkForUpdates() UpdateSettings settings; try { - m_installer.setTemporaryRepositories(settings.repositories()); + m_core.setTemporaryRepositories(settings.repositories()); settings.setLastCheck(QDateTime::currentDateTime()); - if (!m_installer.fetchUpdaterPackages()) { + if (!m_core.fetchUpdaterPackages()) { settings.setLastResult(tr("Software Update failed.")); QMessageBox::information(this, tr("Check for Updates"), tr("Failed to retrieve updates!")); return; } // no updates for us - if (m_installer.components(false, UpdaterMode).isEmpty()) { + if (m_core.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(scTargetDir, QFileInfo(updaterapp.packagesInfo()->fileName()).absolutePath()); + m_core.setValue(scTargetDir, QFileInfo(updaterapp.packagesInfo()->fileName()).absolutePath()); // this will automatically mark components as to get installed - ComponentSelectionDialog componentSelection(&m_installer, this); + ComponentSelectionDialog componentSelection(&m_core, 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, + connect(&dialog, SIGNAL(canceled()), &m_core, SLOT(interrupt())); + connect(&m_core, SIGNAL(installationProgressTextChanged(QString)), &dialog, SLOT(setLabelText(QString))); - connect(&m_installer, SIGNAL(installationProgressChanged(int)), &dialog, SLOT(setValue(int))); - m_installer.installSelectedComponents(); + connect(&m_core, SIGNAL(installationProgressChanged(int)), &dialog, SLOT(setValue(int))); + m_core.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_core.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_core.rollBackInstallation(); settings.setLastResult(tr("Software Update failed.")); } } diff --git a/examples/testapp/mainwindow.h b/examples/testapp/mainwindow.h index e2ae37a8c..1509edfe6 100644 --- a/examples/testapp/mainwindow.h +++ b/examples/testapp/mainwindow.h @@ -49,7 +49,7 @@ private Q_SLOTS: private: UpdateSettingsDialog *m_dialog; - QInstaller::Installer m_installer; KDUpdater::Application updaterapp; + QInstaller::PackageManagerCore m_core; QInstaller::InstallerSettings m_settings; }; diff --git a/examples/testapp/updateagent.cpp b/examples/testapp/updateagent.cpp index e68eae1ea..7a747cc56 100644 --- a/examples/testapp/updateagent.cpp +++ b/examples/testapp/updateagent.cpp @@ -79,14 +79,14 @@ public: handler->setComponentIndex(QInstallerCreator::ComponentIndex()); KDUpdater::Application app; - Installer installer(QInstaller::MagicUpdaterMarker); - installer.setUpdaterApplication(&app); - installer.setTemporaryRepositories(settings.repositories()); - if (!installer.fetchUpdaterPackages()) + PackageManagerCore core(QInstaller::MagicUpdaterMarker); + core.setUpdaterApplication(&app); + core.setTemporaryRepositories(settings.repositories()); + if (!core.fetchUpdaterPackages()) throw Error(tr("Software Update failed.")); settings.setLastResult(tr("Software Update run successfully.")); - QList<Component*> components = installer.components(false, UpdaterMode); + QList<Component*> components = core.components(false, UpdaterMode); // no updates available if (components.isEmpty()) return; |