Skip to content

Commit

Permalink
Update davis_gui.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeryStk committed Nov 15, 2024
1 parent 90ae70a commit a692fd7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions gui/davis_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <QJsonArray>
#include "json_utils.h"
#include "QDateTime"
#include <QProcess>

DavisGUI::DavisGUI(QWidget* parent)
: QMainWindow(parent)
Expand Down Expand Up @@ -220,16 +221,25 @@ void DavisGUI::dragEnterEvent(QDragEnterEvent* event) {
void DavisGUI::dropEvent(QDropEvent* event) {
QString filePath = event->mimeData()->urls().first().toLocalFile();
QFileInfo info(filePath);
qDebug() << "---file path--->" << filePath;
if (info.exists()) {
qDebug() << "exist";
QFile file(filePath);
QTextStream ts(&file);
ts.setCodec("UTF-8");
if (file.open(QIODevice::ReadWrite) == false) {
dvs::showReportFileNotFounded();
return;
};

QString suffix = info.suffix();
QStringList suffixes = {"jpg","bmp","png","svg","mp4","json"};
for(int i=0;i<suffixes.size();++i){
if(suffix == suffixes[i]){
QProcess process;
process.startDetached("cmd.exe", QStringList() << "/C" << filePath);
return;
}
}

QString line;
QStringList str_lines;
while (ts.readLineInto(&line)) {
Expand Down

0 comments on commit a692fd7

Please sign in to comment.