Create function, add path data and interaction
This commit is contained in:
parent
3048920666
commit
332fa2bc0b
@ -1,6 +1,9 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
@ -11,4 +14,82 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
delete currentPath;
|
||||||
|
|
||||||
|
for(Path* p : path) {
|
||||||
|
delete p;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::updatePathView()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateStepView(size_t num)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onTextChanged()
|
||||||
|
{
|
||||||
|
textChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::loadPath(QTextStream &in)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::addNewPath()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::addNewStep()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::exportHTMLMap()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_pushButton_clicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
QString ext[] = {"png", "jpeg", "jpg"};
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
|
||||||
|
if (fileName.isEmpty()) return;
|
||||||
|
QFile file(fileName);
|
||||||
|
if (!file.open(QIODevice::ReadOnly | QFile::Text)) {
|
||||||
|
QMessageBox::warning(this, "Warning", "Cannot open file: " +
|
||||||
|
file.errorString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString text = file.fileName();
|
||||||
|
|
||||||
|
bool acceptedExt = false;
|
||||||
|
for(QString e : ext) {
|
||||||
|
if(text.endsWith(e)) acceptedExt = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!acceptedExt) {
|
||||||
|
QMessageBox::warning(this, "Warning", "Format de fichier incorrect");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ui->imagePath->setText(text);
|
||||||
|
|
||||||
|
|
||||||
|
QPixmap px(fileName);
|
||||||
|
|
||||||
|
ui->imageLbl->setPixmap(px);
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
#include "path.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
@ -24,9 +26,14 @@ public:
|
|||||||
void addNewStep();
|
void addNewStep();
|
||||||
void exportHTMLMap();
|
void exportHTMLMap();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_pushButton_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QString currentFile;
|
QString currentFile;
|
||||||
bool textChanged;
|
bool textChanged;
|
||||||
|
QList<Path*> path;
|
||||||
|
Path* currentPath;
|
||||||
};
|
};
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user