summaryrefslogtreecommitdiffstats
path: root/installerbuilder
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2011-08-10 15:50:53 +0200
committerkh1 <qt-info@nokia.com>2011-08-10 15:50:53 +0200
commit65c918aeebfe4bc578490bbf9f36a81a24e500f0 (patch)
tree9c11b630f4c7380baa7f6f801c1359121d5cf73f /installerbuilder
parent3b2c5a9d8500a5b1fb208e239d6a30c020573215 (diff)
Some style fixes. Rename some members etc.
Diffstat (limited to 'installerbuilder')
-rw-r--r--installerbuilder/libinstaller/packagemanagercore.cpp2
-rw-r--r--installerbuilder/libinstaller/packagemanagercore.h2
-rw-r--r--installerbuilder/libinstaller/packagemanagercore_p.cpp62
-rw-r--r--installerbuilder/libinstaller/packagemanagercore_p.h4
-rw-r--r--installerbuilder/libinstaller/packagemanagergui.cpp73
-rw-r--r--installerbuilder/libinstaller/packagemanagergui.h2
6 files changed, 67 insertions, 78 deletions
diff --git a/installerbuilder/libinstaller/packagemanagercore.cpp b/installerbuilder/libinstaller/packagemanagercore.cpp
index 463215c84..8d648008e 100644
--- a/installerbuilder/libinstaller/packagemanagercore.cpp
+++ b/installerbuilder/libinstaller/packagemanagercore.cpp
@@ -823,7 +823,7 @@ QList<Component*> PackageManagerCore::orderedComponentsToInstall() const
return d->m_orderedComponentsToInstall;
}
-QString PackageManagerCore::installReason(Component* component) const
+QString PackageManagerCore::installReason(Component *component) const
{
return d->installReason(component);
}
diff --git a/installerbuilder/libinstaller/packagemanagercore.h b/installerbuilder/libinstaller/packagemanagercore.h
index 7cc82639c..f8457bf14 100644
--- a/installerbuilder/libinstaller/packagemanagercore.h
+++ b/installerbuilder/libinstaller/packagemanagercore.h
@@ -148,7 +148,7 @@ public:
bool calculateComponentsToInstall() const;
QList<Component*> orderedComponentsToInstall() const;
- QString installReason(Component* component) const;
+ QString installReason(Component *component) const;
QList<Component*> dependencies(const Component *component, QStringList &missingComponents) const;
diff --git a/installerbuilder/libinstaller/packagemanagercore_p.cpp b/installerbuilder/libinstaller/packagemanagercore_p.cpp
index 0119c8366..3bade261e 100644
--- a/installerbuilder/libinstaller/packagemanagercore_p.cpp
+++ b/installerbuilder/libinstaller/packagemanagercore_p.cpp
@@ -311,37 +311,36 @@ bool PackageManagerCorePrivate::appendComponentsToInstall(const QList<Component*
return true;
}
- QList<Component*> notAppendedComponents; //for example components with unresolved dependencies
- foreach (Component *currentComponent, components){
- if (m_toInstallComponentIds.contains(currentComponent->name())) {
+ QList<Component*> notAppendedComponents; // for example components with unresolved dependencies
+ foreach (Component *component, components){
+ if (m_toInstallComponentIds.contains(component->name())) {
const QString errorMessage = QString::fromLatin1("Recursion detected component(%1) already added "
- "with reason: %2.").arg(currentComponent->name(), installReason(currentComponent));
+ "with reason: %2.").arg(component->name(), installReason(component));
verbose() << qPrintable(errorMessage) << std::endl;
- Q_ASSERT_X(!m_toInstallComponentIds.contains(currentComponent->name()), Q_FUNC_INFO,
+ Q_ASSERT_X(!m_toInstallComponentIds.contains(component->name()), Q_FUNC_INFO,
qPrintable(errorMessage));
return false;
}
- if (currentComponent->dependencies().isEmpty())
- realAppendToInstallComponents(currentComponent);
+ if (component->dependencies().isEmpty())
+ realAppendToInstallComponents(component);
else
- notAppendedComponents.append(currentComponent);
+ notAppendedComponents.append(component);
}
bool allComponentsAdded = true;
- foreach (Component *currentComponent, notAppendedComponents)
- allComponentsAdded &= appendComponentToInstall(currentComponent);
+ foreach (Component *component, notAppendedComponents)
+ allComponentsAdded &= appendComponentToInstall(component);
QList<Component*> foundAutoDependOnList;
if (allComponentsAdded) {
// This means notAppendedComponents is empty, so all regular dependencies are resolved. Now we are
// looking for auto depend on components.
- foreach (Component* currentComponent, m_core->availableComponents()) {
- if (!currentComponent->isInstalled()
- && !m_toInstallComponentIds.contains(currentComponent->name())
- && currentComponent->isAutoDependOn(m_toInstallComponentIds)) {
- insertInstallReason(currentComponent, tr("Component(s) with activated auto depend on "));
- foundAutoDependOnList.append(currentComponent);
+ foreach (Component* component, m_core->availableComponents()) {
+ if (!component->isInstalled() && !m_toInstallComponentIds.contains(component->name())
+ && component->isAutoDependOn(m_toInstallComponentIds)) {
+ foundAutoDependOnList.append(component);
+ insertInstallReason(component, tr("Component(s) with activated auto depend on"));
}
}
}
@@ -357,39 +356,38 @@ bool PackageManagerCorePrivate::appendComponentToInstall(Component* component)
//componentByName return 0 if dependencyComponentName contains a version which is not available
Component *dependencyComponent = m_core->componentByName(dependencyComponentName);
if (dependencyComponent == 0) {
- QString errorMessage = QString(QLatin1String(
- "Can't find missing dependency(%1) for %2.")).arg(dependencyComponentName, component->name());
+ const QString errorMessage = QString::fromLatin1("Can't find missing dependency(%1) for %2.")
+ .arg(dependencyComponentName, component->name());
verbose() << qPrintable(errorMessage) << std::endl;
Q_ASSERT_X(false, Q_FUNC_INFO, qPrintable(errorMessage));
return false;
}
+
if (!dependencyComponent->isInstalled()
&& !m_toInstallComponentIds.contains(dependencyComponent->name())) {
+ if (m_visitedComponents.value(component).contains(dependencyComponent))
+ return false;
+ m_visitedComponents[component].insert(dependencyComponent);
- if (m_visitedComponents.value(component).contains(dependencyComponent))
- return false;
- m_visitedComponents[component].insert(dependencyComponent);
-
- //add needed dependency components to the next run
- insertInstallReason(dependencyComponent, QString(tr(
- "added as dependency for %1")).arg(component->name()));
+ // add needed dependency components to the next run
+ insertInstallReason(dependencyComponent, tr("Added as dependency for %1.").arg(component->name()));
- if (!appendComponentToInstall(dependencyComponent))
- return false;
+ if (!appendComponentToInstall(dependencyComponent))
+ return false;
}
}
+
if (!m_toInstallComponentIds.contains(component->name())) {
- insertInstallReason(component, QString(
- tr("Component(s) that have resolved Dependencies"))/*.arg(
- currentComponent->dependencies().join(QLatin1String(", ")))*/);
realAppendToInstallComponents(component);
+ insertInstallReason(component, tr("Component(s) that have resolved Dependencies"));
}
return true;
}
-QString PackageManagerCorePrivate::installReason(Component* component) {
- QString reason = m_toInstallComponentIdReasonHash.value(component->name());
+QString PackageManagerCorePrivate::installReason(Component *component)
+{
+ const QString reason = m_toInstallComponentIdReasonHash.value(component->name());
if (reason.isEmpty())
return tr("Selected Component(s) without Dependencies");
return m_toInstallComponentIdReasonHash.value(component->name());
diff --git a/installerbuilder/libinstaller/packagemanagercore_p.h b/installerbuilder/libinstaller/packagemanagercore_p.h
index 1c1c0a408..038da3b2b 100644
--- a/installerbuilder/libinstaller/packagemanagercore_p.h
+++ b/installerbuilder/libinstaller/packagemanagercore_p.h
@@ -105,8 +105,8 @@ public:
void clearComponentsToInstall();
bool appendComponentsToInstall(const QList<Component*> &components);
- bool appendComponentToInstall(Component* components);
- QString installReason(Component* component);
+ bool appendComponentToInstall(Component *components);
+ QString installReason(Component *component);
void runInstaller();
bool isInstaller() const;
diff --git a/installerbuilder/libinstaller/packagemanagergui.cpp b/installerbuilder/libinstaller/packagemanagergui.cpp
index 4184ac722..4b84b0dac 100644
--- a/installerbuilder/libinstaller/packagemanagergui.cpp
+++ b/installerbuilder/libinstaller/packagemanagergui.cpp
@@ -1528,7 +1528,7 @@ void ReadyForInstallationPage::entering()
m_msgLabel->setText(tr("The volume you selected for installation seems to have sufficient space for "
"installation, but there will be less than 1% of the volume's space available afterwards. %1")
.arg(m_msgLabel->text()));
- } else if (available - required < 100*1024*1024LL) {
+ } else if (available - required < 100 * 1024 * 1024LL) {
// warn for less than 100MB being free
m_msgLabel->setText(tr("The volume you selected for installation seems to have sufficient space for "
"installation, but there will be less than 100 MB available afterwards. %1")
@@ -1536,6 +1536,7 @@ void ReadyForInstallationPage::entering()
}
refreshTaskDetailsBrowser();
}
+
void ReadyForInstallationPage::refreshTaskDetailsBrowser()
{
if (packageManagerCore()->isUninstaller())
@@ -1544,59 +1545,48 @@ void ReadyForInstallationPage::refreshTaskDetailsBrowser()
QString htmlOutput;
QString lastInstallReason;
if (!packageManagerCore()->calculateComponentsToInstall()) { // TODO: why again?
- htmlOutput.append(QString(QLatin1String("<h2><font color=\"red\">%1</font></h2>")).arg(
- tr("Can't resolve all dependencies.<br>")));
+ htmlOutput.append(QString::fromLatin1("<h2><font color=\"red\">%1</font><br></h2>").arg(tr("Can't "
+ "resolve all dependencies.")));
if (!m_taskDetailsBrowser->isVisible())
toggleDetails();
}
-
- //in updater case we don't uninstall components(yes I know update = uninstall + install,
- //but a complete uninstall is meant)
+ // In case of updater mode we don't uninstall components.
if (!packageManagerCore()->isUpdater()) {
- QList<Component*> toRemoveComponentList;
- QListIterator<Component*> allIt(packageManagerCore()->availableComponents());
- while(allIt.hasNext()) {
- Component* currentComponent = allIt.next();
- if (currentComponent->isInstalled()
- && !currentComponent->isSelected())
- toRemoveComponentList.append(currentComponent);
+ QList<Component*> componentsToRemove;
+ foreach (Component *component, packageManagerCore()->availableComponents()) {
+ if (component->isInstalled() && !component->isSelected())
+ componentsToRemove.append(component);
}
- if (!toRemoveComponentList.isEmpty()) {
- htmlOutput.append(QString(QLatin1String("<h3>%1</h3><ul>")).arg(tr("Components about to be removed.")));
- QListIterator<Component*> toRemoveIt(toRemoveComponentList);
- while(toRemoveIt.hasNext()) {
- Component* currentComponent = toRemoveIt.next();
- htmlOutput.append(QString(QLatin1String("<li> %1 </li>")).arg(currentComponent->name()));
- }
- htmlOutput.append(QString(QLatin1String("</ul>")));
+ if (!componentsToRemove.isEmpty()) {
+ htmlOutput.append(QString::fromLatin1("<h3>%1</h3><ul>").arg(tr("Components about to be removed.")));
+ foreach (Component *component, componentsToRemove)
+ htmlOutput.append(QString::fromLatin1("<li> %1 </li>").arg(component->name()));
+ htmlOutput.append(QLatin1String("</ul>"));
}
}
- QListIterator<Component*> toInstallIt(packageManagerCore()->orderedComponentsToInstall());
- while(toInstallIt.hasNext()) {
- Component* currentComponent = toInstallIt.next();
- QString currentInstallReason = packageManagerCore()->installReason(currentComponent);
- if (lastInstallReason != currentInstallReason) {
- if (!lastInstallReason.isEmpty()) //means we had to close the previous list
- htmlOutput.append(QString(QLatin1String("</ul>")));
- htmlOutput.append(QString(QLatin1String("<h3>%1</h3><ul>")).arg(currentInstallReason));
- lastInstallReason = currentInstallReason;
+ foreach (Component *component, packageManagerCore()->orderedComponentsToInstall()) {
+ const QString installReason = packageManagerCore()->installReason(component);
+ if (lastInstallReason != installReason) {
+ if (!lastInstallReason.isEmpty()) // means we had to close the previous list
+ htmlOutput.append(QLatin1String("</ul>"));
+ htmlOutput.append(QString::fromLatin1("<h3>%1</h3><ul>").arg(installReason));
+ lastInstallReason = installReason;
}
- htmlOutput.append(QString(QLatin1String("<li> %1 </li>")).arg(currentComponent->name()));
+ htmlOutput.append(QString::fromLatin1("<li> %1 </li>").arg(component->name()));
}
m_taskDetailsBrowser->setHtml(htmlOutput);
}
void ReadyForInstallationPage::toggleDetails()
{
- const bool willShow = !m_taskDetailsBrowser->isVisible();
- m_taskDetailsBrowser->setVisible(willShow);
- m_taskDetailsButton->setText(willShow ? tr("&Hide Details") : tr("&Show Details"));
+ const bool visible = !m_taskDetailsBrowser->isVisible();
+ m_taskDetailsBrowser->setVisible(visible);
+ m_taskDetailsButton->setText(visible ? tr("&Hide Details") : tr("&Show Details"));
}
-
void ReadyForInstallationPage::leaving()
{
setButtonText(QWizard::CommitButton, gui()->defaultButtonText(QWizard::CommitButton));
@@ -1610,6 +1600,7 @@ bool ReadyForInstallationPage::isComplete() const
return isCommitPage();
}
+
// -- PerformInstallationPage
/*!
@@ -1627,13 +1618,11 @@ PerformInstallationPage::PerformInstallationPage(PackageManagerCore *core)
m_performInstallationForm->setupUi(this);
- connect(ProgressCoordinator::instance(), SIGNAL(detailTextChanged(QString)),
- m_performInstallationForm, SLOT(appendProgressDetails(QString)));
- connect(ProgressCoordinator::instance(), SIGNAL(detailTextResetNeeded()),
- m_performInstallationForm, SLOT(clearDetailsBrowser()));
-
- connect(m_performInstallationForm, SIGNAL(showDetailsChanged()), this,
- SLOT(toggleDetailsWereChanged()));
+ connect(ProgressCoordinator::instance(), SIGNAL(detailTextChanged(QString)), m_performInstallationForm,
+ SLOT(appendProgressDetails(QString)));
+ connect(ProgressCoordinator::instance(), SIGNAL(detailTextResetNeeded()), m_performInstallationForm,
+ SLOT(clearDetailsBrowser()));
+ connect(m_performInstallationForm, SIGNAL(showDetailsChanged()), this, SLOT(toggleDetailsWereChanged()));
connect(core, SIGNAL(installationStarted()), this, SLOT(installationStarted()));
connect(core, SIGNAL(uninstallationStarted()), this, SLOT(installationStarted()));
diff --git a/installerbuilder/libinstaller/packagemanagergui.h b/installerbuilder/libinstaller/packagemanagergui.h
index 0c005d573..113397e54 100644
--- a/installerbuilder/libinstaller/packagemanagergui.h
+++ b/installerbuilder/libinstaller/packagemanagergui.h
@@ -317,6 +317,8 @@ protected:
private:
void refreshTaskDetailsBrowser();
+
+private:
QLabel *m_msgLabel;
QPushButton *m_taskDetailsButton;
QTextBrowser* m_taskDetailsBrowser;