-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
95 lines (85 loc) · 2.54 KB
/
mainwindow.cpp
File metadata and controls
95 lines (85 loc) · 2.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
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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QSettings>
#include <QFileDialog>
#include <QMessageBox>
#include <QIcon>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QIcon icn(":/icon/php.ico");
this->setWindowIcon(icn);
pref=new QSettings("SS7 Workstation","phpDirect");
this->setWindowTitle("phpDirect");
this->setWindowFlags(Qt::FramelessWindowHint);
this->setWindowFlags(Qt::WindowTitleHint);
this->setFixedSize(600,180);
browserL=pref->value("directLoc/browser").toString();
editorL=pref->value("directLoc/editor").toString();
serverL=pref->value("directLoc/server").toString();
ui->lineEdit->setText(browserL);
ui->lineEdit_2->setText(editorL);
ui->lineEdit_3->setText(serverL);
ui->lineEdit->setDisabled(true);
ui->lineEdit_2->setDisabled(true);
ui->lineEdit_3->setDisabled(true);
change=0;
ui->pushButton->setDisabled(true);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_toolButton_clicked()
{
browserL=QFileDialog::getOpenFileName(this,"Select Browser","c://","Executable file (*.exe)");
if(!browserL.isEmpty())
{
ui->lineEdit->setText(browserL);
change=1;
ui->pushButton->setDisabled(false);
}
}
void MainWindow::on_toolButton_2_clicked()
{
editorL=QFileDialog::getOpenFileName(this,"Select Editor","c://","Executable file (*.exe)");
if(!editorL.isEmpty())
{
ui->lineEdit_2->setText(editorL);
change=1;
ui->pushButton->setDisabled(false);
}
}
void MainWindow::on_toolButton_3_clicked()
{
serverL=QFileDialog::getExistingDirectory(this,"Select Your Server Location","c://");
if(!serverL.isEmpty())
{
ui->lineEdit_3->setText(serverL);
change=1;
ui->pushButton->setDisabled(false);
}
}
void MainWindow::on_pushButton_clicked()
{
pref->beginGroup("directLoc");
if(!browserL.isEmpty())
pref->setValue("browser",browserL);
if(!editorL.isEmpty())
pref->setValue("editor",editorL);
if(!serverL.isEmpty())
pref->setValue("server",serverL);
if(change)
QMessageBox::information(this,"phpDirect", "Changes saved to preferences!");
}
void MainWindow::on_actionAbout_triggered()
{
QMessageBox::about(this,"About","This app can help resolve the hassle of selecting browser and editor for same php code.\n Develped By: Shekhar");
}
void MainWindow::on_pushButton_2_clicked()
{
QMessageBox::information(this,"phpDirect", "Application is quiting!");
this->close();
}