ledok
This commit is contained in:
parent
2ae750ce90
commit
77e0555343
|
@ -136,7 +136,6 @@ SOURCES += \
|
||||||
program/progitem.cpp \
|
program/progitem.cpp \
|
||||||
program/sendprogramdialog.cpp \
|
program/sendprogramdialog.cpp \
|
||||||
program/sendprogthread.cpp \
|
program/sendprogthread.cpp \
|
||||||
program/usbdetectdialog.cpp \
|
|
||||||
program/videosplitthread.cpp \
|
program/videosplitthread.cpp \
|
||||||
program/wplanitem.cpp \
|
program/wplanitem.cpp \
|
||||||
program/wplanlist.cpp \
|
program/wplanlist.cpp \
|
||||||
|
@ -225,7 +224,6 @@ HEADERS += \
|
||||||
program/progitem.h \
|
program/progitem.h \
|
||||||
program/sendprogramdialog.h \
|
program/sendprogramdialog.h \
|
||||||
program/sendprogthread.h \
|
program/sendprogthread.h \
|
||||||
program/usbdetectdialog.h \
|
|
||||||
program/videosplitthread.h \
|
program/videosplitthread.h \
|
||||||
program/wplanitem.h \
|
program/wplanitem.h \
|
||||||
program/wplanlist.h \
|
program/wplanlist.h \
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
#include "progitem.h"
|
#include "progitem.h"
|
||||||
|
#include "progpanel.h"
|
||||||
|
#include "QtWidgets/qdialogbuttonbox.h"
|
||||||
|
#include "QtWidgets/qlineedit.h"
|
||||||
#include "gutil/qcore.h"
|
#include "gutil/qcore.h"
|
||||||
|
#include "gutil/qgui.h"
|
||||||
|
#include "base/waitingdlg.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "progeditorwin.h"
|
#include "progeditorwin.h"
|
||||||
#include "base/waitingdlg.h"
|
#include "base/waitingdlg.h"
|
||||||
#include "gentmpthread.h"
|
#include "gentmpthread.h"
|
||||||
#include "base/loemptydialog.h"
|
|
||||||
#include "usbdetectdialog.h"
|
|
||||||
#include <globaldefine.h>
|
#include <globaldefine.h>
|
||||||
#include "sendprogramdialog.h"
|
#include "sendprogramdialog.h"
|
||||||
#include "mainwindow.h"
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QStorageInfo>
|
||||||
|
|
||||||
ProgItem::ProgItem(const QString &progsDir, const QString &name, int w, int h, const QString &remarks, QList<int> &splitWidths, int maxWidth, LoQTreeWidget *tree, ProgPanel *progPanel) : QTreeWidgetItem(UserType),
|
ProgItem::ProgItem(const QString &progsDir, const QString &name, int w, int h, const QString &remarks, QList<int> &splitWidths, int maxWidth, LoQTreeWidget *tree, ProgPanel *progPanel) : QTreeWidgetItem(UserType),
|
||||||
mName(name), mWidth(w), mHeight(h), mRemark(remarks), mSplitWidths(splitWidths), mMaxWidth(maxWidth), mProgsDir(progsDir), mProgPanel(progPanel), mTree(tree) {
|
mName(name), mWidth(w), mHeight(h), mRemark(remarks), mSplitWidths(splitWidths), mMaxWidth(maxWidth), mProgsDir(progsDir), mProgPanel(progPanel), mTree(tree) {
|
||||||
|
@ -145,18 +149,53 @@ void ProgItem::onSetProgram() {
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgItem::onUsbExportProgram(){
|
void ProgItem::onUsbExportProgram() {
|
||||||
UsbDetectDialog dlg(gMainWin);
|
QDialog dlg(gMainWin);
|
||||||
connect(&dlg, &UsbDetectDialog::acceptData, this, &ProgItem::onUsbExportProgramPro);
|
dlg.setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
|
||||||
dlg.exec();
|
dlg.setWindowTitle(tr("Usb upgrade program"));
|
||||||
}
|
dlg.resize(300, 260);
|
||||||
void ProgItem::onUsbExportProgramPro(QString strPath, QString strPassword) {
|
|
||||||
|
auto vBox = new VBox(&dlg);
|
||||||
|
auto hBox = new HBox(vBox);
|
||||||
|
|
||||||
|
hBox->addWidget(new QLabel(tr("Password")));
|
||||||
|
|
||||||
|
auto fdPassword = new QLineEdit;
|
||||||
|
fdPassword->setEchoMode(QLineEdit::Password);
|
||||||
|
fdPassword->setPlaceholderText(tr("Input password"));
|
||||||
|
hBox->addWidget(fdPassword);
|
||||||
|
|
||||||
|
auto fdDrives = new ListWgt;
|
||||||
|
fdDrives->setSelectionRectVisible(true);
|
||||||
|
vBox->addWidget(fdDrives);
|
||||||
|
|
||||||
|
auto btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
connect(btnBox, &QDialogButtonBox::accepted, &dlg, [=, &dlg] {
|
||||||
|
auto selects = fdDrives->selectedItems();
|
||||||
|
if(selects.count() > 0) {
|
||||||
|
foreach(auto select, selects) {
|
||||||
|
auto strPath = select->data(Qt::UserRole).toString();
|
||||||
auto waitingDlg = new WaitingDlg(mProgPanel, tr("Convertering")+" ...");
|
auto waitingDlg = new WaitingDlg(mProgPanel, tr("Convertering")+" ...");
|
||||||
auto converter = new GenTmpThread(this, mName, strPath + (strPath.endsWith('/') ? "program.zip" : "/program.zip"), strPassword, this);
|
auto converter = new GenTmpThread(this, mName, strPath + (strPath.endsWith('/') ? "program.zip" : "/program.zip"), fdPassword->text(), this);
|
||||||
connect(converter, &QThread::finished, waitingDlg, &WaitingDlg::success);
|
connect(converter, &QThread::finished, waitingDlg, &WaitingDlg::success);
|
||||||
connect(converter, &GenTmpThread::sProgress, waitingDlg->mIndicator, &CustomProgressIndicator::onProgress);
|
connect(converter, &GenTmpThread::sProgress, waitingDlg->mIndicator, &CustomProgressIndicator::onProgress);
|
||||||
converter->start();
|
converter->start();
|
||||||
waitingDlg->exec();
|
waitingDlg->exec();
|
||||||
|
}
|
||||||
|
dlg.accept();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(fdDrives->count() <= 0) QMessageBox::warning(&dlg, tr("Tip"),tr("No checked USB device"));
|
||||||
|
else QMessageBox::warning(&dlg, tr("Tip"),tr("please select usb device in list"));
|
||||||
|
});
|
||||||
|
connect(btnBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject);
|
||||||
|
vBox->addWidget(btnBox);
|
||||||
|
|
||||||
|
fdDrives->clear();
|
||||||
|
auto volumes = QStorageInfo::mountedVolumes();
|
||||||
|
foreach(auto volume, volumes) fdDrives->addItem(volume.displayName(), volume.rootPath());
|
||||||
|
|
||||||
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgItem::onSendProgram() {
|
void ProgItem::onSendProgram() {
|
||||||
|
|
|
@ -37,7 +37,6 @@ public slots:
|
||||||
void onSetProgram();
|
void onSetProgram();
|
||||||
void onSendProgram();
|
void onSendProgram();
|
||||||
void onUsbExportProgram();
|
void onUsbExportProgram();
|
||||||
void onUsbExportProgramPro(QString strPath,QString strPassword);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
#include "usbdetectdialog.h"
|
|
||||||
#include "gutil/qgui.h"
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QDialogButtonBox>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QStorageInfo>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QTimerEvent>
|
|
||||||
|
|
||||||
UsbDetectDialog::UsbDetectDialog(QWidget *parent) : QDialog(parent) {
|
|
||||||
setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
|
|
||||||
setWindowTitle(tr("Usb upgrade program"));
|
|
||||||
resize(300, 260);
|
|
||||||
|
|
||||||
auto vBox = new VBox(this);
|
|
||||||
auto hBox = new HBox(vBox);
|
|
||||||
|
|
||||||
hBox->addWidget(new QLabel(tr("Password")));
|
|
||||||
|
|
||||||
fdPassword = new QLineEdit();
|
|
||||||
fdPassword->setEchoMode(QLineEdit::Password);
|
|
||||||
fdPassword->setPlaceholderText(tr("Input password"));
|
|
||||||
hBox->addWidget(fdPassword);
|
|
||||||
|
|
||||||
fdDrives = new ListWgt;
|
|
||||||
fdDrives->setSelectionRectVisible(true);
|
|
||||||
vBox->addWidget(fdDrives);
|
|
||||||
|
|
||||||
auto btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
|
||||||
connect(btnBox, &QDialogButtonBox::accepted, this, [this] {
|
|
||||||
auto selects = fdDrives->selectedItems();
|
|
||||||
if(selects.count() > 0) {
|
|
||||||
foreach(auto select, selects) emit acceptData(select->data(Qt::UserRole).toString(), fdPassword->text());
|
|
||||||
accept();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(fdDrives->count() <= 0) QMessageBox::warning(this, tr("Tip"),tr("No checked USB device"));
|
|
||||||
else QMessageBox::warning(this, tr("Tip"),tr("please select usb device in list"));
|
|
||||||
});
|
|
||||||
connect(btnBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
|
||||||
vBox->addWidget(btnBox);
|
|
||||||
|
|
||||||
detectDriver();
|
|
||||||
}
|
|
||||||
#include <QDebug>
|
|
||||||
void UsbDetectDialog::detectDriver() {
|
|
||||||
fdDrives->clear();
|
|
||||||
//#ifdef Q_OS_WINDOWS
|
|
||||||
auto volumes = QStorageInfo::mountedVolumes();
|
|
||||||
foreach(auto volume, volumes) fdDrives->addItem(volume.displayName(), volume.rootPath());
|
|
||||||
foreach(auto volume, volumes) {
|
|
||||||
qDebug() << "rootPath" << volume.rootPath();
|
|
||||||
qDebug() << "device" << volume.device();
|
|
||||||
qDebug() << "name" << volume.name();
|
|
||||||
qDebug() << "displayName" << volume.displayName();
|
|
||||||
}
|
|
||||||
//#else
|
|
||||||
// auto drives = QDir("/Volumes").entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
|
||||||
//foreach(auto drive, drives) fdDrives->addItem(drive.fileName(), drive.filePath());
|
|
||||||
//#endif
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
#ifndef USBDETECTDIALOG_H
|
|
||||||
#define USBDETECTDIALOG_H
|
|
||||||
|
|
||||||
#include "gutil/qgui.h"
|
|
||||||
#include <QDialog>
|
|
||||||
|
|
||||||
class UsbDetectDialog : public QDialog {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit UsbDetectDialog(QWidget *parent = 0);
|
|
||||||
signals:
|
|
||||||
void acceptData(QString string1, QString string2);
|
|
||||||
private:
|
|
||||||
void detectDriver();
|
|
||||||
ListWgt *fdDrives;
|
|
||||||
QLineEdit *fdPassword;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // USBDETECTDIALOG_H
|
|
Loading…
Reference in New Issue
Block a user