-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
160 lines (131 loc) · 5.1 KB
/
mainwindow.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QMessageBox>
#include<QFileDialog>
#include<QXmlStreamWriter>
#include<QComboBox>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->showMaximized();
//ui->dockWidget_2->close();
//ui->webView_3->setHtml("<h1 align='center'> Aide </h1> <p align = 'center'> Le contenu d'aide Algo+ est indisponible jusqu'a maintenant,Essayez d'avoir la dernier version de Algo+</p><h2 align='center'><font color='red'>Algo+.2016-2017</font> <h3>Email : <font>[email protected]</font></h3></h2>");
EDT_Arbre_Algo = new Editeur_Arbre_Algo(this,ui->tabWidget,ui->List_Outils);
this->on_actionAide_triggered();
QMessageBox::information(this,"Information","application en cour d'évaluation , certains erreurs peuvent se produisent, essayez-vous d'obtenir la version complète d'Algo+ ",QMessageBox::Ok);
}
void MainWindow::closeEvent(QCloseEvent *e)
{
}
MainWindow::~MainWindow()
{
//on_actionEnregistrer_triggered();
delete ui;
}
void MainWindow::on_actionEnregistrer_triggered()
{
EDT_Arbre_Algo->Enregistrer_Algorithme();
}
void MainWindow::on_actionSupprimer_triggered()
{
EDT_Arbre_Algo->Supprimer();
}
void MainWindow::on_actionEnregistrer_sous_triggered()
{
EDT_Arbre_Algo->Enregistrer_Sous_Algorithme();
}
void MainWindow::on_actionOuvrir_triggered()
{
nomFichier = QFileDialog::getOpenFileName(this,"Ouvrir un Algorithm","C:/Users/Med_Mahdi_Maarouf/Desktop/Algo+");
QFile fichierAlgo(nomFichier);
if(!fichierAlgo.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug()<<" Fichier en ouverture ne peux pas ouverir";
return;
}
QComboBox * box = new QComboBox(this);
QDomDocument documentAlgo;
documentAlgo.setContent(&fichierAlgo);
EDT_Arbre_Algo->AfficherAlgorithm(documentAlgo,nomFichier);
fichierAlgo.close();
//ui->statusBar->showMessage(" Fichier courant : " + nomFichier);
}
void MainWindow::on_actionNouveau_triggered()
{
EDT_Arbre_Algo->NouveauAlgorithm("");
}
void MainWindow::on_actionQuitter_triggered()
{
if(QMessageBox::question(this,"Quitter","Voulez vous quitter","Annuler","Quitter"))
close();
}
void MainWindow::on_actionAide_triggered()
{
/*if(EDT_Arbre_Algo->AlgorithmeCourant->ArbreAlgo->ArbreAlgo->currentIndex().isValid())
{
qDebug()<<"whatsThis"<<EDT_Arbre_Algo->AlgorithmeCourant->ArbreAlgo->modelViewAlgo->itemFromIndex(EDT_Arbre_Algo->AlgorithmeCourant->ArbreAlgo->ArbreAlgo->currentIndex())->whatsThis();
qDebug()<<"Description"<<EDT_Arbre_Algo->AlgorithmeCourant->ArbreAlgo->modelViewAlgo->itemFromIndex(EDT_Arbre_Algo->AlgorithmeCourant->ArbreAlgo->ArbreAlgo->currentIndex())->accessibleDescription();
qDebug()<<"index"<<EDT_Arbre_Algo->AlgorithmeCourant->ArbreAlgo->modelViewAlgo->itemFromIndex(EDT_Arbre_Algo->AlgorithmeCourant->ArbreAlgo->ArbreAlgo->currentIndex())->index();
}*/
//qDebug()<<EDT_Arbre_Algo->AlgorithmeCourant->ArbreAlgo->Programme_Courante()<<"what"<<EDT_Arbre_Algo->AlgorithmeCourant->ArbreAlgo->modelViewAlgo->itemFromIndex(EDT_Arbre_Algo->AlgorithmeCourant->ArbreAlgo->ArbreAlgo->currentIndex())->whatsThis();
ui->dockWidget_2->setVisible(true);
}
void MainWindow::on_actionExecuter_triggered()
{
Console = new Dialog_Console(this,EDT_Arbre_Algo->CreerXMLDocument());
Console->show();
Console->compilateur->execute();
}
void MainWindow::on_actionModifier_triggered()
{
EDT_Arbre_Algo->modifier_ligne();
}
void MainWindow::on_actionCopier_triggered()
{
EDT_Arbre_Algo->Copier();
}
void MainWindow::on_actionColler_triggered()
{
EDT_Arbre_Algo->Coller();
}
void MainWindow::on_actionCouper_triggered()
{
EDT_Arbre_Algo->Couper();
}
void MainWindow::on_actionInserer_triggered()
{
QStandardItem * newitem = new QStandardItem();
newitem->setEditable(false);
EDT_Arbre_Algo->AlgorithmeCourant->ArbreAlgo->add_newItemAlgo(newitem);
}
void MainWindow::on_actionAnnuler_triggered()
{
EDT_Arbre_Algo->Annuler();
}
void MainWindow::on_actionA_propot_Algo_triggered()
{
/*QTextEdit * deb = new QTextEdit();
deb->setText(EDT_Arbre_Algo->CreerXMLDocument().toString());
deb->show();*/
if(!ui->dockWidget_2->isVisible())
{
if(QMessageBox::question(this,"Information Algo+","Tout les informations concernent Algo+ se trouvent dans l'aide Algo+ \n Voulez-vous ouvrir ce lui ?","Ouvrir","Annuler") == 0)
on_actionAide_triggered();
}else
QMessageBox::information(this,"Information Algo+","Tout les informations concernent Algo+ se trouvent dans l'aide Algo+ ",QMessageBox::Ok);
}
void MainWindow::on_actionOuvrir_un_exemple_triggered()
{
QString nomFichier = QFileDialog::getOpenFileName(this,"Ouvrir un exemple","Exemples/");
QFile fichierAlgo(nomFichier);
if(fichierAlgo.open(QIODevice::ReadOnly))
{
QDomDocument documentAlgo;
documentAlgo.setContent(&fichierAlgo);
EDT_Arbre_Algo->AfficherAlgorithm(documentAlgo,nomFichier);
fichierAlgo.close();
//ui->statusBar->showMessage(" Fichier courant : " + nomFichier);
}
}