@@ -88,107 +88,132 @@ MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWin
8888 auto hexLineEditLayout = new QVBoxLayout ();
8989 hexLineEditLayout->addWidget (hexLineEdit);
9090 ui->hexLineEdit_Box ->setLayout (hexLineEditLayout);
91- ui->sb_hexEditLine_maxlen ->setValue (hexLineEdit->maxLength ());
91+ ui->hexEditLine_sb_maxlen ->setValue (hexLineEdit->maxLength ());
9292
9393 orientationWidget = new OrientationWidget (this );
9494 auto orientationWidgetLayout = new QVBoxLayout ();
9595 orientationWidgetLayout->addWidget (orientationWidget);
9696 ui->orientationFrame ->setLayout (orientationWidgetLayout);
97- connect (orientationWidget, &OrientationWidget::valueChanged, ui->sb_orientationWidget_value , &QSpinBox::setValue);
98- connect (ui->cb_orientationWidget_readOnly , &QCheckBox::toggled, orientationWidget, &OrientationWidget::setReadOnly);
99- connect (ui->combo_orientationWidget_style , &QComboBox::currentIndexChanged, this , [this ] (int index){
100- orientationWidget->setStyle (OrientationWidget::Style (index));
101- });
102- connect (ui->combo_orientationWidget_rotationDirection , &QComboBox::currentIndexChanged, this , [this ] (int index){
103- orientationWidget->setRotationDirection (OrientationWidget::RotationDirection (index));
104- });
105- connect (ui->combo_orientationWidget_zeroDirection , &QComboBox::currentIndexChanged, this , [this ] (int index){
106- orientationWidget->setZeroDirection (OrientationWidget::Direction (index));
107- });
10897
10998 encounterTableWidget = new EncounterTableWidget (QStringLiteral (" Encounter Table Widget" ), this );
11099 auto encounterTableLayout = new QVBoxLayout ();
111100 encounterTableLayout->addWidget (encounterTableWidget);
112101 ui->encounterTableFrame ->setLayout (encounterTableLayout);
102+
103+ initUiConnections ();
113104}
114105
115106MainWindow::~MainWindow ()
116107{
117108 delete ui;
118109}
119110
120-
121- void MainWindow::on_comboRegion_currentTextChanged (const QString &arg1)
111+ void MainWindow::initUiConnections ()
122112{
123- locViewer->setRegion (arg1);
124- }
113+ connect (ui->combo_widget , &QComboBox::currentIndexChanged, this , &MainWindow::combo_currentWidget_currentIndexChanged);
125114
126- void MainWindow::on_combo_widget_currentIndexChanged (int index)
127- {
128- hideAllBoxes ();
129- switch (index) {
130- case 1 : ui->dialog_preview_box ->setVisible (1 ); break ;
131- case 2 : ui->materia_editor_box ->setVisible (1 ); break ;
132- case 3 : ui->itemListView_Group ->setVisible (1 ); break ;
133- case 4 : ui->char_editor_box ->setVisible (1 ); break ;
134- case 5 : ui->metadata_box ->setVisible (1 ); break ;
135- case 6 : ui->slotSelect_Box ->setVisible (1 ); break ;
136- case 7 : ui->phsListBox ->setVisible (1 ); break ;
137- case 8 : ui->menuListBox ->setVisible (1 ); break ;
138- case 9 : ui->lgp_Box ->setVisible (1 ); break ;
139- case 10 : ui->locListBox ->setVisible (1 ); break ;
140- case 11 : ui->ChocoboManagerBox ->setVisible (1 ); break ;
141- case 12 : ui->AchievementEditor_Box ->setVisible (1 ); break ;
142- case 13 : ui->hexLineEdit_group ->setVisible (1 ); break ;
143- case 14 : ui->orientationGroup ->setVisible (1 ); break ;
144- case 15 : ui->encounterTableGroup ->setVisible (1 ); break ;
145- }
146- this ->adjustSize ();
147- }
115+ connect (ui->achievementEditor_btn_load , &QPushButton::clicked, this , [this ] {
116+ QString fileFilter (" *.dat (*.dat);" );
117+ QString filename = QFileDialog::getOpenFileName (this , " Select An Achievement File To Preview" , QDir::homePath (), fileFilter);
118+ achievementEditor->openFile (filename);
119+ });
148120
149- void MainWindow::on_sb_materia_editor_setStarSize_valueChanged (int size)
150- {
151- materia_editor->setStarsSize (size);
152- }
153- void MainWindow::on_cb_materia_editor_setEditable_toggled (bool checked)
154- {
155- materia_editor->setEditable (checked);
156- }
157- void MainWindow::on_cb_charEditor_clicked (bool checked)
158- {
159- char_editor->setEditable (checked);
160- }
161- void MainWindow::on_checkBox_toggled (bool checked)
162- {
163- char_editor->setAdvancedMode (checked);
164- }
121+ connect (ui->achievementEditor_btn_save , &QPushButton::clicked, this , [this ] {
122+ QString fileName = QFileDialog::getSaveFileName (this , " Select File to Save" , QDir::home ().absolutePath (), " *.dat (*.dat);" );
123+ if (fileName.isEmpty ())
124+ return ;
125+ achievementEditor->saveFile (fileName);
126+ });
165127
166- void MainWindow::on_pushButton_clicked ()
167- {
168- QByteArray temp;
169- temp.fill (0x00 , 132 );
170- FF7CHAR c_data;
171- memcpy (&c_data, temp, 132 );
172- char_editor->setChar (c_data, QString (" Cloud" ));
128+ connect (ui->hexEditLine_sb_maxlen , &QDoubleSpinBox::valueChanged, this , [this ] (int value){
129+ hexLineEdit->setMaxLength (value *2 );
130+ });
131+
132+ connect (orientationWidget, &OrientationWidget::valueChanged, ui->orientationWidget_sb_value , &QSpinBox::setValue);
133+ connect (ui->orientationWidget_sb_value , &QSpinBox::valueChanged, orientationWidget, &OrientationWidget::setValue);
134+ connect (ui->orientationWidget_cb_readOnly , &QCheckBox::toggled, orientationWidget, &OrientationWidget::setReadOnly);
135+ connect (ui->orientationWidget_combo_style , &QComboBox::currentIndexChanged, this , [this ] (int index) {
136+ orientationWidget->setStyle (OrientationWidget::Style (index));
137+ });
138+ connect (ui->orientationWidget_combo_rotationDirection , &QComboBox::currentIndexChanged, this , [this ] (int index) {
139+ orientationWidget->setRotationDirection (OrientationWidget::RotationDirection (index));
140+ });
141+ connect (ui->orientationWidget_combo_zeroDirection , &QComboBox::currentIndexChanged, this , [this ] (int index) {
142+ orientationWidget->setZeroDirection (OrientationWidget::Direction (index));
143+ });
144+
145+ connect (ui->checkBox_2 , &QCheckBox::toggled, locViewer, &LocationViewer::setAdvancedMode);
146+ connect (ui->comboRegion , &QComboBox::currentTextChanged, locViewer, &LocationViewer::setRegion);
147+
148+ connect (ui->sb_materia_editor_setStarSize , &QSpinBox::valueChanged, materia_editor, &MateriaEditor::setStarsSize);
149+ connect (ui->cb_materia_editor_setEditable , &QCheckBox::toggled, materia_editor, &MateriaEditor::setEditable);
150+ connect (ui->cbEditableMateriaCombos , &QCheckBox::toggled, materia_editor, &MateriaEditor::setEditableMateriaCombo);
151+ connect (ui->cb_materiaEditor_showPlaceHolderMateria , &QCheckBox::toggled, materia_editor, &MateriaEditor::setShowPlaceHolderMateria);
152+
153+ connect (ui->checkBox , &QCheckBox::toggled, char_editor, &CharEditor::setAdvancedMode);
154+ connect (ui->cb_charEditor , &QCheckBox::toggled, char_editor, &CharEditor::setEditable);
155+ connect (ui->checkBox_3 , &QCheckBox::toggled, char_editor, &CharEditor::setEditableComboBoxes);
156+ connect (ui->pushButton , &QPushButton::clicked, this , [this ] {
157+ QByteArray temp;
158+ temp.fill (0x00 , 132 );
159+ FF7CHAR c_data;
160+ memcpy (&c_data, temp, 132 );
161+ char_editor->setChar (c_data, QString (" Cloud" ));
162+ });
163+
164+ connect (ui->cb_itemSelectionDeleageEditable , &QCheckBox::toggled, itemlistView, &ItemListView::setEditableItemCombo);
165+ connect (ui->cb_itemSelection_showPlaceHolders , &QCheckBox::toggled, itemlistView, &ItemListView::setShowPlaceholderItems);
166+ connect (ui->sb_itemListViewMaxQty , &QSpinBox::editingFinished, this , [this ] {
167+ itemlistView->setMaximumItemQty (ui->sb_itemListViewMaxQty ->value ());
168+ });
169+
170+ connect (ui->btn_showmetaData , &QPushButton::clicked, this , [this ] {
171+ auto ff7save = std::make_unique<FF7Save>();
172+ metadataCreator = new MetadataCreator (this , ff7save.get ());
173+ metadataCreator->exec ();
174+ });
175+
176+ connect (ui->btn_lgpSelect , &QPushButton::clicked, this , &MainWindow::selectLgpFile);
177+ connect (ui->btnExtractLgp , &QPushButton::clicked, this , &MainWindow::extractLgp);
178+
179+ connect (ui->btn_slotSelect , &QPushButton::clicked, this , &MainWindow::slotSelect_show);
173180}
174181
175- void MainWindow::on_btn_showmetaData_clicked ( )
182+ void MainWindow::combo_currentWidget_currentIndexChanged ( int index )
176183{
177- auto ff7save = std::make_unique<FF7Save>();
178- metadataCreator = new MetadataCreator (this , ff7save.get ());
179- metadataCreator->exec ();
184+ hideAllBoxes ();
185+ switch (index)
186+ {
187+ case 1 : ui->dialog_preview_box ->setVisible (1 ); break ;
188+ case 2 : ui->materia_editor_box ->setVisible (1 ); break ;
189+ case 3 : ui->itemListView_Group ->setVisible (1 ); break ;
190+ case 4 : ui->char_editor_box ->setVisible (1 ); break ;
191+ case 5 : ui->metadata_box ->setVisible (1 ); break ;
192+ case 6 : ui->slotSelect_Box ->setVisible (1 ); break ;
193+ case 7 : ui->phsListBox ->setVisible (1 ); break ;
194+ case 8 : ui->menuListBox ->setVisible (1 ); break ;
195+ case 9 : ui->lgp_Box ->setVisible (1 ); break ;
196+ case 10 : ui->locListBox ->setVisible (1 ); break ;
197+ case 11 : ui->ChocoboManagerBox ->setVisible (1 ); break ;
198+ case 12 : ui->AchievementEditor_Box ->setVisible (1 ); break ;
199+ case 13 : ui->hexLineEdit_group ->setVisible (1 ); break ;
200+ case 14 : ui->orientationGroup ->setVisible (1 ); break ;
201+ case 15 : ui->encounterTableGroup ->setVisible (1 ); break ;
202+ }
203+ adjustSize ();
180204}
181205
182- void MainWindow::on_btn_slotSelect_clicked ()
206+ void MainWindow::slotSelect_show ()
183207{
208+
184209 auto ff7save = std::make_unique<FF7Save>();
185210 QString fileFilter = FF7SaveInfo::knownTypesFilter ();
186211 QString filename = QFileDialog::getOpenFileName (this , " Select A Save To Preview" , QDir::homePath (), fileFilter);
187212 if (!filename.isEmpty ()) {
188213 if (ff7save.get ()->loadFile (filename)) {
189214 SlotSelect *slotSelect = new SlotSelect (ff7save.get (), ui->cbShowLoad ->isChecked ());
190215 if (slotSelect->exec () == -1 ) {
191- on_btn_slotSelect_clicked ();
216+ slotSelect_show ();
192217 } else {
193218 return ;
194219 }
@@ -198,7 +223,7 @@ void MainWindow::on_btn_slotSelect_clicked()
198223 }
199224}
200225
201- void MainWindow::on_btn_lgpSelect_clicked ()
226+ void MainWindow::selectLgpFile ()
202227{
203228 ui->listLgpFile ->clear ();
204229 QString fileName = QFileDialog::getOpenFileName (this , " Select Lgp Archive" , QDir::homePath (), " Lgp Archive(*.lgp)" );
@@ -219,8 +244,9 @@ void MainWindow::on_btn_lgpSelect_clicked()
219244 }
220245 }
221246}
222- void MainWindow::on_btnExtractLgp_clicked ()
247+ void MainWindow::extractLgp ()
223248{
249+
224250 QString extPath = QFileDialog::getExistingDirectory (this , " Select Path To Extract Files" , QDir::homePath ());
225251 if (extPath.isEmpty ()) {
226252 return ;
@@ -279,67 +305,4 @@ void MainWindow::hideAllBoxes(void)
279305 ui->hexLineEdit_group ->setVisible (0 );
280306 ui->orientationGroup ->setVisible (0 );
281307 ui->encounterTableGroup ->setVisible (0 );
282-
283- }
284-
285- void MainWindow::on_btn_loadAchievement_clicked ()
286- {
287- QString fileFilter (" *.dat (*.dat);" );
288- QString filename = QFileDialog::getOpenFileName (this , " Select An Achievement File To Preview" , QDir::homePath (), fileFilter);
289- achievementEditor->openFile (filename);
290- }
291-
292- void MainWindow::on_btn_saveAchievement_clicked ()
293- {
294- QString fileName = QFileDialog::getSaveFileName (this , " Select File to Save" , QDir::home ().absolutePath (), " *.dat (*.dat);" );
295- if (!fileName.isEmpty ()) {
296- achievementEditor->saveFile (fileName);
297- }
298- }
299-
300- void MainWindow::on_checkBox_2_toggled (bool checked)
301- {
302- locViewer->setAdvancedMode (checked);
303- }
304-
305- void MainWindow::on_checkBox_3_clicked (bool checked)
306- {
307- char_editor->setEditableComboBoxes (checked);
308- }
309- void MainWindow::on_cbEditableMateriaCombos_clicked (bool checked)
310- {
311- materia_editor->setEditableMateriaCombo (checked);
312- }
313-
314- void MainWindow::on_cb_itemSelectionDeleageEditable_toggled (bool checked)
315- {
316- itemlistView->setEditableItemCombo (checked);
317- }
318-
319- void MainWindow::on_sb_itemListViewMaxQty_editingFinished ()
320- {
321- itemlistView->setMaximumItemQty (ui->sb_itemListViewMaxQty ->value ());
322- }
323-
324- void MainWindow::on_sb_hexEditLine_maxlen_valueChanged (double arg1)
325- {
326- hexLineEdit->setMaxLength (arg1 * 2 );
327- }
328-
329-
330- void MainWindow::on_sb_orientationWidget_value_valueChanged (int arg1)
331- {
332- orientationWidget->setValue (arg1);
333- }
334-
335-
336- void MainWindow::on_cb_materiaEditor_showPlaceHolderMateria_toggled (bool checked)
337- {
338- materia_editor->setShowPlaceHolderMateria (checked);
339- }
340-
341-
342- void MainWindow::on_cb_itemSelection_showPlaceHolders_toggled (bool checked)
343- {
344- itemlistView->setShowPlaceholderItems (checked);
345308}
0 commit comments