remove of visualisation and backPackTextEdit functional

This commit is contained in:
Giovanni-Josserand 2025-06-27 15:19:36 +02:00
parent 04a2663a46
commit 646ec2fb0c
22 changed files with 987 additions and 1045 deletions

View File

@ -31,6 +31,7 @@ Character::Character(QFile *file){
race = json["race"].toString(); race = json["race"].toString();
classe = json["classe"].toString(); classe = json["classe"].toString();
niveau = json["niveau"].toInt(); niveau = json["niveau"].toInt();
sexe = json["sexe"].toString(); sexe = json["sexe"].toString();
taille = json["taille"].toDouble(); taille = json["taille"].toDouble();
vie = json["vie"].toInt(); vie = json["vie"].toInt();

View File

@ -1,10 +1,10 @@
{ {
"age": 0, "age": 1,
"backPack": "", "backPack": "ssdgfsdgd",
"blocNote": "dghdgdgfgd", "blocNote": "'(y'eyhrhyrhr",
"classe": "", "classe": "",
"image": "data/images/logo.png", "image": "data/images/logo.png",
"name": "", "name": "dfh",
"niveau": 0, "niveau": 0,
"race": "", "race": "",
"sexe": "", "sexe": "",
@ -45,5 +45,5 @@
0 0
], ],
"taille": 0, "taille": 0,
"vie": 6619181 "vie": 569
} }

View File

@ -1,49 +0,0 @@
{
"age": 0,
"backPack": "",
"blocNote": "ssd",
"classe": "",
"image": "data/images/logo.png",
"name": "",
"niveau": 0,
"race": "",
"sexe": "",
"skills": [
0,
0,
0,
0,
0,
0
],
"skillsMod": [
0,
0,
0,
0,
0,
0
],
"stats": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"taille": 0,
"vie": 6619181
}

View File

@ -1,49 +0,0 @@
{
"age": 0,
"backPack": "",
"blocNote": "sfsfsffsd",
"classe": "",
"image": "data/images/logo.png",
"name": "Gio",
"niveau": 0,
"race": "",
"sexe": "",
"skills": [
0,
0,
0,
0,
0,
0
],
"skillsMod": [
0,
0,
0,
0,
0,
0
],
"stats": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"taille": 0,
"vie": 0
}

View File

