[SCM] Kaboom - Debian KDE 3->4 migration tool branch, master, updated. 942c963c557d2819195dea153c5e040ec67493f5
George Kiagiadakis
gkiagia-guest at alioth.debian.org
Sat Mar 7 18:14:39 UTC 2009
The following commit has been merged in the master branch:
commit 942c963c557d2819195dea153c5e040ec67493f5
Author: George Kiagiadakis <gkiagia at users.sourceforge.net>
Date: Sat Mar 7 20:06:06 2009 +0200
Attempt to fix ChoicePage. Changes:
* Show backup related widgets only when appropriate. Previously it was a mess.
* Do backup calculations only if kde3home exists.
* Disable back/next while we are calculating.
* Optimize for dialog size. It fits in 800x600 now. (but it's still big...)
* Add some html magic in some strings.
diff --git a/choicepage.cpp b/choicepage.cpp
index 9977681..372ac90 100644
--- a/choicepage.cpp
+++ b/choicepage.cpp
@@ -1,6 +1,7 @@
/*
Copyright (C) 2009 Sune Vuorela <sune at vuorela.dk>
(C) 2009 Modestas Vainius <modestas at vainius.eu>
+ (C) 2009 George Kiagiadakis <gkiagia at users.sourceforge.net>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
@@ -24,7 +25,7 @@
class ChoicePagePrivate
{
public:
- ChoicePagePrivate() : backup(NULL), backupinformation(NULL) {}
+ ChoicePagePrivate() : backup(NULL) {}
QLabel *configInfoLabel, *configLabel, *onceDoneLabel;
QLabel *scenariosLabel;
RichRadioButton *clean;
@@ -33,10 +34,9 @@ class ChoicePagePrivate
RichRadioButton *merge;
QButtonGroup *buttons;
QCheckBox *backup;
- QWidget *backupinformation;
- QProgressBar *spacebar;
+ QLabel *freewarning;
ProgressWidget *progresswidget;
- QLabel *freeinfo;
+ QPushButton *recheck;
};
ChoicePage::ChoicePage(QWidget *parent) : QWizardPage(parent)
@@ -48,7 +48,11 @@ ChoicePage::ChoicePage(QWidget *parent) : QWizardPage(parent)
setTitle(tr("Setting migration options"));
d->buttons = new QButtonGroup(this);
+ QFont boldFont;
+ boldFont.setBold(true);
+
d->configInfoLabel = new QLabel(tr("Current configuration:"));
+ d->configInfoLabel->setFont(boldFont);
d->configInfoLabel->setWordWrap(true);
d->configLabel = new QLabel(tr("%1%2")
@@ -70,9 +74,7 @@ ChoicePage::ChoicePage(QWidget *parent) : QWizardPage(parent)
d->onceDoneLabel->setWordWrap(true);
d->scenariosLabel = new QLabel(tr("Please choose one of the following migration scenarios:"),this);
- QFont font;
- font.setBold(true);
- d->scenariosLabel->setFont(font);
+ d->scenariosLabel->setFont(boldFont);
d->scenariosLabel->setWordWrap(true);
lay->addWidget(d->configInfoLabel);
@@ -81,10 +83,6 @@ ChoicePage::ChoicePage(QWidget *parent) : QWizardPage(parent)
lay->addSpacing(10);
lay->addWidget(d->scenariosLabel);
- d->backupinformation = new QWidget(this);
- d->backupinformation->hide();
- lay->addWidget(d->backupinformation);
-
if(s.kdehomeDir().exists())
{
d->migrate = new RichRadioButton(
@@ -149,75 +147,94 @@ ChoicePage::ChoicePage(QWidget *parent) : QWizardPage(parent)
this);
d->buttons->addButton(d->clean,MigrationTool::Clean);
lay->addWidget(d->clean);
- d->progresswidget = new ProgressWidget;
- d->progresswidget->setMaximum(10);
- lay->addWidget(d->progresswidget);
+
d->backup = new QCheckBox(
tr("Backup existing KDE 3 settings into %1. (Highly recommended)")
.arg(s.kdehomePrettyPath(KaboomSettings::Kde3Backup)),
this);
+ d->backup->setChecked(false);
registerField("backup",d->backup);
lay->addWidget(d->backup);
- d->backup->hide();
- d->backup->setChecked(false);
+
if(s.kdehomeDir().exists()) //if no kdedir, nothing to backup.
{
- QVBoxLayout *blay = new QVBoxLayout(d->backupinformation);
- QLabel *freewarning = new QLabel(tr("Insufficient free space to complete a backup, please consider freeing up some space. You can go to TTY1 to do this."),this);
- d->spacebar = new QProgressBar(this);
- d->spacebar->setMaximum(100);
- d->freeinfo = new QLabel;
- QPushButton *recheck = new QPushButton(tr("Recheck"));
- blay->addWidget(freewarning);
- blay->addWidget(d->spacebar);
- blay->addWidget(d->freeinfo);
- blay->addWidget(recheck);
- d->backupinformation->show();
- connect(recheck,SIGNAL(clicked()),this,SLOT(checkSpaceForBackup()));
+ d->freewarning = new QLabel(
+ tr("<p><b>Warning:</b> Insufficient free space to complete a backup, "
+ "please consider freeing up some space. You can go to TTY1 to do this.</p>"), this);
+ d->freewarning->setWordWrap(true);
+ d->freewarning->hide();
+ lay->addWidget(d->freewarning);
+
+ QHBoxLayout *hlay = new QHBoxLayout;
+ d->progresswidget = new ProgressWidget(this);
+ hlay->addWidget(d->progresswidget);
+ d->recheck = new QPushButton(tr("Recheck"));
+ hlay->addWidget(d->recheck);
+ connect(d->recheck,SIGNAL(clicked()),this,SLOT(checkSpaceForBackup()));
+ lay->addLayout(hlay);
+ }
+ else
+ {
+ d->backup->hide();
}
}
void ChoicePage::initializePage()
{
- QTimer::singleShot(0, this, SLOT(checkSpaceForBackup()));
+ if ( KaboomSettings::instance().kdehomeDir().exists() )
+ QTimer::singleShot(0, this, SLOT(checkSpaceForBackup()));
}
bool ChoicePage::backupSelected() const
{
- if(0)
- qDebug() << tr("Recheck");
return d->backup ? d->backup->isChecked() : false;
}
void ChoicePage::checkSpaceForBackup()
{
- d->progresswidget->setVisible(true);
+ Q_ASSERT(KaboomSettings::instance().kdehomeDir().exists());
+
+ //don't allow the user to change page while we are calculating...
+ wizard()->button(QWizard::BackButton)->setEnabled(false);
+ wizard()->button(QWizard::NextButton)->setEnabled(false);
+
+ d->progresswidget->show();
+ d->recheck->hide();
+ d->freewarning->hide();
+ d->backup->setEnabled(false);
+ d->backup->setChecked(false);
+
quint64 dirsize = -1;
- try
- {
- dirsize = DirOperations::calculateDirSize(KaboomSettings::instance().kdehomeDir().canonicalPath(),d->progresswidget);
- }
- catch (const DirOperations::Exception&)
- {
- // nop - default set before.
- }
quint64 freespace = DirOperations::freeDirSpace(QDir::homePath());
+ try {
+ dirsize = DirOperations::calculateDirSize(
+ KaboomSettings::instance().kdehomeDir().canonicalPath(),
+ d->progresswidget
+ );
+ } catch (const DirOperations::Exception&) {}
+
if(dirsize > freespace)
{
quint64 partsize = DirOperations::totalPartitionSize(QDir::homePath());
- d->spacebar->setValue(round(static_cast<double>(partsize-freespace)/static_cast<double>(partsize)*100));
- d->freeinfo->setText( tr("The current KDE settings and data directory takes up %1")
- .arg(DirOperations::bytesToString(dirsize)) );
- d->backupinformation->setVisible(true);
- d->backup->hide();
+ d->progresswidget->setMaximum(partsize);
+ d->progresswidget->setValue(partsize-freespace);
+ d->progresswidget->setLabelText(
+ tr("<p><i>The current KDE 3 settings and data directory takes up %1</i></p>")
+ .arg(DirOperations::bytesToString(dirsize))
+ );
+ d->recheck->show();
+ d->freewarning->show();
}
else
{
- d->backupinformation->hide();
- d->progresswidget->setVisible(false);
+ d->progresswidget->hide();
+ d->recheck->hide();
+ d->backup->setEnabled(true);
d->backup->setChecked(true);
- d->backup->show();
}
+
+ wizard()->button(QWizard::BackButton)->setEnabled(true);
+ wizard()->button(QWizard::NextButton)->setEnabled(true);
}
MigrationTool::Selection ChoicePage::selected() const
diff --git a/diroperations/progresswidget.cpp b/diroperations/progresswidget.cpp
index 0a24653..22741e6 100644
--- a/diroperations/progresswidget.cpp
+++ b/diroperations/progresswidget.cpp
@@ -26,6 +26,7 @@ ProgressWidget::ProgressWidget(QWidget *parent)
QVBoxLayout *layout = new QVBoxLayout(this);
m_label = new QLabel(this);
+ m_label->setWordWrap(true);
layout->addWidget(m_label);
m_progressBar = new QProgressBar(this);
--
Kaboom - Debian KDE 3->4 migration tool
More information about the pkg-kde-commits
mailing list