Re: [linux-minidisc] netmd support for qhimdtransfer gui application
Hi,
i fixed some bugs in my last patch:
patch #9: reload current index of the local browser, will be cleared by
calling localmodel->setSelectableExtensions()
(can be applied anytime after patch #7)
patch #10: (not a bug but a new feature for windows users) add windows
usb driver installation support, needed for netmd devices,
(can be applied anytime after patch #8)
patch #11: fixed a bug in connect() function finding the device list
entry reserved for manual selected himd paths
(can be applied anytime after patch #9)
Thomas
>From 30c1240776de1ab47eac65e4aa6369523b75901f Mon Sep 17 00:00:00 2001
From: Thomas Arp <manner.moe@gmx.de>
Date: Sun, 22 Dec 2013 22:49:40 +0100
Subject: [PATCH 09/11] netmd support: reload the current index of the
localbrowser after calling localmodel->setSelectableExtensions()
---
qhimdtransfer/qhimdmainwindow.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/qhimdtransfer/qhimdmainwindow.cpp b/qhimdtransfer/qhimdmainwindow.cpp
index 0d90882..42281d3 100644
--- a/qhimdtransfer/qhimdmainwindow.cpp
+++ b/qhimdtransfer/qhimdmainwindow.cpp
@@ -132,6 +132,9 @@ void QHiMDMainWindow::open_device(QMDDevice * dev)
}
localmodel.setSelectableExtensions(current_device->downloadableFileExtensions());
+ QModelIndex curdir = localmodel.index(ui->updir->text());
+ ui->localScan->expand(curdir);
+ ui->localScan->setCurrentIndex(curdir);
ui->DiscTitle->setText(current_device->discTitle());
set_buttons_enable(1,0,0,1,1,1,1);
}
--
1.8.4.msysgit.0
>From 7bb23749cf632c19e7e006d5de8b6674a94a5791 Mon Sep 17 00:00:00 2001
From: Thomas Arp <manner.moe@gmx.de>
Date: Tue, 24 Dec 2013 22:54:35 +0100
Subject: [PATCH 10/11] netmd support: add support for usb driver installation
on windows
---
qhimdtransfer/icons.qrc | 1 +
qhimdtransfer/netmd_win_hint.txt | 39 ++++++++++++++++++
qhimdtransfer/qhimdtransfer.pro | 2 +
qhimdtransfer/qhimdwindetection.cpp | 79 +++++++++++++++++++++++++++++++++++++
4 files changed, 121 insertions(+)
create mode 100644 qhimdtransfer/netmd_win_hint.txt
diff --git a/qhimdtransfer/icons.qrc b/qhimdtransfer/icons.qrc
index 2f44f90..9b7d6e1 100755
--- a/qhimdtransfer/icons.qrc
+++ b/qhimdtransfer/icons.qrc
@@ -14,5 +14,6 @@
<file>icons/arrow_download.png</file>
<file>icons/arrow_upload.png</file>
<file>icons/qhimdtransfer_24.png</file>
+ <file>icons/qhimdtransfer_64.png</file>
</qresource>
</RCC>
diff --git a/qhimdtransfer/netmd_win_hint.txt b/qhimdtransfer/netmd_win_hint.txt
new file mode 100644
index 0000000..9184c7d
--- /dev/null
+++ b/qhimdtransfer/netmd_win_hint.txt
@@ -0,0 +1,39 @@
+How to install libusb compatible usb driver (WinUSB) for netmd devices:
+(Please read this instructions completely before installing the driver!)
+
+- connect your netmd device (or himddevice in netmd mode) to your computer via usb
+
+- run zadig_xp.exe if you are using Windows XP or zadig.exe for any later version of
+ windows, alternatively klick on "Install driver now" in the message box.
+
+- if your device is not listed in the combo box activate "list all devices" from "options"
+ menu first
+
+- select your netmd device from the combo box (e.g. "Net MD/HiMD")
+!!! Be sure to not select any "USB-HID" device, this should be mouse/keyboard or
+ something like this, they cannot be used anymore if you install the driver on it.
+
+Note: If you have more than one device you want to use QHimdTransfer with it is
+ recommended that you rename the device in the combo box by activating "Edit"
+ checkbox and edit the device name (e.g. "Net MD/HiMD" ->
+ "Sony MZ-RH1 NetMD" for Sony MZ-RH1, or anything else you want).
+
+- leave the <driver> section as it is, WinUSB driver works fine, the others may not
+ work correctly with the libusb version currently used
+
+- klick "Install WCID driver" to install the driver
+
+- If you get the "Driver was installed successfully" message you are done.
+ If this fails try to run zadig with root permissions and try again.
+
+You have to do this for ALL netmd devices you want to use QHiMDTransfer with.
+
+Important: The installed driver is not compatible with SonicStage!
+ For using the device with SonicStage you have to remove the driver first.
+ You can do this by opening windows device manager, find your device
+ at "Universal Serial Bus devices", right klick on it an choose "Uninstall"
+ After reconnection it can be used with SonicStage.
+
+If you select "Do not show this message again" you can find this driver installation
+instructions at netmd_win_hint.txt in the QHiMDTransfer programm folder if you need
+it for future reference.
diff --git a/qhimdtransfer/qhimdtransfer.pro b/qhimdtransfer/qhimdtransfer.pro
index 0fc2de1..6b250ab 100644
--- a/qhimdtransfer/qhimdtransfer.pro
+++ b/qhimdtransfer/qhimdtransfer.pro
@@ -101,3 +101,5 @@ unix:!macx {
target.path = /usr/bin
INSTALLS += target
}
+
+win32:OTHER_FILES += netmd_win_hint.txt
diff --git a/qhimdtransfer/qhimdwindetection.cpp b/qhimdtransfer/qhimdwindetection.cpp
index f5a9d0c..bc29d4d 100644
--- a/qhimdtransfer/qhimdwindetection.cpp
+++ b/qhimdtransfer/qhimdwindetection.cpp
@@ -2,6 +2,14 @@
#include <QtCore/QList>
#include <QWidget>
#include "qhimddetection.h"
+#include "QSettings"
+#include <QMessageBox>
+#include <QCheckBox>
+#include <QFile>
+#include <QString>
+#include <QPixmap>
+#include <QProcess>
+#include <QSysInfo>
#include <windows.h>
#include <dbt.h>
@@ -37,6 +45,8 @@ public:
private:
HDEVNOTIFY hDevNotify;
HDEVNOTIFY listen_usbdev;
+ void show_netmd_hint();
+ void install_netmd_driver();
QMDDevice *find_by_handle(HANDLE devhandle);
void add_himddevice(QString path, QString name);
virtual void remove_himddevice(QString path);
@@ -64,6 +74,8 @@ QHiMDWinDetection::QHiMDWinDetection(QObject * parent)
// register for usb device notifications
if((listen_usbdev = register_usbDeviceNotification()) == NULL)
qDebug() << "cannot register usb device notifications" << endl;
+
+ show_netmd_hint();
}
QHiMDWinDetection::~QHiMDWinDetection()
@@ -73,6 +85,73 @@ QHiMDWinDetection::~QHiMDWinDetection()
cleanup_netmd_list();
}
+/* show_netmd_hint() and install_netmd_driver() are used for libusb compatible usb driver installation for netmd devices,
+ * when compiling yourself be sure that netmd_win_hint.txt, zadig.exe and zadig_xp.exe are located in the same directory as QHiMDTransfer.exe.
+ *
+ * these files will be provided and installed by the QHiMDTransfer windows installer package automatically
+ */
+
+void QHiMDWinDetection::show_netmd_hint()
+{
+ QSettings settings;
+ QString netmdText = QMessageBox::tr("<center><b>Preparing netmd devices for use with QHiMDTransfer</b></center>");
+ // begin string with <...> quotes to indicate that this string is in Qt::RichText format
+ QString netmdInfoText = QMessageBox::tr("<qt>For each netmd device (and himd device in netmd mode) a libusb compatible driver must be installed first.<br><br>");
+ netmdInfoText.append(QMessageBox::tr("To do this connect your netmd device to your computer and klick on <b><i>Install driver now</i></b>,"));
+ netmdInfoText.append(QMessageBox::tr("alternatively install the driver later by running the usb driver installer (zadig.exe).<br>"));
+ netmdInfoText.append(QMessageBox::tr("You can find it inside the QHiMDTransfer programm folder.<br><br>"));
+ netmdInfoText.append(QMessageBox::tr("For a more detailed description on how to use the usb driver installer klick on <b><i>Show Details...</i></b></qt>"));
+
+ QString netmdDetails;
+ QMessageBox msg;
+ QPushButton *install;
+ QFile file("netmd_win_hint.txt");
+
+ if(settings.value("hide_netmd_hint", false).toBool())
+ return;
+
+ //read detailed information from textfile
+ if(file.open(QIODevice::ReadOnly | QIODevice::Text))
+ {
+ QTextStream details(&file);
+ netmdDetails = details.readAll();
+ }
+ else
+ netmdDetails = msg.tr("No detailed information available");
+
+ msg.setIconPixmap(QPixmap(":icons/qhimdtransfer_64.png"));
+ msg.setWindowTitle(msg.tr("Using NetMD Devices with QHiMDTransfer"));
+ msg.setText(netmdText);
+ msg.setInformativeText(netmdInfoText);
+ msg.setDetailedText(netmdDetails);
+
+ /* keep button order/location by using the same button role, else hideInfo checkbox will appear anywhere
+ * in the middle between the other buttons
+ */
+ QCheckBox hideInfo(hideInfo.tr("Do not show this message again"), &msg);
+ hideInfo.blockSignals(true); // prevent closing message box when checkbox is toggled
+ msg.addButton(&hideInfo, QMessageBox::NoRole);
+ install = msg.addButton("Install driver now", QMessageBox::NoRole);
+ msg.addButton("Install later", QMessageBox::NoRole);
+
+ msg.exec();
+ if((QPushButton*)msg.clickedButton() == install)
+ install_netmd_driver();
+
+ settings.setValue("hide_netmd_hint", hideInfo.checkState() == Qt::Checked);
+}
+
+void QHiMDWinDetection::install_netmd_driver()
+{
+ QProcess process;
+ QSysInfo sys;
+
+ if(sys.windowsVersion() < QSysInfo::WV_6_0)
+ process.execute("zadig_xp.exe");
+ else
+ process.execute("zadig.exe");
+}
+
void QHiMDWinDetection::scan_for_himd_devices()
{
unsigned long drives = GetLogicalDrives();
--
1.8.4.msysgit.0
>From f36722828f881deaa725bf6a2e44109c3c363eb9 Mon Sep 17 00:00:00 2001
From: Thomas Arp <manner.moe@gmx.de>
Date: Wed, 25 Dec 2013 20:22:03 +0100
Subject: [PATCH 11/11] fixed a bug in connect() function finding the correct
device entry for disc images/ manual selected himd device paths
---
qhimdtransfer/qhimdmainwindow.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qhimdtransfer/qhimdmainwindow.cpp b/qhimdtransfer/qhimdmainwindow.cpp
index 42281d3..1ce0278 100644
--- a/qhimdtransfer/qhimdmainwindow.cpp
+++ b/qhimdtransfer/qhimdmainwindow.cpp
@@ -235,7 +235,7 @@ void QHiMDMainWindow::on_action_Connect_triggered()
if(HiMDDirectory.isEmpty())
return;
- index = ui->himd_devices->findText("disc image");
+ index = ui->himd_devices->findText("disc image", Qt::MatchContains);
ui->himd_devices->setCurrentIndex(index); // index of disk image device
dev = (QHiMDDevice *)ui->himd_devices->itemData(index).value<void *>();
dev->setPath(HiMDDirectory);
--
1.8.4.msysgit.0