Skip to content

Commit 9a7689c

Browse files
committed
Import OrientationWidget; Allow for Scaling, Rotation direciton , zero Direciton and new Style
1 parent f694d96 commit 9a7689c

File tree

15 files changed

+708
-7
lines changed

15 files changed

+708
-7
lines changed

demos/ff7tkWidgetGallery/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ find_library(ff7tk ${CMAKE_BINARY_DIR}/src/core)
1313
find_library(ff7tkData ${CMAKE_BINARY_DIR}/src/data)
1414
find_library(ff7tkFormats ${CMAKE_BINARY_DIR}/src/formats)
1515
find_library(ff7tkUtils ${CMAKE_BINARY_DIR}/src/utils)
16-
find_library(ff7tkWidgets ${CMAKE_BINARY_DIR}/src/widgets)
16+
find_library(ff7tkWidgets ${CMAKE_BINARY_DIR}/src/widgets/data)
17+
find_library(ff7tkQtWidgets ${CMAKE_BINARY_DIR}/src/widgets/common)
1718

1819
set(${PROJECT_NAME}_SRC
1920
main.cpp
@@ -28,6 +29,7 @@ set(${PROJECT_NAME}_DEPENDS
2829
ff7tk::ff7tkFormats
2930
ff7tk::ff7tkUtils
3031
ff7tk::ff7tkWidgets
32+
ff7tk::ff7tkQtWidgets
3133
)
3234

3335
set(${PROJECT_NAME}_LIBLINKS

demos/ff7tkWidgetGallery/mainwindow.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@ MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWin
8989
hexLineEditLayout->addWidget(hexLineEdit);
9090
ui->hexLineEdit_Box->setLayout(hexLineEditLayout);
9191
ui->sb_hexEditLine_maxlen->setValue(hexLineEdit->maxLength());
92+
93+
orientationWidget = new OrientationWidget(this);
94+
auto orientationWidgetLayout = new QVBoxLayout();
95+
orientationWidgetLayout->addWidget(orientationWidget);
96+
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+
});
92108
}
93109

94110
MainWindow::~MainWindow()
@@ -119,6 +135,7 @@ void MainWindow::on_combo_widget_currentIndexChanged(int index)
119135
case 11: ui->ChocoboManagerBox->setVisible(1); break;
120136
case 12: ui->AchievementEditor_Box->setVisible(1); break;
121137
case 13: ui->hexLineEdit_group->setVisible(1); break;
138+
case 14: ui->orientationGroup->setVisible(1); break;
122139
}
123140
this->adjustSize();
124141
}
@@ -254,6 +271,7 @@ void MainWindow::hideAllBoxes(void)
254271
ui->ChocoboManagerBox->setVisible(0);
255272
ui->AchievementEditor_Box->setVisible(0);
256273
ui->hexLineEdit_group->setVisible(0);
274+
ui->orientationGroup->setVisible(0);
257275
}
258276

259277
void MainWindow::on_btn_loadAchievement_clicked()
@@ -300,3 +318,9 @@ void MainWindow::on_sb_hexEditLine_maxlen_valueChanged(double arg1)
300318
hexLineEdit->setMaxLength(arg1 * 2);
301319
}
302320

321+
322+
void MainWindow::on_sb_orientationWidget_value_valueChanged(int arg1)
323+
{
324+
orientationWidget->setValue(arg1);
325+
}
326+

demos/ff7tkWidgetGallery/mainwindow.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include <AchievementEditor.h>
3131
#include <ItemListView.h>
3232
#include <HexLineEdit.h>
33+
34+
#include <OrientationWidget>
3335
#include <Lgp>
3436

3537
namespace Ui
@@ -70,6 +72,8 @@ private slots:
7072

7173
void on_sb_hexEditLine_maxlen_valueChanged(double arg1);
7274

75+
void on_sb_orientationWidget_value_valueChanged(int arg1);
76+
7377
private:
7478

7579
Ui::MainWindow *ui = nullptr;
@@ -85,4 +89,5 @@ private slots:
8589
AchievementEditor *achievementEditor = nullptr;
8690
ItemListView *itemlistView = nullptr;
8791
HexLineEdit *hexLineEdit = nullptr;
92+
OrientationWidget *orientationWidget = nullptr;
8893
};

demos/ff7tkWidgetGallery/mainwindow.ui

