ff7tk  0.02
Toolkit for making FF7 Tools
CharManager.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // copyright 2015- 2016 Chris Rizzitello <sithlord48@gmail.com> //
3 // //
4 // This file is part of FF7tk //
5 // //
6 // FF7tk is free software: you can redistribute it and/or modify //
7 // it under the terms of the GNU General Public License as published by //
8 // the Free Software Foundation, either version 3 of the License, or //
9 // (at your option) any later version. //
10 // //
11 // FF7tk is distributed in the hope that it will be useful, //
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
14 // GNU General Public License for more details. //
15 /****************************************************************************/
16 #include "CharManager.h"
17 
18 CharManager::CharManager(qreal Scale,QWidget *parent) :
19  QWidget(parent)
20 {
21  charData = new FF7Char;
22  scale=Scale;
23  initDisplay();
24  connectAll();
25 }
26 
28 {
29  load= true;
30  for(int i=0;i<3;i++)
31  {
32  comboParty[i] = new QComboBox();
33  for (int j=0;j<11;j++)
34  {
35  comboParty[i]->addItem(charData->icon(j),charData->defaultName(j));
36  }
37  comboParty[i]->addItem("0x0B");
38  comboParty[i]->addItem(tr("-Empty-"));
39  }
40  QHBoxLayout * partyLayout = new QHBoxLayout;
41  partyLayout->setSpacing(0);
42  partyLayout->setContentsMargins(0,0,0,0);
43  partyLayout->addWidget(comboParty[0]);
44  partyLayout->addWidget(comboParty[1]);
45  partyLayout->addWidget(comboParty[2]);
46 
47  QGroupBox *partyBox =new QGroupBox(tr("Party Members"));
48  partyBox->setLayout(partyLayout);
49 
50  QVBoxLayout *charBox = new QVBoxLayout;
51  for(int i=0;i<9;i++)
52  {
53  QPushButton *button = new QPushButton;
54  button->setIcon(charData->icon(i));
55  button->setIconSize(QSize(32+scale,32*scale));
56  button->setMaximumWidth(32*scale);
57  charBox->addWidget(button);
58  }
60 
61  QHBoxLayout *lowerBox = new QHBoxLayout;
62  lowerBox->addLayout(charBox);
63  lowerBox->addWidget(charEditor);
64 
65  QVBoxLayout * mainLayout = new QVBoxLayout;
66  mainLayout->addWidget(partyBox);
67  mainLayout->addLayout(lowerBox);
68  this->setLayout(mainLayout);
69  load=false;
70 }
72 {
73  connect(comboParty[0],SIGNAL(currentIndexChanged(int)),this,SLOT(party1Changed(int)));
74  connect(comboParty[1],SIGNAL(currentIndexChanged(int)),this,SLOT(party2Changed(int)));
75  connect(comboParty[2],SIGNAL(currentIndexChanged(int)),this,SLOT(party3Changed(int)));
76 
77 }
79 {
80  disconnect(comboParty[0],SIGNAL(currentIndexChanged(int)),this,SLOT(party1Changed(int)));
81  disconnect(comboParty[1],SIGNAL(currentIndexChanged(int)),this,SLOT(party2Changed(int)));
82  disconnect(comboParty[2],SIGNAL(currentIndexChanged(int)),this,SLOT(party3Changed(int)));
83 }
84 void CharManager::party1Changed(int index){if(!load){emit (comboParty1_changed(index));qWarning()<<QString("combo1:%1").arg(QString::number(index));}}
85 void CharManager::party2Changed(int index){if(!load){emit (comboParty2_changed(index));qWarning()<<QString("combo2:%1").arg(QString::number(index));}}
86 void CharManager::party3Changed(int index){if(!load){emit (comboParty3_changed(index));qWarning()<<QString("combo3:%1").arg(QString::number(index));}}
87 
88 void CharManager::setParty(qint8 member1, qint8 member2, qint8 member3)
89 {
90  load=true;
91  comboParty[0]->setCurrentIndex(member1);
92  comboParty[1]->setCurrentIndex(member2);
93  comboParty[2]->setCurrentIndex(member3);
94  load=false;
95 }
void party2Changed(int)
Definition: CharManager.cpp:85
Data and Enums for Characters in Final Fantasy 7.
Definition: FF7Char.h:28
void disconnectAll(void)
Definition: CharManager.cpp:78
void setParty(qint8 member1, qint8 member2, qint8 member3)
Definition: CharManager.cpp:88
Widget to allow editing of a character using FF7Char for data.
Definition: CharEditor.h:37
QString defaultName(int who)
default name for a character
Definition: FF7Char.cpp:40
CharManager(qreal Scale=1, QWidget *parent=0)
Definition: CharManager.cpp:18
void party1Changed(int)
Definition: CharManager.cpp:84
void comboParty1_changed(qint8)
void initDisplay(void)
Definition: CharManager.cpp:27
FF7Char * charData
Definition: CharManager.h:51
CharEditor * charEditor
Definition: CharManager.h:52
QIcon icon(int who)
Menu icon for a character.
Definition: FF7Char.cpp:27
void comboParty2_changed(qint8)
void party3Changed(int)
Definition: CharManager.cpp:86
QComboBox * comboParty[3]
Definition: CharManager.h:53
void comboParty3_changed(qint8)
void connectAll(void)
Definition: CharManager.cpp:71
qreal scale
Definition: CharManager.h:55