summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/rbutilqt.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-09-08 20:34:36 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-09-08 20:34:36 +0200
commit328ff6d979c028ecba9c57d12c1e75637be20396 (patch)
tree1373b766c7a1b0a6551816f105ee7447c0f602ae /rbutil/rbutilqt/rbutilqt.cpp
parent4f99dd4264f9aaaccbf3da6bba37d5b2c7eb6f32 (diff)
downloadrockbox-328ff6d979c028ecba9c57d12c1e75637be20396.tar.gz
rockbox-328ff6d979c028ecba9c57d12c1e75637be20396.tar.bz2
rockbox-328ff6d979c028ecba9c57d12c1e75637be20396.zip
Add "Eject" button to main window.
Since especially Windows puts the eject functionality behind an icon in the systray which is usually hidden and doesn't complain if a USB drive is unplugged without ejecting it first ejecting such a device might not be obvious to everyone. Add a button to the main window allowing to eject the selected player. Currently only implemented for Windows. Change-Id: I785ac1482cda03a1379cf6d0fd0d9a0ff8130092
Diffstat (limited to 'rbutil/rbutilqt/rbutilqt.cpp')
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 62a4f583f7..aa0c365303 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -110,6 +110,11 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
RegCloseKey(hk);
}
#endif
+
+#if !defined(Q_OS_WIN32)
+ /* eject funtionality is only implemented on W32 right now. */
+ ui.buttonEject->setEnabled(false);
+#endif
updateDevice();
downloadInfo();
@@ -142,6 +147,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(configDialog()));
connect(ui.actionE_xit, SIGNAL(triggered()), this, SLOT(shutdown()));
connect(ui.buttonChangeDevice, SIGNAL(clicked()), this, SLOT(configDialog()));
+ connect(ui.buttonEject, SIGNAL(clicked()), this, SLOT(eject()));
connect(ui.buttonTalk, SIGNAL(clicked()), this, SLOT(createTalkFiles()));
connect(ui.buttonCreateVoice, SIGNAL(clicked()), this, SLOT(createVoiceFile()));
connect(ui.buttonVoice, SIGNAL(clicked()), this, SLOT(installVoice()));
@@ -733,3 +739,19 @@ void RbUtilQt::changeEvent(QEvent *e)
}
}
+void RbUtilQt::eject(void)
+{
+ QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
+ if(Utils::ejectDevice(mountpoint)) {
+ QMessageBox::information(this, tr("Device ejected"),
+ tr("Device successfully ejected. "
+ "You may now disconnect the player from the PC."));
+ }
+ else {
+ QMessageBox::critical(this, tr("Ejecting failed"),
+ tr("Ejecting the device failed. Please make sure no programs "
+ "are accessing files on the device. If ejecting still "
+ "fails please use your computers eject funtionality."));
+ }
+}
+