-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopravipodnapise.cpp
executable file
·86 lines (71 loc) · 2.04 KB
/
popravipodnapise.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "popravipodnapise.h"
#include "ui_popravipodnapise.h"
#include <QtGui/QDropEvent>
#include <QtCore/QMimeData>
#include <QtCore/QUrl>
#include <QtCore/QList>
#include <QDebug>
#include <QMessageBox>
PopraviPodnapise::PopraviPodnapise(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::PopraviPodnapise)
{
ui->setupUi(this);
ui->stackedWidget->setCurrentIndex(0);
}
PopraviPodnapise::~PopraviPodnapise()
{
delete ui;
}
void PopraviPodnapise::dragEnterEvent(QDragEnterEvent* event)
{
// if some actions should not be usable, like move, this code must be adopted
event->acceptProposedAction();
}
void PopraviPodnapise::dragMoveEvent(QDragMoveEvent* event)
{
// if some actions should not be usable, like move, this code must be adopted
event->acceptProposedAction();
}
void PopraviPodnapise::dragLeaveEvent(QDragLeaveEvent* event)
{
event->accept();
}
void PopraviPodnapise::dropEvent(QDropEvent * event)
{
const QMimeData* mimeData = event->mimeData();
if (mimeData->hasUrls())
{
QList<QUrl> urlList = mimeData->urls();
if (urlList.size() > 1)
{
QMessageBox::information(this, trUtf8("Preveč datotek"), trUtf8("Prenesli ste preveč datotek, popravite lahko le en podnapis naenkrat."));
return;
}
if (urlList.size() < 1)
{
QMessageBox::information(this, trUtf8("Datoteka ne obstaja"), trUtf8("Prosimo, uporabite veljavno datoteko."));
return;
}
this->setAcceptDrops(false);
emit datotekaIzbrana(urlList.at(0).path());
}
}
void PopraviPodnapise::prikaziPopravke(QStringList *popravki)
{
this->ui->stackedWidget->setCurrentIndex(1);
}
void PopraviPodnapise::reset()
{
this->setAcceptDrops(true);
this->ui->stackedWidget->setCurrentIndex(0);
}
void PopraviPodnapise::error(QString message)
{
QMessageBox::information(this, trUtf8("Napaka"), message);
reset();
}
void PopraviPodnapise::info(QString naslov, QString message)
{
QMessageBox::information(this, naslov, message);
}