Mercurial > hg > easyhg
comparison settingsdialog.cpp @ 63:2340b00561d2
* Add (but don't yet use) RecentFiles class to replace inline MRU logic
author | Chris Cannam |
---|---|
date | Wed, 17 Nov 2010 14:26:27 +0000 |
parents | f583e44d9d31 |
children | 794db9353c7f |
comparison
equal
deleted
inserted
replaced
62:68aebc316898 | 63:2340b00561d2 |
---|---|
35 userInfoLabel -> setBuddy(userInfoLineEdit); | 35 userInfoLabel -> setBuddy(userInfoLineEdit); |
36 | 36 |
37 remoteRepoLabel = new QLabel(tr("Remote repository path, e.g. http://192.168.1.10:8000/ or /home/mike/anotherrepo/ or c:\\anotherrepo\\")); | 37 remoteRepoLabel = new QLabel(tr("Remote repository path, e.g. http://192.168.1.10:8000/ or /home/mike/anotherrepo/ or c:\\anotherrepo\\")); |
38 remoteRepoCombo = new QComboBox(); | 38 remoteRepoCombo = new QComboBox(); |
39 remoteRepoCombo -> insertItem(0, mainWnd->remoteRepoPath); | 39 remoteRepoCombo -> insertItem(0, mainWnd->remoteRepoPath); |
40 for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++) | 40 /*!!! for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++) |
41 { | 41 { |
42 remoteRepoCombo -> insertItem(i + 1, mainWnd -> remoteRepoMruList[i]); | 42 remoteRepoCombo -> insertItem(i + 1, mainWnd -> remoteRepoMruList[i]); |
43 } | 43 } |
44 */ | |
44 remoteRepoCombo -> setEditable(true); | 45 remoteRepoCombo -> setEditable(true); |
45 remoteRepoLabel -> setBuddy(remoteRepoCombo); | 46 remoteRepoLabel -> setBuddy(remoteRepoCombo); |
46 remoteRepoBrowseButton = new QPushButton(tr("Browse...")); | 47 remoteRepoBrowseButton = new QPushButton(tr("Browse...")); |
47 | 48 |
48 workFolderLabel = new QLabel(tr("Local work folder path, e.g. /home/mike/work/ or c:\\mike\\work\\")); | 49 workFolderLabel = new QLabel(tr("Local work folder path, e.g. /home/mike/work/ or c:\\mike\\work\\")); |
49 workFolderCombo = new QComboBox(); | 50 workFolderCombo = new QComboBox(); |
50 workFolderCombo -> insertItem(0, mainWnd -> workFolderPath); | 51 workFolderCombo -> insertItem(0, mainWnd -> workFolderPath); |
51 for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++) | 52 /*!!! for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++) |
52 { | 53 { |
53 workFolderCombo -> insertItem(i + 1, mainWnd -> workFolderMruList[i]); | 54 workFolderCombo -> insertItem(i + 1, mainWnd -> workFolderMruList[i]); |
54 } | 55 } |
56 */ | |
55 workFolderCombo -> setEditable(true); | 57 workFolderCombo -> setEditable(true); |
56 workFolderLabel -> setBuddy(workFolderCombo); | 58 workFolderLabel -> setBuddy(workFolderCombo); |
57 workFolderBrowseButton = new QPushButton(tr("Browse...")); | 59 workFolderBrowseButton = new QPushButton(tr("Browse...")); |
58 | 60 |
59 okButton = new QPushButton(tr("Ok")); | 61 okButton = new QPushButton(tr("Ok")); |
102 mainWnd -> firstStart = false; | 104 mainWnd -> firstStart = false; |
103 mainWnd -> userInfo = userInfoLineEdit->text(); | 105 mainWnd -> userInfo = userInfoLineEdit->text(); |
104 | 106 |
105 if (mainWnd -> remoteRepoPath != remoteRepoCombo-> currentText()) | 107 if (mainWnd -> remoteRepoPath != remoteRepoCombo-> currentText()) |
106 { | 108 { |
107 insertPathToMruList(mainWnd -> remoteRepoPath, mainWnd -> remoteRepoMruList); | 109 //!!! insertPathToMruList(mainWnd -> remoteRepoPath, mainWnd -> remoteRepoMruList); |
108 mainWnd -> remoteRepoPath = remoteRepoCombo-> currentText(); | 110 mainWnd -> remoteRepoPath = remoteRepoCombo-> currentText(); |
109 } | 111 } |
110 | 112 |
111 tmp = workFolderCombo -> currentText(); | 113 tmp = workFolderCombo -> currentText(); |
112 if (!tmp.endsWith(QDir::separator())) | 114 if (!tmp.endsWith(QDir::separator())) |
114 tmp += QDir::separator(); | 116 tmp += QDir::separator(); |
115 } | 117 } |
116 | 118 |
117 if (mainWnd -> workFolderPath != tmp) | 119 if (mainWnd -> workFolderPath != tmp) |
118 { | 120 { |
119 insertPathToMruList(mainWnd -> workFolderPath, mainWnd -> workFolderMruList); | 121 //!!! insertPathToMruList(mainWnd -> workFolderPath, mainWnd -> workFolderMruList); |
120 mainWnd -> workFolderPath = tmp; | 122 mainWnd -> workFolderPath = tmp; |
121 } | 123 } |
122 | 124 |
123 mainWnd -> writeSettings(); | 125 mainWnd -> writeSettings(); |
124 mainWnd -> enableDisableActions(); | 126 mainWnd -> enableDisableActions(); |
152 void SettingsDialog::cancelClicked() | 154 void SettingsDialog::cancelClicked() |
153 { | 155 { |
154 close(); | 156 close(); |
155 } | 157 } |
156 | 158 |
157 | |
158 void SettingsDialog::insertPathToMruList(QString path, QString mruList[]) | |
159 { | |
160 bool matchFound = false; | |
161 | |
162 for(int i = 0; i < NUM_PATHS_IN_MRU_LIST; i++) | |
163 { | |
164 if (path == mruList[i]) | |
165 { | |
166 matchFound = true; | |
167 break; | |
168 } | |
169 } | |
170 | |
171 if (!matchFound) | |
172 { | |
173 for(int i = NUM_PATHS_IN_MRU_LIST - 2; i >= 0; i--) | |
174 { | |
175 if (i == 0) | |
176 { | |
177 mruList[1] = mruList[0]; | |
178 mruList[0] = path; | |
179 } | |
180 else | |
181 { | |
182 mruList[i + 1] = mruList[i]; | |
183 } | |
184 } | |
185 } | |
186 } | |
187 | |
188 | |
189 void SettingsDialog::browseDirAndSetCombo(QComboBox *combo) | 159 void SettingsDialog::browseDirAndSetCombo(QComboBox *combo) |
190 { | 160 { |
191 QString dir; | 161 QString dir; |
192 QString startDir; | 162 QString startDir; |
193 QString system; | 163 QString system; |