Create function, add path data and interaction
This commit is contained in:
parent
3048920666
commit
332fa2bc0b
@ -1,6 +1,9 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
@ -11,4 +14,82 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
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 "path.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
@ -24,9 +26,14 @@ public:
|
||||
void addNewStep();
|
||||
void exportHTMLMap();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QString currentFile;
|
||||
bool textChanged;
|
||||
QList<Path*> path;
|
||||
Path* currentPath;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user