forked from Maalli/myDiffTool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
57 lines (47 loc) · 1.54 KB
/
Copy pathmainwindow.cpp
File metadata and controls
57 lines (47 loc) · 1.54 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "diffdialog.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->lineEdit_file1->setText(QDir::homePath() + "/clang1.txt");
ui->lineEdit_file2->setText(QDir::homePath() + "/lint1.txt");
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_file1_clicked()
{
QString filename = QFileDialog::getOpenFileName(this, tr("Open Text file"), QDir::homePath(), tr("Text Files (*.txt)"));
ui->lineEdit_file1->setText(filename);
}
void MainWindow::on_pushButton__file2_clicked()
{
QString filename = QFileDialog::getOpenFileName(this, tr("Open Text file"), QDir::homePath(), tr("Text Files (*.txt)"));
ui->lineEdit_file2->setText(filename);
}
void MainWindow::on_actionClear_all_triggered()
{
foreach(QLineEdit* le, findChildren<QLineEdit*>()) {
le->clear();
}
}
void MainWindow::on_pushButton_clicked()
{
foreach(QLineEdit* le, findChildren<QLineEdit*>()) {
if (le->text().isEmpty())
{
QMessageBox::information(this, tr("Not valid"), tr("Please fill in two file paths."));
return;
}
}
diffDialog diffD(this, ui->lineEdit_file1->text(), ui->lineEdit_file2->text());
diffD.setWindowState(diffD.windowState() | Qt::WindowMaximized);
diffD.setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint);
diffD.setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint);
diffD.setModal(true);
diffD.exec();
}