Lines changed: 167 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>117</width>
10-
<height>31</height>
9+
<width>73</width>
10+
<height>38</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -93,6 +93,11 @@
9393
<string>HexLineEdit</string>
9494
</property>
9595
</item>
96+
<item>
97+
<property name="text">
98+
<string>Orientation Widget</string>
99+
</property>
100+
</item>
96101
</widget>
97102
</item>
98103
<item>
@@ -625,6 +630,166 @@
625630
</layout>
626631
</widget>
627632
</item>
633+
<item>
634+
<widget class="QGroupBox" name="orientationGroup">
635+
<property name="title">
636+
<string>Orientation Widget</string>
637+
</property>
638+
<layout class="QVBoxLayout" name="verticalLayout_16">
639+
<item>
640+
<layout class="QHBoxLayout" name="horizontalLayout_6">
641+
<item>
642+
<widget class="QLabel" name="label_4">
643+
<property name="sizePolicy">
644+
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
645+
<horstretch>0</horstretch>
646+
<verstretch>0</verstretch>
647+
</sizepolicy>
648+
</property>
649+
<property name="text">
650+
<string>Style</string>
651+
</property>
652+
</widget>
653+
</item>
654+
<item>
655+
<widget class="QComboBox" name="combo_orientationWidget_style">
656+
<property name="sizePolicy">
657+
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
658+
<horstretch>0</horstretch>
659+
<verstretch>0</verstretch>
660+
</sizepolicy>
661+
</property>
662+
<property name="currentIndex">
663+
<number>0</number>
664+
</property>
665+
<item>
666+
<property name="text">
667+
<string>Grid</string>
668+
</property>
669+
</item>
670+
<item>
671+
<property name="text">
672+
<string>Arrow</string>
673+
</property>
674+
</item>
675+
</widget>
676+
</item>
677+
</layout>
678+
</item>
679+
<item>
680+
<layout class="QHBoxLayout" name="horizontalLayout_9">
681+
<item>
682+
<widget class="QLabel" name="label_6">
683+
<property name="sizePolicy">
684+
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
685+
<horstretch>0</horstretch>
686+
<verstretch>0</verstretch>
687+
</sizepolicy>
688+
</property>
689+
<property name="text">
690+
<string>Zero Direction</string>
691+
</property>
692+
</widget>
693+
</item>
694+
<item>
695+
<widget class="QComboBox" name="combo_orientationWidget_zeroDirection">
696+
<property name="currentIndex">
697+
<number>3</number>
698+
</property>
699+
<item>
700+
<property name="text">
701+
<string>North</string>
702+
</property>
703+
</item>
704+
<item>
705+
<property name="text">
706+
<string>East</string>
707+
</property>
708+
</item>
709+
<item>
710+
<property name="text">
711+
<string>South</string>
712+
</property>
713+
</item>
714+
<item>
715+
<property name="text">
716+
<string>West</string>
717+
</property>
718+
</item>
719+
</widget>
720+
</item>
721+
</layout>
722+
</item>
723+
<item>
724+
<layout class="QHBoxLayout" name="horizontalLayout_8">
725+
<item>
726+
<widget class="QLabel" name="label_5">
727+
<property name="sizePolicy">
728+
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
729+
<horstretch>0</horstretch>
730+
<verstretch>0</verstretch>
731+
</sizepolicy>
732+
</property>
733+
<property name="text">
734+
<string>Rotation Direction</string>
735+
</property>
736+
</widget>
737+
</item>
738+
<item>
739+
<widget class="QComboBox" name="combo_orientationWidget_rotationDirection">
740+
<property name="currentIndex">
741+
<number>1</number>
742+
</property>
743+
<item>
744+
<property name="text">
745+
<string>Clockwise</string>
746+
</property>
747+
</item>
748+
<item>
749+
<property name="text">
750+
<string>Counter Clockwise</string>
751+
</property>
752+
</item>
753+
</widget>
754+
</item>
755+
</layout>
756+
</item>
757+
<item>
758+
<widget class="QCheckBox" name="cb_orientationWidget_readOnly">
759+
<property name="text">
760+
<string>Read Only</string>
761+
</property>
762+
</widget>
763+
</item>
764+
<item>
765+
<widget class="QSpinBox" name="sb_orientationWidget_value">
766+
<property name="wrapping">
767+
<bool>true</bool>
768+
</property>
769+
<property name="suffix">
770+
<string/>
771+
</property>
772+
<property name="prefix">
773+
<string>Value: </string>
774+
</property>
775+
<property name="maximum">
776+
<number>255</number>
777+
</property>
778+
</widget>
779+
</item>
780+
<item>
781+
<widget class="QFrame" name="orientationFrame">
782+
<property name="frameShape">
783+
<enum>QFrame::StyledPanel</enum>
784+
</property>
785+
<property name="frameShadow">
786+
<enum>QFrame::Raised</enum>
787+
</property>
788+
</widget>
789+
</item>
790+
</layout>
791+
</widget>
792+
</item>
628793
</layout>
629794
</widget>
630795
</widget>

src/widgets/common/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set(ff7tkQtWidgets_SRC
99
DialogPreview.cpp
1010
DoubleCheckBox.cpp
1111
HexLineEdit.cpp
12+
OrientationWidget.cpp
1213
QTaskBarButton.cpp
1314
)
1415

@@ -21,6 +22,7 @@ set(ff7tkQtWidgets_HEADERS
2122
DialogPreview.h
2223
DoubleCheckBox.h
2324
HexLineEdit.h
25+
OrientationWidget.h
2426
QTaskBarButton.h
2527
${CMAKE_CURRENT_BINARY_DIR}/ff7tkqtwidgets_export.h
2628
)

0 commit comments

Comments
 (0)