1+ #include < QLineEdit>
2+
13#include " ../Logger.hpp"
24#include " WindowManager.hpp"
35#include " ImageManager.hpp"
@@ -19,53 +21,65 @@ SetUpWindowsWrapper::SetUpWindowsWrapper(QWidget* parent) : QStackedWidget(paren
1921
2022void SetUpWindowsWrapper::AttachConnections ()
2123{
22- connect (pGreetingWidget, &GreetingWindow::languageChanged,
23- this , &SetUpWindowsWrapper::GreetingWidget_LanguageChanged);
24+ connect (pGreetingWidget, &GreetingWindow::languageChanged,
25+ this , &SetUpWindowsWrapper::GreetingWidget_LanguageChanged);
2426
25- connect (pGreetingWidget, &GreetingWindow::pressed,
26- this , &SetUpWindowsWrapper::BtnNewProjectOrBtnLoadProject_Clicked);
27+ connect (pGreetingWidget, &GreetingWindow::btnLoadFromFile_Clicked,
28+ this , &SetUpWindowsWrapper::BtnLoadFromFile_Clicked);
29+
30+ connect (pGreetingWidget, &GreetingWindow::btnLoadFromGame_Clicked,
31+ this , &SetUpWindowsWrapper::BtnLoadFromGame_Clicked);
2732
28- connect (pLoadDialog, &LoadFromTheFileWindow::btnBackClicked,
29- this , &SetUpWindowsWrapper::BtnBack_Clicked);
33+ connect (pLoadFromTheFileWindow, &LoadFromTheFileWindow::btnBackClicked,
34+ this , &SetUpWindowsWrapper::BtnBack_Clicked);
35+
36+ connect (pLoadFromTheFileWindow, &LoadFromTheFileWindow::btnStartClicked,
37+ this , &SetUpWindowsWrapper::LoadFromTheFileWindow_AcceptConfiguration);
3038
31- connect (pCreationDialog , &LoadFromTheGameWindow::btnBackClicked,
32- this , &SetUpWindowsWrapper::BtnBack_Clicked);
39+ connect (pLoadFromTheGameWindow , &LoadFromTheGameWindow::btnBackClicked,
40+ this , &SetUpWindowsWrapper::BtnBack_Clicked);
3341
34- connect (pCreationDialog , &LoadFromTheGameWindow::btnStartClicked,
35- this , &SetUpWindowsWrapper::CreationDialog_AcceptConfiguration );
42+ // connect(pLoadFromTheGameWindow , &LoadFromTheGameWindow::btnStartClicked,
43+ // this, &SetUpWindowsWrapper::LoadFromTheGameWindow_AcceptConfiguration );
3644}
3745
3846void SetUpWindowsWrapper::DetachConnections ()
3947{
40- disconnect (pGreetingWidget, &GreetingWindow::languageChanged,
41- this , &SetUpWindowsWrapper::GreetingWidget_LanguageChanged);
42-
43- disconnect (pGreetingWidget, &GreetingWindow::pressed,
44- this , &SetUpWindowsWrapper::BtnNewProjectOrBtnLoadProject_Clicked);
48+ disconnect (pGreetingWidget, &GreetingWindow::languageChanged,
49+ this , &SetUpWindowsWrapper::GreetingWidget_LanguageChanged);
50+
51+ disconnect (pGreetingWidget, &GreetingWindow::btnLoadFromFile_Clicked,
52+ this , &SetUpWindowsWrapper::BtnLoadFromFile_Clicked);
53+
54+ disconnect (pGreetingWidget, &GreetingWindow::btnLoadFromGame_Clicked,
55+ this , &SetUpWindowsWrapper::BtnLoadFromGame_Clicked);
4556
46- disconnect (pLoadDialog, &LoadFromTheFileWindow::btnBackClicked,
47- this , &SetUpWindowsWrapper::BtnBack_Clicked);
57+ disconnect (pLoadFromTheFileWindow, &LoadFromTheFileWindow::btnBackClicked,
58+ this , &SetUpWindowsWrapper::BtnBack_Clicked);
59+
60+ disconnect (pLoadFromTheFileWindow, &LoadFromTheFileWindow::btnStartClicked,
61+ this , &SetUpWindowsWrapper::LoadFromTheFileWindow_AcceptConfiguration);
4862
49- disconnect (pCreationDialog , &LoadFromTheGameWindow::btnBackClicked,
50- this , &SetUpWindowsWrapper::BtnBack_Clicked);
63+ disconnect (pLoadFromTheGameWindow , &LoadFromTheGameWindow::btnBackClicked,
64+ this , &SetUpWindowsWrapper::BtnBack_Clicked);
5165
52- disconnect (pCreationDialog , &LoadFromTheGameWindow::btnStartClicked,
53- this , &SetUpWindowsWrapper::CreationDialog_AcceptConfiguration );
66+ // disconnect(pLoadFromTheGameWindow , &LoadFromTheGameWindow::btnStartClicked,
67+ // this, &SetUpWindowsWrapper::LoadFromTheGameWindow_AcceptConfiguration );
5468}
5569
5670void SetUpWindowsWrapper::AddWidgets ()
5771{
58- pGreetingWidget = new GreetingWindow (this );
59- pCreationDialog = new LoadFromTheGameWindow (pGreetingWidget);
60- pLoadDialog = new LoadFromTheFileWindow (pGreetingWidget);
72+ pGreetingWidget = new GreetingWindow (this );
73+ pLoadFromTheGameWindow = new LoadFromTheGameWindow (pGreetingWidget);
74+ pLoadFromTheFileWindow = new LoadFromTheFileWindow (pGreetingWidget);
6175
6276 pGreetingWidget->setFixedSize (size ());
63- pCreationDialog ->setFixedSize (size ());
64- pLoadDialog ->setFixedSize (size ());
77+ pLoadFromTheGameWindow ->setFixedSize (size ());
78+ pLoadFromTheFileWindow ->setFixedSize (size ());
6579
6680 addWidget (pGreetingWidget);
67- addWidget (pCreationDialog );
68- addWidget (pLoadDialog );
81+ addWidget (pLoadFromTheGameWindow );
82+ addWidget (pLoadFromTheFileWindow );
6983}
7084
7185void SetUpWindowsWrapper::GreetingWidget_LanguageChanged (int intLngIndex)
@@ -76,30 +90,23 @@ void SetUpWindowsWrapper::GreetingWidget_LanguageChanged(int intLngIndex)
7690
7791 DetachConnections ();
7892 pGreetingWidget->deleteLater ();
79- pCreationDialog ->deleteLater ();
80- pLoadDialog ->deleteLater ();
93+ pLoadFromTheGameWindow ->deleteLater ();
94+ pLoadFromTheFileWindow ->deleteLater ();
8195
8296 AddWidgets ();
8397 AttachConnections ();
8498 setCurrentWidget (pGreetingWidget);
8599}
86100
87- void SetUpWindowsWrapper::BtnNewProjectOrBtnLoadProject_Clicked (GreetingWindow::StandartButtons standartButton)
101+ void SetUpWindowsWrapper::LoadFromTheFileWindow_AcceptConfiguration ()
88102{
89- switch (standartButton)
90- {
91- case GreetingWindow::StandartButtons::NewProject:
92- setCurrentWidget (pCreationDialog);
93- break ;
94- case GreetingWindow::StandartButtons::LoadProject:
95- setCurrentWidget (pLoadDialog);
96- break ;
97- default :
98- setCurrentWidget (pCreationDialog);
99- break ;
100- }
103+ QString objName = " lneFilePath" ;
104+ QString txt = pLoadFromTheFileWindow->findChild <QLineEdit*>(" lneFilePath" , Qt::FindChildrenRecursively)->text ();
105+ WINDOW_MANAGER->SetCSFFilePath (txt);
106+ WINDOW_MANAGER->LaunchWidget_AcceptConfiguration ();
101107}
102108
103- void SetUpWindowsWrapper::BtnBack_Clicked () { setCurrentWidget (pGreetingWidget); }
104-
105- void SetUpWindowsWrapper::CreationDialog_AcceptConfiguration () { QVariant cfg; WINDOW_MANAGER->LaunchWidget_AcceptConfiguration (cfg); }
109+ void SetUpWindowsWrapper::BtnLoadFromFile_Clicked () { setCurrentWidget (pLoadFromTheFileWindow); }
110+ void SetUpWindowsWrapper::BtnLoadFromGame_Clicked () { setCurrentWidget (pLoadFromTheGameWindow); }
111+ void SetUpWindowsWrapper::BtnBack_Clicked () { WINDOW_MANAGER->SetCSFFilePath (" " ); setCurrentWidget (pGreetingWidget); }
112+ void SetUpWindowsWrapper::LoadFromTheGameWindow_AcceptConfiguration () { WINDOW_MANAGER->LaunchWidget_AcceptConfiguration (); }
0 commit comments