summaryrefslogtreecommitdiffstats
path: root/installerbuilder
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@nokia.com>2011-08-22 17:54:26 +0200
committerTim Jenssen <tim.jenssen@nokia.com>2011-08-23 10:57:45 +0200
commita222f8f9c7fccadd4c017b5c5be5639bb288adbb (patch)
tree3dc8bc50af1c2cf2f219a2375ee09bf8c2264b75 /installerbuilder
parent68a367649a25b38cf69ec9dcacddc0e921c5b4f2 (diff)
Make sure we only calculate the components on actual change.
Change-Id: I5967f2fa2cba3e54519a4b8b5155b570d34d7a22 Reviewed-on: http://codereview.qt.nokia.com/3333 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Niels Weber <niels.2.weber@nokia.com> Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder')
-rw-r--r--installerbuilder/installerbase/installerbasecommons.cpp30
-rw-r--r--installerbuilder/libinstaller/packagemanagercore.cpp32
-rw-r--r--installerbuilder/libinstaller/packagemanagercore.h2
-rw-r--r--installerbuilder/libinstaller/packagemanagercore_p.cpp2
-rw-r--r--installerbuilder/libinstaller/packagemanagercore_p.h1
-rw-r--r--installerbuilder/libinstaller/packagemanagergui.cpp28
-rw-r--r--installerbuilder/libinstaller/packagemanagergui.h1
7 files changed, 45 insertions, 51 deletions
diff --git a/installerbuilder/installerbase/installerbasecommons.cpp b/installerbuilder/installerbase/installerbasecommons.cpp
index 0f223c6d5..b483f4adb 100644
--- a/installerbuilder/installerbase/installerbasecommons.cpp
+++ b/installerbuilder/installerbase/installerbasecommons.cpp
@@ -343,16 +343,12 @@ int InstallerGui::nextId() const
if (!core->isInstaller())
return nextNextId;
- QList<Component*> components = core->orderedComponentsToInstall();
- bool foundLicense = false;
-
- foreach (Component* component, components) {
- if (!component->licenses().isEmpty()) {
- foundLicense = true;
- break;
- }
+ core->calculateComponentsToInstall();
+ foreach (Component* component, core->orderedComponentsToInstall()) {
+ if (!component->licenses().isEmpty())
+ return next;
}
- return foundLicense ? next : nextNextId;
+ return nextNextId;
}
return next;
}
@@ -396,20 +392,14 @@ int MaintenanceGui::nextId() const
if (!core->isPackageManager() && !core->isUpdater())
return nextNextId;
- QList<Component*> components = core->orderedComponentsToInstall();
- if (components.isEmpty())
- return nextNextId;
-
- bool foundLicense = false;
- foreach (Component* component, components) {
+ core->calculateComponentsToInstall();
+ foreach (Component* component, core->orderedComponentsToInstall()) {
if (component->isInstalled())
continue;
- if (!component->licenses().isEmpty()) {
- foundLicense = true;
- break;
- }
+ if (!component->licenses().isEmpty())
+ return next;
}
- return foundLicense ? next : nextNextId;
+ return nextNextId;
}
return next;
}
diff --git a/installerbuilder/libinstaller/packagemanagercore.cpp b/installerbuilder/libinstaller/packagemanagercore.cpp
index dd04beec8..ca1b1cd67 100644
--- a/installerbuilder/libinstaller/packagemanagercore.cpp
+++ b/installerbuilder/libinstaller/packagemanagercore.cpp
@@ -293,6 +293,11 @@ void PackageManagerCore::cancelMetaInfoJob()
d->m_repoMetaInfoJob->cancel();
}
+void PackageManagerCore::componentsToInstallNeedsRecalculation()
+{
+ d->m_componentsToInstallCalculated = false;
+}
+
void PackageManagerCore::autoAcceptMessageBoxes()
{
MessageBoxHandler::instance()->setDefaultAction(MessageBoxHandler::Accept);
@@ -875,20 +880,23 @@ Component* PackageManagerCore::componentByName(const QString &name) const
*/
bool PackageManagerCore::calculateComponentsToInstall() const
{
- d->clearComponentsToInstall();
- QList<Component*> components;
- if (runMode() == UpdaterMode) {
- foreach(Component *component, updaterComponents()) {
- if (component->updateRequested())
- components.append(component);
- }
- } else if (runMode() == AllMode) {
- foreach(Component *component, availableComponents()) {
- if (component->installationRequested())
- components.append(component);
+ if (!d->m_componentsToInstallCalculated) {
+ d->clearComponentsToInstall();
+ QList<Component*> components;
+ if (runMode() == UpdaterMode) {
+ foreach (Component *component, updaterComponents()) {
+ if (component->updateRequested())
+ components.append(component);
+ }
+ } else if (runMode() == AllMode) {
+ foreach (Component *component, availableComponents()) {
+ if (component->installationRequested())
+ components.append(component);
+ }
}
+ d->m_componentsToInstallCalculated = d->appendComponentsToInstall(components);
}
- return d->appendComponentsToInstall(components);
+ return d->m_componentsToInstallCalculated;
}
/*!
diff --git a/installerbuilder/libinstaller/packagemanagercore.h b/installerbuilder/libinstaller/packagemanagercore.h
index 70fb1d5b0..e92583c2b 100644
--- a/installerbuilder/libinstaller/packagemanagercore.h
+++ b/installerbuilder/libinstaller/packagemanagercore.h
@@ -212,6 +212,8 @@ public Q_SLOTS:
void languageChanged();
void setCompleteUninstallation(bool complete);
void cancelMetaInfoJob();
+ void componentsToInstallNeedsRecalculation();
+
Q_SIGNALS:
void componentAdded(QInstaller::Component *comp);
diff --git a/installerbuilder/libinstaller/packagemanagercore_p.cpp b/installerbuilder/libinstaller/packagemanagercore_p.cpp
index 9f76bea26..f22473113 100644
--- a/installerbuilder/libinstaller/packagemanagercore_p.cpp
+++ b/installerbuilder/libinstaller/packagemanagercore_p.cpp
@@ -157,6 +157,7 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core)
, m_updates(false)
, m_repoFetched(false)
, m_updateSourcesAdded(false)
+ , m_componentsToInstallCalculated(false)
{
}
@@ -177,6 +178,7 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q
, m_repoFetched(false)
, m_updateSourcesAdded(false)
, m_magicBinaryMarker(magicInstallerMaker)
+ , m_componentsToInstallCalculated(false)
{
connect(this, SIGNAL(installationStarted()), m_core, SIGNAL(installationStarted()));
connect(this, SIGNAL(installationFinished()), m_core, SIGNAL(installationFinished()));
diff --git a/installerbuilder/libinstaller/packagemanagercore_p.h b/installerbuilder/libinstaller/packagemanagercore_p.h
index 83db06555..123bd99a2 100644
--- a/installerbuilder/libinstaller/packagemanagercore_p.h
+++ b/installerbuilder/libinstaller/packagemanagercore_p.h
@@ -216,6 +216,7 @@ private:
bool m_repoFetched;
bool m_updateSourcesAdded;
qint64 m_magicBinaryMarker;
+ bool m_componentsToInstallCalculated;
// < name (component to replace), < replacement component, component to replace > >
QHash<QString, QPair<Component*, Component*> > m_componentsToReplaceAllMode;
diff --git a/installerbuilder/libinstaller/packagemanagergui.cpp b/installerbuilder/libinstaller/packagemanagergui.cpp
index 7fe5f527e..74989e56b 100644
--- a/installerbuilder/libinstaller/packagemanagergui.cpp
+++ b/installerbuilder/libinstaller/packagemanagergui.cpp
@@ -475,9 +475,6 @@ void PackageManagerGui::wizardPageVisibilityChangeRequested(bool visible, int p)
if (visible && page(p) == 0) {
setPage(p, d->m_defaultPages[p]);
} else if (!visible && page(p) != 0) {
- //no component selection page means we can calculate it now
- if (p == PackageManagerCore::ComponentSelection)
- m_core->calculateComponentsToInstall(); // TODO: why?
d->m_defaultPages[p] = page(p);
removePage(p);
}
@@ -856,11 +853,9 @@ void LicenseAgreementPage::entering()
m_licenseListWidget->setVisible(false);
m_textBrowser->setText(QLatin1String(""));
- QList<QInstaller::Component*> components = packageManagerCore()->orderedComponentsToInstall();
-
- foreach (QInstaller::Component *component, components) {
+ packageManagerCore()->calculateComponentsToInstall();
+ foreach (QInstaller::Component *component, packageManagerCore()->orderedComponentsToInstall())
addLicenseItem(component->licenses());
- }
const int licenseCount = m_licenseListWidget->count();
if (licenseCount > 0) {
@@ -918,6 +913,9 @@ public:
ComponentModel *list[] = { m_allModel, m_updaterModel, 0 };
while (ComponentModel *model = list[i++]) {
connect(model, SIGNAL(defaultCheckStateChanged(bool)), q, SLOT(setModified(bool)));
+ connect(model, SIGNAL(defaultCheckStateChanged(bool)), m_core,
+ SLOT(componentsToInstallNeedsRecalculation()));
+
model->setHeaderData(ComponentModelHelper::NameColumn, Qt::Horizontal, tr("Name"));
model->setHeaderData(ComponentModelHelper::InstalledVersionColumn, Qt::Horizontal,
tr("Installed Version"));
@@ -1122,12 +1120,6 @@ void ComponentSelectionPage::entering()
setModified(isComplete());
}
-void ComponentSelectionPage::leaving()
-{
- //now we can calculate the install order
- packageManagerCore()->calculateComponentsToInstall(); // TODO: why here?
-}
-
void ComponentSelectionPage::selectAll()
{
d->selectAll();
@@ -1426,6 +1418,7 @@ ReadyForInstallationPage::ReadyForInstallationPage(PackageManagerCore *core)
m_msgLabel->setWordWrap(true);
m_msgLabel->setObjectName(QLatin1String("MessageLabel"));
+ m_msgLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
topLayout->addWidget(m_msgLabel);
baseLayout->addLayout(topLayout);
@@ -1482,6 +1475,8 @@ void ReadyForInstallationPage::entering()
.arg(productName()));
}
+ refreshTaskDetailsBrowser();
+
const KDSysInfo::Volume vol = KDSysInfo::Volume::fromPath(target);
const KDSysInfo::Volume tempVolume =
KDSysInfo::Volume::fromPath(QInstaller::generateTemporaryFileName());
@@ -1540,21 +1535,18 @@ void ReadyForInstallationPage::entering()
"installation, but there will be less than 100 MB available afterwards. %1")
.arg(m_msgLabel->text()));
}
- refreshTaskDetailsBrowser();
}
void ReadyForInstallationPage::refreshTaskDetailsBrowser()
{
- if (packageManagerCore()->isUninstaller())
- return;
-
QString htmlOutput;
QString lastInstallReason;
- if (!packageManagerCore()->calculateComponentsToInstall()) { // TODO: why again?
+ if (!packageManagerCore()->calculateComponentsToInstall()) {
htmlOutput.append(QString::fromLatin1("<h2><font color=\"red\">%1</font><br></h2>").arg(tr("Can't "
"resolve all dependencies.")));
if (!m_taskDetailsBrowser->isVisible())
toggleDetails();
+ setCommitPage(false);
}
// In case of updater mode we don't uninstall components.
diff --git a/installerbuilder/libinstaller/packagemanagergui.h b/installerbuilder/libinstaller/packagemanagergui.h
index 113397e54..894034c9a 100644
--- a/installerbuilder/libinstaller/packagemanagergui.h
+++ b/installerbuilder/libinstaller/packagemanagergui.h
@@ -234,7 +234,6 @@ public:
protected:
void entering();
- void leaving();
private Q_SLOTS:
void setModified(bool modified);