diff --git a/qt5_src/Bootloader/Bootloader.pro b/qt5_src/Bootloader/Bootloader.pro index 04c78e2..78e487f 100644 --- a/qt5_src/Bootloader/Bootloader.pro +++ b/qt5_src/Bootloader/Bootloader.pro @@ -69,3 +69,5 @@ win32 { UI_DIR = windows RCC_DIR = windows } + +DISTFILES += diff --git a/qt5_src/Bootloader/IBMPlexSans-Light.ttf b/qt5_src/Bootloader/IBMPlexSans-Light.ttf new file mode 100644 index 0000000..761e3b7 Binary files /dev/null and b/qt5_src/Bootloader/IBMPlexSans-Light.ttf differ diff --git a/qt5_src/Bootloader/IBMPlexSans-Medium.ttf b/qt5_src/Bootloader/IBMPlexSans-Medium.ttf new file mode 100644 index 0000000..e7b9e78 Binary files /dev/null and b/qt5_src/Bootloader/IBMPlexSans-Medium.ttf differ diff --git a/qt5_src/Bootloader/IBMPlexSans-Regular.ttf b/qt5_src/Bootloader/IBMPlexSans-Regular.ttf new file mode 100644 index 0000000..b43625f Binary files /dev/null and b/qt5_src/Bootloader/IBMPlexSans-Regular.ttf differ diff --git a/qt5_src/Bootloader/MainWindow.cpp b/qt5_src/Bootloader/MainWindow.cpp index bdee66e..4070155 100644 --- a/qt5_src/Bootloader/MainWindow.cpp +++ b/qt5_src/Bootloader/MainWindow.cpp @@ -91,16 +91,17 @@ uint16_t DevicePID; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindowClass) { - int i; hexOpen = false; - fileWatcher = NULL; timer = new QTimer(); ui->setupUi(this); setWindowTitle(APPLICATION + QString(" v") + VERSION); - ui->menuBar->setVisible(false); - ui->mainToolBar->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); + //ui->menuBar->setVisible(false); + //ui->mainToolBar->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); + + // by default hide the advanced controls + on_checkBoxAdvancedMode_stateChanged(0); QSettings settings; settings.beginGroup("MainWindow"); @@ -131,10 +132,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi connect(comm, SIGNAL(SetProgressBar(int)), this, SLOT(UpdateProgressBar(int))); - this->statusBar()->addPermanentWidget(&deviceLabel); - deviceLabel.setText("Disconnected"); - - //Assume initally that the USB device that we are trying to find is using the default VID/PID. DeviceVID = DEFAULT_VID; DevicePID = DEFAULT_PID; @@ -207,8 +204,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi } else { - ui->plainTextEdit->appendPlainText("Device not detected. Verify device is attached and in firmware update mode."); - deviceLabel.setText("Disconnected"); + //ui->plainTextEdit->appendPlainText("Device not detected. Verify device is attached and in firmware update mode."); hexOpen = false; setBootloadEnabled(false); emit SetProgressBar(0); @@ -349,7 +345,6 @@ void MainWindow::Connection(void) { qWarning("Closing device."); comm->close(); - deviceLabel.setText("Disconnected"); ui->plainTextEdit->setPlainText("Device Detached."); hexOpen = false; setBootloadEnabled(false); @@ -1001,6 +996,34 @@ void MainWindow::on_actionErase_Device_triggered() future = QtConcurrent::run(this, &MainWindow::EraseDevice); } +void MainWindow::on_checkBoxAdvancedMode_stateChanged(int state) +{ + ui->groupBoxAdvanced->setVisible(state != 0); + + // handle adjustment of window height when advanced controls are hidden + if (state == 0) + { + /* + * Qt's adjustSize() method on widget objects will scale the widget to only fit its' children. + * This is useful for "collapsing" the window when the advanced controls are hidden, but will + * scale both the height and the width. We want to retain the current width but change the + * height, so first we will back up the min and max width values then set the current width as + * the fixed width to prevent it from being scaled. + */ + int minWidthBackup = minimumWidth(); + int maxWidthBackup = maximumWidth(); + setFixedWidth(width()); + + // perform the size adjustments + ui->centralWidget->adjustSize(); + adjustSize(); + + // restore the min/max width values so the width is no longer fixed + setMinimumWidth(minWidthBackup); + setMaximumWidth(maxWidthBackup); + } +} + void MainWindow::EraseDevice(void) { QTime elapsed; @@ -1265,7 +1288,7 @@ void MainWindow::GetQuery() case Comm::Success: wasBootloaderMode = true; ss << "Device Ready"; - deviceLabel.setText("Connected"); + //deviceLabel.setText("Connected"); break; default: return; diff --git a/qt5_src/Bootloader/MainWindow.h b/qt5_src/Bootloader/MainWindow.h index 5ea987a..fc4b04d 100644 --- a/qt5_src/Bootloader/MainWindow.h +++ b/qt5_src/Bootloader/MainWindow.h @@ -55,7 +55,7 @@ class MainWindow : public QMainWindow Q_OBJECT public: - MainWindow(QWidget *parent = 0); + MainWindow(QWidget *parent = NULL); ~MainWindow(); void GetQuery(void); @@ -91,7 +91,6 @@ protected: QFuture future; QString fileName, watchFileName; - QFileSystemWatcher* fileWatcher; QTimer *timer; bool writeFlash; @@ -106,7 +105,6 @@ protected: private: Ui::MainWindowClass *ui; - QLabel deviceLabel; int failed; QAction *recentFiles[MAX_RECENT_FILES]; @@ -122,6 +120,8 @@ private slots: void on_actionWrite_Device_triggered(); void on_btnFwBrowse_clicked(); void on_actionErase_Device_triggered(); + + void on_checkBoxAdvancedMode_stateChanged(int state); }; #endif // MAINWINDOW_H diff --git a/qt5_src/Bootloader/MainWindow.ui b/qt5_src/Bootloader/MainWindow.ui index a734fbb..8ebca88 100644 --- a/qt5_src/Bootloader/MainWindow.ui +++ b/qt5_src/Bootloader/MainWindow.ui @@ -6,16 +6,27 @@ 0 0 - 439 - 653 + 300 + 504 - + 0 0 + + + 300 + 0 + + + + + IBM Plex Sans + + USB HID Bootloader @@ -24,275 +35,547 @@ :/MainWindow/img/Microchip_logo.Ico:/MainWindow/img/Microchip_logo.Ico + + + 0 + 0 + + + + + 300 + 0 + + - - - - 10 - - - - Select Firmware File - - - - - - - - - background-color: rgb(200,200,200); -color: rgb(100,100,100); - - - more bingbus XD - - - true - - - - - - - Browse - - - - - - - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 10 - 50 - false - false - - - - Tool Status - - - - - - - Qt::Horizontal - - - - - - - 40 - - - - - Firmware - - - - - - - background-color: rgb(255, 0, 0); - - - NO FW FILE LOADED - - - Qt::AlignCenter - - - 2 - - - - - - - Device - - - - - - - background-color: rgb(255, 0, 0); - - - NOT DETECTED - - - Qt::AlignCenter - - - 2 - - - -1 - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 10 - - - - Tool Operation - - - - - - - Qt::Horizontal - - - - - - - - 350 - 0 - - - - true - - - - - - - 0 - - - false - - - - - - - false - + - + 0 0 - - - 0 - 60 - - + IBM Plex Sans Medium 14 - 75 - true - - FLASH FIRMWARE + + QGroupBox { + border: 1px solid gray; + border-radius: 9px; + margin-top: 1em; + padding-top: 0.5em; +} + +QGroupBox::title { + subcontrol-origin: margin; + left: 10px; + padding: 0 3px 0 3px; +} + + Step 1: Select App FW File + + + + 4 + + + + + + IBM Plex Sans + 10 + + + + + + + true + + + + + + + Browse + + + + - - - Qt::Horizontal - - - - - - - false - + - + 0 0 - - - 0 - 20 - + + + IBM Plex Sans Medium + 14 + - - Reset Device Normally + + QGroupBox { + border: 1px solid gray; + border-radius: 9px; + margin-top: 1em; + padding-top: 0.5em; +} + +QGroupBox::title { + subcontrol-origin: margin; + left: 10px; + padding: 0 3px 0 3px; +} + + Step 2: Flash FW to Device + + + + + + false + + + + 0 + 0 + + + + + 0 + 60 + + + + + MS Shell Dlg 2 + 14 + 75 + true + + + + FLASH FIRMWARE NOW + + + + + + + + IBM Plex Sans + 9 + + + + Flashing Progress + + + + + + + 0 + + + false + + + + - - - false + + + + 0 + 0 + - - - 0 - 20 - + + + IBM Plex Sans Medium + 14 + - - Reset Device into FW Update Mode + + QGroupBox { + border: 1px solid gray; + border-radius: 9px; + margin-top: 1em; + padding-top: 0.5em; +} + +QGroupBox::title { + subcontrol-origin: margin; + left: 10px; + padding: 0 3px 0 3px; +} + + Device Information + + + + 4 + + + + + 0 + + + + + + IBM Plex Sans Medium + 12 + + + + Status + + + + + + + + IBM Plex Sans Medium + 10 + + + + background-color: rgb(255, 0, 0); + + + Not Connected + + + 3 + + + 15 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 1 + 1 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + 16777215 + 25 + + + + + IBM Plex Sans Light + 10 + + + + Device not detected. Please connect the dancepad interface's USB cable to this computer. + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + + + + + + 10 + + + + Show Advanced + + + + + + + + 0 + 0 + + + + Qt::Horizontal + + + + + + + + + + 0 + 0 + + + + advmode + + + QGroupBox,QGroupBox::title { + border: none; + margin: 0; + padding: 0; +} + + + + + + + 0 + + + 0 + + + 0 + + + 6 + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 8 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + IBM Plex Sans Medium + 10 + + + + Bootloader Version: + + + + + + + + IBM Plex Sans + 10 + + + + 65.wat + + + + + + + + IBM Plex Sans Medium + 10 + + + + App FW Version: + + + + + + + + IBM Plex Sans + 10 + + + + 1.0.0 + + + + + + + + + + + + false + + + + 0 + 0 + + + + + 0 + 20 + + + + + IBM Plex Sans + + + + Reset Device + + + + + + + false + + + + 0 + 0 + + + + + 0 + 20 + + + + + IBM Plex Sans + + + + Reset Device into FW Update Mode + + + + + + + + + + 0 + 0 + + + + + IBM Plex Sans + 9 + + + + Status Messages + + + + + + + + 0 + 0 + + + + QAbstractScrollArea::AdjustIgnored + + + true + + + + @@ -302,8 +585,8 @@ color: rgb(100,100,100); 0 0 - 439 - 26 + 300 + 17 @@ -331,7 +614,6 @@ color: rgb(100,100,100); - Display Toolbar diff --git a/qt5_src/Bootloader/main.cpp b/qt5_src/Bootloader/main.cpp index ffae237..70b6a11 100644 --- a/qt5_src/Bootloader/main.cpp +++ b/qt5_src/Bootloader/main.cpp @@ -30,14 +30,21 @@ #include #include "MainWindow.h" +#include int main(int argc, char *argv[]) { + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QApplication a(argc, argv); QCoreApplication::setOrganizationName("JOJCorp"); QCoreApplication::setOrganizationDomain("source.jojcorp.com"); QCoreApplication::setApplicationName("Dancepad Interface FW Flash Tool"); + QFontDatabase::addApplicationFont(":/fonts/IBMPlexSans-Regular.ttf"); + QFontDatabase::addApplicationFont(":/fonts/IBMPlexSans-Medium.ttf"); + QFontDatabase::addApplicationFont(":/fonts/IBMPlexSans-Light.ttf"); + MainWindow w; w.show(); return a.exec(); diff --git a/qt5_src/Bootloader/resources.qrc b/qt5_src/Bootloader/resources.qrc index 399435c..992d560 100644 --- a/qt5_src/Bootloader/resources.qrc +++ b/qt5_src/Bootloader/resources.qrc @@ -11,4 +11,9 @@ img/help.png img/Microchip_logo.Ico + + IBMPlexSans-Regular.ttf + IBMPlexSans-Medium.ttf + IBMPlexSans-Light.ttf +