@ -24,6 +24,9 @@ MainWindow::MainWindow(QWidget *parent)
ui->ageLineEdit->setValidator(new QIntValidator(0, 999999, ui->ageLineEdit)); ui->ageLineEdit->setValidator(new QIntValidator(0, 999999, ui->ageLineEdit));
ui->niveauLineEdit->setValidator(new QIntValidator(0, 999999, ui->niveauLineEdit)); ui->niveauLineEdit->setValidator(new QIntValidator(0, 999999, ui->niveauLineEdit));
ui->tailleLineEdit->setValidator(new QDoubleValidator(0.0, 999999.0, 1,ui->tailleLineEdit)); ui->tailleLineEdit->setValidator(new QDoubleValidator(0.0, 999999.0, 1,ui->tailleLineEdit));
ui->BackPack->setHidden(true);
loadImage(QString("data/images/logo.png")); loadImage(QString("data/images/logo.png"));
} }
@ -60,6 +63,7 @@ void MainWindow::loadNewCharacter(){
void MainWindow::createNewCharacter(Character* p) { void MainWindow::createNewCharacter(Character* p) {
notePad->setTexte(p->getTexteBlocNote()); notePad->setTexte(p->getTexteBlocNote());
ui->BackPackPlainTextEdit->setPlainText(p->getTexteBlocNote());
currentCharacter = p; currentCharacter = p;
characters.append(p); characters.append(p);
setUi(p); setUi(p);
@ -103,9 +107,7 @@ void MainWindow::saveJson(){
return; return;
} }
if(edition){
getUi(); getUi();
}
notePad->getUi(); notePad->getUi();
currentCharacter->setTexteBlocNote(notePad->getTexte()); currentCharacter->setTexteBlocNote(notePad->getTexte());
QJsonObject json; QJsonObject json;
@ -153,9 +155,7 @@ void MainWindow::saveAsJson(){
setWindowTitle(fileName); setWindowTitle(fileName);
currentFile = fileName; currentFile = fileName;
if(edition){
getUi(); getUi();
}
notePad->getUi(); notePad->getUi();
currentCharacter->setTexteBlocNote(notePad->getTexte()); currentCharacter->setTexteBlocNote(notePad->getTexte());
QJsonObject json; QJsonObject json;
@ -228,6 +228,7 @@ void MainWindow::getUi(){
} }
} }
currentCharacter->setStats(stats); currentCharacter->setStats(stats);
currentCharacter->setTexteBackPack(ui->BackPackPlainTextEdit->toPlainText());
//currentCharacter->setImage(); //currentCharacter->setImage();
} }
@ -269,28 +270,21 @@ void MainWindow::setUi(Character* p){
} }
void MainWindow::on_actionEditer_triggered(){
if(edition){
//Mode edition
}else{
//Mode visualisation
}
edition=!edition;
}
void MainWindow::on_actionBlocNote_triggered(){
this->notePad->show();
}
void MainWindow::recevoirSauvegarde(QString contenu){ void MainWindow::recevoirSauvegarde(QString contenu){
currentCharacter->setTexteBlocNote(contenu); currentCharacter->setTexteBlocNote(contenu);
saveJson(); saveJson();
} }
void MainWindow::toogleBackPack(){
if(ui->BackPack->isHidden()){
ui->Edition->setHidden(true);
ui->BackPack->setHidden(false);
}else{
ui->BackPack->setHidden(true);
ui->Edition->setHidden(false);
}
}
void MainWindow::on_actionOuvrir_une_fiche_triggered(){this->loadNewCharacter();} void MainWindow::on_actionOuvrir_une_fiche_triggered(){this->loadNewCharacter();}
@ -298,4 +292,6 @@ void MainWindow::on_actionNouvelle_fiche_triggered(){this->createNewCharacter(ne
void MainWindow::on_actionSauvegarder_triggered(){this->saveJson();} void MainWindow::on_actionSauvegarder_triggered(){this->saveJson();}
void MainWindow::on_actionEnregistrer_sous_triggered(){this->saveAsJson();} void MainWindow::on_actionEnregistrer_sous_triggered(){this->saveAsJson();}
void MainWindow::on_actionFermer_triggered(){QApplication::quit();} void MainWindow::on_actionFermer_triggered(){QApplication::quit();}
void MainWindow::on_actionBlocNote_triggered(){this->notePad->show();}
void MainWindow::on_actionBackPack_triggered(){this->toogleBackPack();}

View File

@ -27,15 +27,16 @@ public:
void saveAsJson(); void saveAsJson();
void getUi(); void getUi();
void setUi(Character* p); void setUi(Character* p);
void toogleBackPack();
private slots: private slots:
void on_actionEditer_triggered();
void on_actionBlocNote_triggered(); void on_actionBlocNote_triggered();
void on_actionOuvrir_une_fiche_triggered(); void on_actionOuvrir_une_fiche_triggered();
void on_actionNouvelle_fiche_triggered(); void on_actionNouvelle_fiche_triggered();
void on_actionSauvegarder_triggered(); void on_actionSauvegarder_triggered();
void on_actionEnregistrer_sous_triggered(); void on_actionEnregistrer_sous_triggered();
void on_actionFermer_triggered(); void on_actionFermer_triggered();
void on_actionBackPack_triggered();
void recevoirSauvegarde(QString contenu); void recevoirSauvegarde(QString contenu);
@ -44,7 +45,6 @@ private:
NotePad *notePad; NotePad *notePad;
bool edition = true; bool edition = true;
bool backPack = false;
QString currentFile; QString currentFile;
QList<Character*> characters; QList<Character*> characters;
Character* currentCharacter; Character* currentCharacter;

View File

@ -17,11 +17,26 @@
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<widget class="QFrame" name="Edition">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>590</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<widget class="QFrame" name="topFrame"> <widget class="QFrame" name="topFrame">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>2</y> <y>0</y>
<width>800</width> <width>800</width>
<height>278</height> <height>278</height>
</rect> </rect>
@ -494,9 +509,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>280</y> <y>278</y>
<width>800</width> <width>800</width>
<height>581</height> <height>312</height>
</rect> </rect>
</property> </property>
<property name="frameShape"> <property name="frameShape">
@ -985,6 +1000,33 @@
</widget> </widget>
</widget> </widget>
</widget> </widget>
<widget class="QFrame" name="BackPack">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>590</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<widget class="QPlainTextEdit" name="BackPackPlainTextEdit">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>590</height>
</rect>
</property>
</widget>
</widget>
</widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -1017,8 +1059,9 @@
<attribute name="toolBarBreak"> <attribute name="toolBarBreak">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<addaction name="actionEditer"/>
<addaction name="actionBlocNote"/> <addaction name="actionBlocNote"/>
<addaction name="actionBackPack"/>
<addaction name="separator"/>
</widget> </widget>
<action name="actionOuvrir_une_fiche"> <action name="actionOuvrir_une_fiche">
<property name="text"> <property name="text">
@ -1052,17 +1095,6 @@
<string>Ctrl+Q</string> <string>Ctrl+Q</string>
</property> </property>
</action> </action>
<action name="actionEditer">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::MailMessageNew"/>
</property>
<property name="text">
<string>Editer</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
<action name="actionBlocNote"> <action name="actionBlocNote">
<property name="icon"> <property name="icon">
<iconset theme="QIcon::ThemeIcon::DocumentPageSetup"/> <iconset theme="QIcon::ThemeIcon::DocumentPageSetup"/>
@ -1082,6 +1114,17 @@
<string>Ctrl+N</string> <string>Ctrl+N</string>
</property> </property>
</action> </action>
<action name="actionBackPack">
<property name="icon">
<iconset theme="folder"/>
</property>
<property name="text">
<string>BackPack</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>