-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
102 lines (87 loc) · 2.69 KB
/
mainwindow.cpp
File metadata and controls
102 lines (87 loc) · 2.69 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
_firstTime(false),
_overwrite(false),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
// qRegisterMetaType<QScrollArea>("QScrollArea");
ui->OverwriteCheck->applyPreset(Material::CheckablePreset);
// ui->ReadMetaWidget->addTab("");
connect(this,SIGNAL(pushImagePath(QString)),&exifMeta,SLOT(newImage(QString)));
connect(&exifMeta ,SIGNAL(MetaTypeDone(QScrollArea*,int)),this,SLOT(handleTabsFromBackends(QScrollArea*,int)));
filePath=QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
_extention="";
/*
QScrollArea *mainArea=new QScrollArea();
QWidget *mainWid=new QWidget();
// mainWid.set;
QGridLayout *frm=new QGridLayout(mainWid);
for (int i=0;i<=20;++i) {
QLabel *lbl=new QLabel(&"hello layout"[i]);
frm->addWidget(lbl,i,0);
QPushButton *btn=new QPushButton();
frm->addWidget(btn,i,1);
}
mainArea->setWidget(mainWid);
ui->ReadMetaWidget->addTab(mainArea,"test1");
*/
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::handleTabsFromBackends(QScrollArea* tab, int index)
{
switch (index) {
case 0: //GeneralTab //position 0
ui->ReadMetaWidget->removeTab(index);
ui->ReadMetaWidget->insertTab(index,tab,"General");
break;
case 1: //Exif Tab //Position 1
ui->ReadMetaWidget->removeTab(index);
ui->ReadMetaWidget->insertTab(index,tab,"Exif");
break;
case 2://XMP tab //Position 2
ui->ReadMetaWidget->removeTab(index);
ui->ReadMetaWidget->insertTab(index,tab,"Xmp");
break;
case 3:// IPTC tab //Position 3
ui->ReadMetaWidget->removeTab(index);
ui->ReadMetaWidget->insertTab(index,tab,"IPTC");
break;
}
}
void MainWindow::on_OpenButt_clicked()
{
foreach (QString x, exivlist) {
if(_extention==x){
emit pushImagePath(ui->OpenLine->text());
return;
}
}
///TODO Add extention seperation
///
QtMaterialDialog *err=new QtMaterialDialog();
err->showDialog();
}
void MainWindow::on_OpenBrowse_clicked()
{
QString Path=QFileDialog::getOpenFileName(this,
tr("Open File"),
filePath,
"All Files (*.*)");
ui->OpenLine->setText(Path);
filePath=QFileInfo(Path).path();
_extention =QFileInfo(Path).suffix();
}
void MainWindow::on_actionExit_triggered()
{
QApplication::quit();
}
void MainWindow::on_OverwriteCheck_toggled(bool checked)
{
_overwrite=checked;
}