summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rbutil/rbutilqt/install.cpp34
-rw-r--r--rbutil/rbutilqt/install.h6
-rw-r--r--rbutil/rbutilqt/installfrm.ui25
3 files changed, 32 insertions, 33 deletions
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp
index dc861ec14d..a277adaa22 100644
--- a/rbutil/rbutilqt/install.cpp
+++ b/rbutil/rbutilqt/install.cpp
@@ -31,8 +31,8 @@ Install::Install(RbSettings *sett,QWidget *parent) : QDialog(parent)
connect(ui.radioStable, SIGNAL(toggled(bool)), this, SLOT(setDetailsStable(bool)));
connect(ui.radioCurrent, SIGNAL(toggled(bool)), this, SLOT(setDetailsCurrent(bool)));
connect(ui.radioArchived, SIGNAL(toggled(bool)), this, SLOT(setDetailsArchived(bool)));
- connect(ui.changeBackup,SIGNAL(pressed()),this,SLOT(changeBackupPath()));
- connect(ui.backup,SIGNAL(stateChanged(int)),this,SLOT(backupCheckboxChanged(int)));
+ connect(ui.changeBackup, SIGNAL(pressed()), this, SLOT(changeBackupPath()));
+ connect(ui.backup, SIGNAL(stateChanged(int)), this, SLOT(backupCheckboxChanged(int)));
//! check if rockbox is already installed
QString version = Detect::installedVersion(settings->mountpoint());
@@ -43,7 +43,8 @@ Install::Install(RbSettings *sett,QWidget *parent) : QDialog(parent)
m_backupName = settings->mountpoint();
if(!m_backupName.endsWith("/")) m_backupName += "/";
m_backupName += ".backup/rockbox-backup-"+version+".zip";
- ui.backupLocation->setText(QDir::toNativeSeparators(fontMetrics().elidedText(m_backupName,Qt::ElideMiddle,200)));
+ // for some reason the label doesn't return its final size yet.
+ // Delay filling ui.backupLocation until the checkbox is changed.
}
else
{
@@ -52,17 +53,35 @@ Install::Install(RbSettings *sett,QWidget *parent) : QDialog(parent)
backupCheckboxChanged(Qt::Unchecked);
}
+
+void Install::resizeEvent(QResizeEvent *e)
+{
+ (void)e;
+
+ // recalculate width of elided text.
+ updateBackupLocation();
+}
+
+
+void Install::updateBackupLocation(void)
+{
+ ui.backupLocation->setText(QDir::toNativeSeparators(
+ fontMetrics().elidedText(tr("Backup to %1").arg(m_backupName),
+ Qt::ElideMiddle, ui.backupLocation->size().width())));
+}
+
+
void Install::backupCheckboxChanged(int state)
{
if(state == Qt::Checked)
{
- ui.backupLabel->show();
ui.backupLocation->show();
ui.changeBackup->show();
+ // update backup location display.
+ updateBackupLocation();
}
else
{
- ui.backupLabel->hide();
ui.backupLocation->hide();
ui.changeBackup->hide();
}
@@ -182,11 +201,12 @@ void Install::accept()
void Install::changeBackupPath()
{
- QString backupString = QFileDialog::getSaveFileName(this,"Select Backup Filename",m_backupName, "*.zip");
+ QString backupString = QFileDialog::getSaveFileName(this,
+ tr("Select Backup Filename"), m_backupName, "*.zip");
// only update if a filename was entered, ignore if cancelled
if(!backupString.isEmpty()) {
- ui.backupLocation->setText(QDir::toNativeSeparators(fontMetrics().elidedText(backupString,Qt::ElideMiddle,200)));
m_backupName = backupString;
+ updateBackupLocation();
}
}
diff --git a/rbutil/rbutilqt/install.h b/rbutil/rbutilqt/install.h
index 0df0f03499..6eed631956 100644
--- a/rbutil/rbutilqt/install.h
+++ b/rbutil/rbutilqt/install.h
@@ -38,8 +38,8 @@ class Install : public QDialog
public slots:
void accept(void);
-
- private:
+
+ private:
Ui::InstallFrm ui;
ProgressLoggerGui* logger;
RbSettings* settings;
@@ -50,8 +50,10 @@ class Install : public QDialog
ZipInstaller* installer;
QMap<QString, QString> version;
QString m_backupName;
+ void resizeEvent(QResizeEvent*);
void changeBackupPath(QString);
+ void updateBackupLocation(void);
private slots:
void setCached(bool);
diff --git a/rbutil/rbutilqt/installfrm.ui b/rbutil/rbutilqt/installfrm.ui
index bdb42d765d..472e773187 100644
--- a/rbutil/rbutilqt/installfrm.ui
+++ b/rbutil/rbutilqt/installfrm.ui
@@ -163,7 +163,7 @@
</property>
</widget>
</item>
- <item row="1" column="1" >
+ <item row="1" column="0" colspan="2" >
<widget class="QLabel" name="backupLocation" >
<property name="text" >
<string>Backup location</string>
@@ -189,30 +189,7 @@
</property>
</widget>
</item>
- <item row="1" column="0" >
- <widget class="QLabel" name="backupLabel" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="maximumSize" >
- <size>
- <width>120</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="text" >
- <string>Backup Location</string>
- </property>
- </widget>
- </item>
</layout>
- <zorder>backup</zorder>
- <zorder>backupLocation</zorder>
- <zorder>changeBackup</zorder>
- <zorder>backupLabel</zorder>
</widget>
</item>
<item row="5" column="1" >