ledok
This commit is contained in:
parent
38b63542f3
commit
6a8c7e5cad
|
@ -130,7 +130,7 @@ void Downloader::startDownload (const QUrl& url)
|
||||||
|
|
||||||
/* Ensure that downloads directory exists */
|
/* Ensure that downloads directory exists */
|
||||||
if (!m_downloadDir.exists())
|
if (!m_downloadDir.exists())
|
||||||
m_downloadDir.mkpath(".");
|
m_downloadDir.mkpath(m_downloadDir.absolutePath());
|
||||||
|
|
||||||
/* Remove old downloads */
|
/* Remove old downloads */
|
||||||
QFile::remove (m_downloadDir.filePath (m_fileName));
|
QFile::remove (m_downloadDir.filePath (m_fileName));
|
||||||
|
|
|
@ -56,8 +56,8 @@ ProgPanel::ProgPanel(QSettings &settings, QWidget *parent) : QWidget(parent) {
|
||||||
auto item = new ProgItem(mProgsDir, dlg.fdName->text(), width, dlg.fdHeight->value(), dlg.fdRemark->toPlainText(), widths, max, mProgTree, this);
|
auto item = new ProgItem(mProgsDir, dlg.fdName->text(), width, dlg.fdHeight->value(), dlg.fdRemark->toPlainText(), widths, max, mProgTree, this);
|
||||||
item->save();//保存pro.json
|
item->save();//保存pro.json
|
||||||
mProgTree->adjustCheckState();
|
mProgTree->adjustCheckState();
|
||||||
ProgEditorWin editor(item, gMainWin);
|
auto editor = new ProgEditorWin(item, gMainWin);
|
||||||
editor.exec();
|
editor->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
bnEdit = new QPushButton(tr("Edit"));
|
bnEdit = new QPushButton(tr("Edit"));
|
||||||
|
@ -79,7 +79,7 @@ ProgPanel::ProgPanel(QSettings &settings, QWidget *parent) : QWidget(parent) {
|
||||||
bnImport->setProperty("ssType", "progManageTool");
|
bnImport->setProperty("ssType", "progManageTool");
|
||||||
hBox->addWidget(bnImport);
|
hBox->addWidget(bnImport);
|
||||||
connect(bnImport, &QPushButton::clicked, this, [this] {
|
connect(bnImport, &QPushButton::clicked, this, [this] {
|
||||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose Directory"), "/home", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
auto dir = QFileDialog::getExistingDirectory(this, tr("Choose Directory"), "/home", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
if(dir.isEmpty()) return;
|
if(dir.isEmpty()) return;
|
||||||
QString progsDir = programsDir();
|
QString progsDir = programsDir();
|
||||||
if(dir.contains(progsDir, Qt::CaseInsensitive)) {
|
if(dir.contains(progsDir, Qt::CaseInsensitive)) {
|
||||||
|
@ -328,8 +328,8 @@ void ProgPanel::onEditClicked(bool){
|
||||||
for(int i=0; i<cnt; i++) {
|
for(int i=0; i<cnt; i++) {
|
||||||
if(mProgTree->topLevelItem(i)->checkState(0) == Qt::Checked) {
|
if(mProgTree->topLevelItem(i)->checkState(0) == Qt::Checked) {
|
||||||
auto item = static_cast<ProgItem*>(mProgTree->topLevelItem(i));
|
auto item = static_cast<ProgItem*>(mProgTree->topLevelItem(i));
|
||||||
ProgEditorWin editor(item, gMainWin);
|
auto editor = new ProgEditorWin(item, gMainWin);
|
||||||
editor.exec();
|
editor->show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,8 +353,8 @@ void ProgPanel::onCreateNewProgramOnOpenEditProgramWidget(QString name, QSize re
|
||||||
auto item = new ProgItem(mProgsDir, name, res.width(), res.height(), remarks, splitWidths, max, mProgTree, this);
|
auto item = new ProgItem(mProgsDir, name, res.width(), res.height(), remarks, splitWidths, max, mProgTree, this);
|
||||||
item->save();//保存pro.json
|
item->save();//保存pro.json
|
||||||
mProgTree->adjustCheckState();
|
mProgTree->adjustCheckState();
|
||||||
ProgEditorWin editor(item, gMainWin);
|
auto editor = new ProgEditorWin(item, gMainWin);
|
||||||
editor.exec();
|
editor->show();
|
||||||
}
|
}
|
||||||
void ProgPanel::onDeleteClicked(bool){
|
void ProgPanel::onDeleteClicked(bool){
|
||||||
auto res = QMessageBox::information(this, tr("Tip Info"), tr("You will delete the selected solution(s),are you sure?"), QMessageBox::Ok, QMessageBox::Cancel);
|
auto res = QMessageBox::information(this, tr("Tip Info"), tr("You will delete the selected solution(s),are you sure?"), QMessageBox::Ok, QMessageBox::Cancel);
|
||||||
|
|
|
@ -14,7 +14,7 @@ void CopyDirThread::run() {
|
||||||
|
|
||||||
bool CopyDirThread::copyDir(const QString &fromDir, const QString &toDir, bool coverIfExist) {
|
bool CopyDirThread::copyDir(const QString &fromDir, const QString &toDir, bool coverIfExist) {
|
||||||
QDir targetDir(toDir);
|
QDir targetDir(toDir);
|
||||||
if(! targetDir.exists() && ! targetDir.mkdir(".")) return false;
|
if(! targetDir.exists() && ! targetDir.mkdir(toDir)) return false;
|
||||||
QFileInfoList fileInfos = QDir(fromDir).entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
|
QFileInfoList fileInfos = QDir(fromDir).entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
|
||||||
foreach(QFileInfo fileInfo, fileInfos) {
|
foreach(QFileInfo fileInfo, fileInfos) {
|
||||||
if(fileInfo.isDir()) { //< 当为目录时,递归的进行copy
|
if(fileInfo.isDir()) { //< 当为目录时,递归的进行copy
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "base/locolorselector.h"
|
#include "base/locolorselector.h"
|
||||||
#include "cfg.h"
|
|
||||||
#include "etext.h"
|
#include "etext.h"
|
||||||
#include "globaldefine.h"
|
#include "globaldefine.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
@ -636,7 +635,7 @@ QWidget* EText::attrWgt() {
|
||||||
|
|
||||||
bool EText::save(const QString &pageDir) {
|
bool EText::save(const QString &pageDir) {
|
||||||
QString idDir = pageDir + QString("/%1-%2-%3-%4-%5").arg(zValue()).arg((int)x()).arg((int)y()).arg((int)mWidth).arg((int)mHeight);
|
QString idDir = pageDir + QString("/%1-%2-%3-%4-%5").arg(zValue()).arg((int)x()).arg((int)y()).arg((int)mWidth).arg((int)mHeight);
|
||||||
QDir(idDir).mkdir(".");
|
QDir().mkpath(idDir);
|
||||||
for(int i=0; i<mImgs.count(); i++) mImgs[i].save(idDir + QString("/text%1.png").arg(i));
|
for(int i=0; i<mImgs.count(); i++) mImgs[i].save(idDir + QString("/text%1.png").arg(i));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,9 @@
|
||||||
#include "cfg.h"
|
#include "cfg.h"
|
||||||
#include "globaldefine.h"
|
#include "globaldefine.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "program/eaclock.h"
|
|
||||||
#include "program/eaudio.h"
|
#include "program/eaudio.h"
|
||||||
#include "program/edclock.h"
|
|
||||||
#include "program/eenviron.h"
|
#include "program/eenviron.h"
|
||||||
#include "program/egif.h"
|
|
||||||
#include "program/etext.h"
|
#include "program/etext.h"
|
||||||
#include "program/etimer.h"
|
|
||||||
#include "program/evideo.h"
|
#include "program/evideo.h"
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
@ -41,7 +37,7 @@ void GenTmpThread::run() {
|
||||||
|
|
||||||
QFile jsonFile(srcDir+"/pro.json");
|
QFile jsonFile(srcDir+"/pro.json");
|
||||||
if(! jsonFile.open(QIODevice::ReadOnly)) {
|
if(! jsonFile.open(QIODevice::ReadOnly)) {
|
||||||
onErr("Can't open "+srcDir+"/pro.json");
|
emit onErr("Can't open "+srcDir+"/pro.json");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto data = jsonFile.readAll();
|
auto data = jsonFile.readAll();
|
||||||
|
@ -49,7 +45,7 @@ void GenTmpThread::run() {
|
||||||
QJsonParseError error;
|
QJsonParseError error;
|
||||||
auto proJson = QJsonDocument::fromJson(data, &error);
|
auto proJson = QJsonDocument::fromJson(data, &error);
|
||||||
if(error.error != QJsonParseError::NoError) {
|
if(error.error != QJsonParseError::NoError) {
|
||||||
onErr("Parse "+srcDir+"/pro.json Error: "+error.errorString());
|
emit onErr("Parse "+srcDir+"/pro.json Error: "+error.errorString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,9 +94,15 @@ void GenTmpThread::run() {
|
||||||
|
|
||||||
//如果是usb更新则生成压缩包,网络发送则不需要
|
//如果是usb更新则生成压缩包,网络发送则不需要
|
||||||
if(! zip_file.isEmpty()) {
|
if(! zip_file.isEmpty()) {
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
QStringList args{"a", zip_file, dstDir+"/*"};
|
QStringList args{"a", zip_file, dstDir+"/*"};
|
||||||
if(! password.isEmpty()) args << "-p"+password;
|
if(! password.isEmpty()) args << "-p"+password;
|
||||||
QProcess::execute("7z.exe", args);
|
QProcess::execute("7z.exe", args);
|
||||||
|
#else
|
||||||
|
QStringList args{"-r", zip_file, dstDir};
|
||||||
|
if(! password.isEmpty()) args << "-P "+password;
|
||||||
|
QProcess::execute("zip", args);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void PageListItem::updateJson() {
|
||||||
bool PageListItem::saveFiles() {
|
bool PageListItem::saveFiles() {
|
||||||
mPageDir = gProgItem->mProgDir + "/" + mAttr["name"].toString();
|
mPageDir = gProgItem->mProgDir + "/" + mAttr["name"].toString();
|
||||||
QDir pageQDir(mPageDir);
|
QDir pageQDir(mPageDir);
|
||||||
if(! pageQDir.exists() && ! pageQDir.mkpath(".")) return false;
|
if(! pageQDir.exists() && ! pageQDir.mkpath(mPageDir)) return false;
|
||||||
|
|
||||||
QJsonArray elements;
|
QJsonArray elements;
|
||||||
auto items = mScene->items();
|
auto items = mScene->items();
|
||||||
|
|
|
@ -37,16 +37,23 @@
|
||||||
ProgItem *gProgItem{0};
|
ProgItem *gProgItem{0};
|
||||||
QWidget *gProgEditorWin;
|
QWidget *gProgEditorWin;
|
||||||
|
|
||||||
ProgEditorWin::ProgEditorWin(ProgItem *progItem, QWidget *parent) : QDialog(parent), mProgItem(progItem) {
|
ProgEditorWin::ProgEditorWin(ProgItem *progItem, QWidget *parent) : QWidget(parent), mProgItem(progItem) {
|
||||||
gProgEditorWin = this;
|
gProgEditorWin = this;
|
||||||
gProgItem = progItem;
|
gProgItem = progItem;
|
||||||
setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
setWindowFlag(Qt::WindowMaximizeButtonHint);
|
#ifdef Q_OS_WINDOWS
|
||||||
|
setWindowFlag(Qt::Window);
|
||||||
|
setWindowModality(Qt::WindowModal);
|
||||||
|
#else
|
||||||
|
setWindowFlag(Qt::Dialog);
|
||||||
|
#endif
|
||||||
setAttribute(Qt::WA_AlwaysShowToolTips);
|
setAttribute(Qt::WA_AlwaysShowToolTips);
|
||||||
if(parent && ! parent->isMaximized()) resize(parent->size());
|
if(! parent->isMaximized()) resize(parent->size());
|
||||||
else resize(1280, 720);
|
else resize(1280, 720);
|
||||||
setWindowTitle(progItem->mName);
|
setWindowTitle(progItem->mName);
|
||||||
|
|
||||||
|
parent->setVisible(false);
|
||||||
|
|
||||||
auto vBox = new QVBoxLayout(this);
|
auto vBox = new QVBoxLayout(this);
|
||||||
vBox->setContentsMargins(0, 0, 0, 0);
|
vBox->setContentsMargins(0, 0, 0, 0);
|
||||||
vBox->setSpacing(0);
|
vBox->setSpacing(0);
|
||||||
|
@ -532,7 +539,7 @@ ProgEditorWin::ProgEditorWin(ProgItem *progItem, QWidget *parent) : QDialog(pare
|
||||||
foreach(QJsonObject pageJson, mPageJsons) {
|
foreach(QJsonObject pageJson, mPageJsons) {
|
||||||
auto pageDir = mProgItem->mProgDir+"/"+pageJson["name"].toString();
|
auto pageDir = mProgItem->mProgDir+"/"+pageJson["name"].toString();
|
||||||
QDir dir(pageDir);
|
QDir dir(pageDir);
|
||||||
if(! dir.exists() && ! dir.mkdir(".")) continue;
|
if(! dir.exists() && ! dir.mkdir(pageDir)) continue;
|
||||||
auto item = new PageListItem(pageJson, pageDir);
|
auto item = new PageListItem(pageJson, pageDir);
|
||||||
listPage->addItem(item);
|
listPage->addItem(item);
|
||||||
listPage->setItemWidget(item, item->itemWgt());
|
listPage->setItemWidget(item, item->itemWgt());
|
||||||
|
@ -554,10 +561,12 @@ void ProgEditorWin::closeEvent(QCloseEvent *event) {
|
||||||
mProgItem->m_last = QDateTime::currentDateTime();
|
mProgItem->m_last = QDateTime::currentDateTime();
|
||||||
mProgItem->m_fsize = dirFileSize(mProgItem->mProgDir);
|
mProgItem->m_fsize = dirFileSize(mProgItem->mProgDir);
|
||||||
mProgItem->onSetProgram();
|
mProgItem->onSetProgram();
|
||||||
if(! isProgChanged()) return;
|
if(isProgChanged()) {
|
||||||
auto res = QMessageBox::question(this, tr("Tip Info"), tr("Do you want to save the modifications?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel);
|
auto res = QMessageBox::question(this, tr("Tip Info"), tr("Do you want to save the modifications?"), QMessageBox::Yes, QMessageBox::No, QMessageBox::Cancel);
|
||||||
if(res == QMessageBox::Yes) onSave();
|
if(res == QMessageBox::Yes) onSave();
|
||||||
else if(res == QMessageBox::Cancel) event->ignore();
|
else if(res == QMessageBox::Cancel) event->ignore();
|
||||||
|
}
|
||||||
|
parentWidget()->setVisible(true);
|
||||||
}
|
}
|
||||||
//停止每个页面元素的播放,将节目目录下的每个页面的文件夹另命名
|
//停止每个页面元素的播放,将节目目录下的每个页面的文件夹另命名
|
||||||
void ProgEditorWin::save() {
|
void ProgEditorWin::save() {
|
||||||
|
@ -568,7 +577,7 @@ void ProgEditorWin::save() {
|
||||||
foreach(auto item, items) static_cast<EBase*>(item)->freeFiles();
|
foreach(auto item, items) static_cast<EBase*>(item)->freeFiles();
|
||||||
}
|
}
|
||||||
QDir progDir(mProgItem->mProgDir);
|
QDir progDir(mProgItem->mProgDir);
|
||||||
if(! progDir.exists() && ! progDir.mkdir(".")) return;
|
if(! progDir.exists() && ! progDir.mkdir(mProgItem->mProgDir)) return;
|
||||||
QStringList pageNames = progDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
|
QStringList pageNames = progDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
|
||||||
foreach(QString pageName, pageNames) {
|
foreach(QString pageName, pageNames) {
|
||||||
if(! progDir.rename(pageName, pageName + PAGEDEL_SUFFIX)) QMessageBox::critical(this, tr("Error"), tr("Rename fail when saving")+" "+pageName);
|
if(! progDir.rename(pageName, pageName + PAGEDEL_SUFFIX)) QMessageBox::critical(this, tr("Error"), tr("Rename fail when saving")+" "+pageName);
|
||||||
|
@ -625,7 +634,7 @@ void ProgEditorWin::onAddPage() {
|
||||||
auto name = now.toString("yyyyMMddhhmmsszzz");
|
auto name = now.toString("yyyyMMddhhmmsszzz");
|
||||||
auto pageDir = mProgItem->mProgDir+"/"+name;
|
auto pageDir = mProgItem->mProgDir+"/"+name;
|
||||||
QDir dir(pageDir);
|
QDir dir(pageDir);
|
||||||
if(! dir.exists() && ! dir.mkpath(".")) return;
|
if(! dir.exists() && ! dir.mkpath(pageDir)) return;
|
||||||
QJsonObject attr;
|
QJsonObject attr;
|
||||||
attr["name"] = name;
|
attr["name"] = name;
|
||||||
attr["order"] = listPage->count();
|
attr["order"] = listPage->count();
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
#ifndef PROGEDITORWIN_H
|
#ifndef PROGEDITORWIN_H
|
||||||
#define PROGEDITORWIN_H
|
#define PROGEDITORWIN_H
|
||||||
#include "QtWidgets/qdialog.h"
|
|
||||||
#include "program/pageeditor.h"
|
#include "program/pageeditor.h"
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
|
||||||
class ProgPanel;
|
class ProgPanel;
|
||||||
class ProgItem;
|
class ProgItem;
|
||||||
class ProgEditorWin : public QDialog {
|
class ProgEditorWin : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ProgEditorWin(ProgItem *progItem, QWidget *parent = 0);
|
explicit ProgEditorWin(ProgItem *progItem, QWidget *);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onSave();
|
void onSave();
|
||||||
|
|
|
@ -63,8 +63,8 @@ QPushButton:hover {
|
||||||
m_bnName->setCursor(QCursor(Qt::PointingHandCursor));
|
m_bnName->setCursor(QCursor(Qt::PointingHandCursor));
|
||||||
mTree->setItemWidget(this, ENUM_PROGRAMLISTHEADERITEM_NAME, m_bnName);
|
mTree->setItemWidget(this, ENUM_PROGRAMLISTHEADERITEM_NAME, m_bnName);
|
||||||
connect(m_bnName, &QPushButton::clicked, this, [this] {
|
connect(m_bnName, &QPushButton::clicked, this, [this] {
|
||||||
ProgEditorWin editor(this, gMainWin);
|
auto editor = new ProgEditorWin(this, gMainWin);
|
||||||
editor.exec();
|
editor->show();
|
||||||
});
|
});
|
||||||
m_bnExport = new QPushButton();
|
m_bnExport = new QPushButton();
|
||||||
m_bnExport->setCursor(QCursor(Qt::PointingHandCursor));
|
m_bnExport->setCursor(QCursor(Qt::PointingHandCursor));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "usbdetectdialog.h"
|
#include "usbdetectdialog.h"
|
||||||
#include <QVBoxLayout>
|
#include "gutil/qgui.h"
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
@ -8,23 +8,14 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTimerEvent>
|
#include <QTimerEvent>
|
||||||
|
|
||||||
UsbDetectDialog::UsbDetectDialog(QWidget *parent) : BaseDlg(parent) {
|
UsbDetectDialog::UsbDetectDialog(QWidget *parent) : QDialog(parent) {
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
setWindowTitle(tr("Usb upgrade program"));
|
setWindowTitle(tr("Usb upgrade program"));
|
||||||
resize(240, 220);
|
resize(240, 220);
|
||||||
auto vBox = new QVBoxLayout(this);
|
|
||||||
|
|
||||||
auto hBox = new QHBoxLayout();
|
auto vBox = new VBox(this);
|
||||||
hBox->addStretch();
|
auto hBox = new HBox(vBox);
|
||||||
auto bnClose = new QPushButton("X");
|
|
||||||
bnClose->setProperty("ssType","progManageTool");
|
|
||||||
bnClose->setFixedWidth(32);
|
|
||||||
connect(bnClose, &QPushButton::clicked, this, &BaseDlg::close);
|
|
||||||
hBox->addWidget(bnClose);
|
|
||||||
|
|
||||||
vBox->addLayout(hBox);
|
|
||||||
|
|
||||||
hBox = new QHBoxLayout();
|
|
||||||
hBox->addWidget(new QLabel(tr("Password")));
|
hBox->addWidget(new QLabel(tr("Password")));
|
||||||
|
|
||||||
fdPassword = new QLineEdit();
|
fdPassword = new QLineEdit();
|
||||||
|
@ -32,22 +23,20 @@ UsbDetectDialog::UsbDetectDialog(QWidget *parent) : BaseDlg(parent) {
|
||||||
fdPassword->setPlaceholderText(tr("Input password"));
|
fdPassword->setPlaceholderText(tr("Input password"));
|
||||||
hBox->addWidget(fdPassword);
|
hBox->addWidget(fdPassword);
|
||||||
|
|
||||||
vBox->addLayout(hBox);
|
|
||||||
|
|
||||||
fdDrives = new QListWidget();
|
fdDrives = new QListWidget();
|
||||||
fdDrives->setSelectionRectVisible(true);
|
fdDrives->setSelectionRectVisible(true);
|
||||||
fdDrives->setProperty("ssType", "usbList");
|
fdDrives->setProperty("ssType", "usbList");
|
||||||
fdDrives->setProperty("ssName", "usbListName");
|
fdDrives->setProperty("ssName", "usbListName");
|
||||||
vBox->addWidget(fdDrives);
|
vBox->addWidget(fdDrives);
|
||||||
|
|
||||||
hBox = new QHBoxLayout();
|
hBox = new HBox(vBox);
|
||||||
hBox->addStretch();
|
hBox->addStretch();
|
||||||
auto bnOk = new QPushButton(tr("OK"));
|
auto bnOk = new QPushButton(tr("OK"));
|
||||||
bnOk->setProperty("ssType","progManageTool");
|
bnOk->setProperty("ssType","progManageTool");
|
||||||
connect(bnOk, &QPushButton::clicked, this, [this] {
|
connect(bnOk, &QPushButton::clicked, this, [this] {
|
||||||
auto selects = fdDrives->selectedItems();
|
auto selects = fdDrives->selectedItems();
|
||||||
if(selects.count() > 0) {
|
if(selects.count() > 0) {
|
||||||
for(auto select : selects) emit acceptData(select->text(), fdPassword->text());
|
foreach(auto select, selects) emit acceptData(select->text(), fdPassword->text());
|
||||||
accept();
|
accept();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -58,16 +47,19 @@ UsbDetectDialog::UsbDetectDialog(QWidget *parent) : BaseDlg(parent) {
|
||||||
hBox->addStretch();
|
hBox->addStretch();
|
||||||
auto bnCancel = new QPushButton(tr("Cancel"));
|
auto bnCancel = new QPushButton(tr("Cancel"));
|
||||||
bnCancel->setProperty("ssType","progManageTool");
|
bnCancel->setProperty("ssType","progManageTool");
|
||||||
connect(bnCancel, &QPushButton::clicked, this, &BaseDlg::reject);
|
connect(bnCancel, &QPushButton::clicked, this, &QDialog::reject);
|
||||||
hBox->addWidget(bnCancel);
|
hBox->addWidget(bnCancel);
|
||||||
hBox->addStretch();
|
hBox->addStretch();
|
||||||
vBox->addLayout(hBox);
|
|
||||||
|
|
||||||
detectDriver();
|
detectDriver();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsbDetectDialog::detectDriver() {
|
void UsbDetectDialog::detectDriver() {
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
auto drives = QDir::drives(); //获取当前系统的盘符
|
auto drives = QDir::drives(); //获取当前系统的盘符
|
||||||
|
#else
|
||||||
|
auto drives = QDir("/Volumes").entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
#endif
|
||||||
fdDrives->clear();
|
fdDrives->clear();
|
||||||
foreach(auto drive, drives) fdDrives->addItem(drive.filePath());
|
foreach(auto drive, drives) fdDrives->addItem(drive.fileName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#ifndef USBDETECTDIALOG_H
|
#ifndef USBDETECTDIALOG_H
|
||||||
#define USBDETECTDIALOG_H
|
#define USBDETECTDIALOG_H
|
||||||
|
|
||||||
#include <basedlg.h>
|
#include <QDialog>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
|
||||||
class UsbDetectDialog : public BaseDlg {
|
class UsbDetectDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit UsbDetectDialog(QWidget *parent = nullptr);
|
explicit UsbDetectDialog(QWidget *parent = 0);
|
||||||
signals:
|
signals:
|
||||||
void acceptData(QString string1, QString string2);
|
void acceptData(QString string1, QString string2);
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user