11
11
#include < fstream>
12
12
#include < wx/dirdlg.h>
13
13
#include < wx/aboutdlg.h>
14
+ #include < wx/config.h>
14
15
15
16
#include < format>
16
17
@@ -26,6 +27,10 @@ using namespace std::filesystem;
26
27
// the web view unloads after 5 minutes of page hidden
27
28
const int TIMER_LENGTH = 5 * 1000 * 60 ;
28
29
30
+ constexpr std::string_view config_name = " com.ravbug.unityhubnative.config" ;
31
+ constexpr std::string_view config_sortCol = " sortColIndex" ;
32
+ constexpr std::string_view config_sortAscending = " sortAscending" ;
33
+
29
34
// Declare events here
30
35
wxBEGIN_EVENT_TABLE (MainFrameDerived, wxFrame)
31
36
EVT_MENU(wxID_ABOUT, MainFrameDerived::OnAbout)
@@ -69,6 +74,12 @@ wxEND_EVENT_TABLE()
69
74
70
75
// call superclass constructor
71
76
MainFrameDerived::MainFrameDerived() : MainFrame(NULL ){
77
+
78
+ // load prefs
79
+ wxConfig config (config_name.data ());
80
+ sortColumn = config.ReadLong (config_sortCol.data (), 0 );
81
+ sortAscending = config.ReadBool (config_sortAscending.data (), false );
82
+
72
83
// set up project list columns
73
84
{
74
85
string cols[] = {" Project Name" ," Unity Version" ," Last Modified" ," Path" };
@@ -147,6 +158,11 @@ void MainFrameDerived::OnSelectEditorPath(wxCommandEvent&){
147
158
}
148
159
}
149
160
161
+ void MainFrameDerived::OnQuit (wxCommandEvent&)
162
+ {
163
+ Close ();
164
+ }
165
+
150
166
/* *
151
167
Loads the data in the main view. If anything is currently loaded, it will be cleared and re-loaded
152
168
*/
@@ -466,6 +482,13 @@ void MainFrameDerived::OpenProject(const project& p, const editor& e, TargetPlat
466
482
launch_process (cmd);
467
483
}
468
484
485
+ MainFrameDerived::~MainFrameDerived ()
486
+ {
487
+ wxConfig config (config_name.data ());
488
+ config.Write (config_sortCol.data (), sortColumn);
489
+ config.Write (config_sortAscending.data (), sortAscending);
490
+ }
491
+
469
492
/* * Brings up a folder selection dialog with a prompt
470
493
* @param message the prompt for the user
471
494
* @return path selected, or an empty string if nothing chosen
0 commit comments