comparison mainwindow.cpp @ 109:1721c580c10e

* Add a queueing mechanism for Hg actions, instead of refusing to start an action if something else is already happening. This is essential now that actions can be prompted by asynchronous events (e.g. filesystem watcher). * Make Revert behave sensibly
author Chris Cannam
date Fri, 26 Nov 2010 12:48:29 +0000
parents 8ae3b44c0073
children 4bd17f36d059
comparison
equal deleted inserted replaced
108:8ae3b44c0073 109:1721c580c10e
50 createMenus(); 50 createMenus();
51 createToolBars(); 51 createToolBars();
52 createStatusBar(); 52 createStatusBar();
53 53
54 runner = new HgRunner(this); 54 runner = new HgRunner(this);
55 connect(runner, SIGNAL(commandCompleted()), 55 connect(runner, SIGNAL(commandCompleted(HgAction, QString)),
56 this, SLOT(commandCompleted())); 56 this, SLOT(commandCompleted(HgAction, QString)));
57 connect(runner, SIGNAL(commandFailed()), 57 connect(runner, SIGNAL(commandFailed(HgAction, QString)),
58 this, SLOT(commandFailed())); 58 this, SLOT(commandFailed(HgAction, QString)));
59 runningAction = ACT_NONE;
60 statusBar()->addPermanentWidget(runner); 59 statusBar()->addPermanentWidget(runner);
61 60
62 setWindowTitle(tr("EasyMercurial")); 61 setWindowTitle(tr("EasyMercurial"));
63 62
64 remoteRepoPath = ""; 63 remoteRepoPath = "";
65 workFolderPath = ""; 64 workFolderPath = "";
66 65
67 readSettings(); 66 readSettings();
68 67
69 tabPage = 0; 68 // tabPage = 0;
70 justMerged = false; 69 justMerged = false;
71 hgTabs = new HgTabWidget((QWidget *) this, remoteRepoPath, workFolderPath); 70 hgTabs = new HgTabWidget((QWidget *) this, remoteRepoPath, workFolderPath);
72 setCentralWidget(hgTabs); 71 setCentralWidget(hgTabs);
73 72
74 connect(hgTabs, SIGNAL(selectionChanged()), 73 connect(hgTabs, SIGNAL(selectionChanged()),
89 88
90 if (workFolderPath == "") { 89 if (workFolderPath == "") {
91 open(); 90 open();
92 } 91 }
93 92
94 hgPaths(); 93 hgQueryPaths();
95 } 94 }
96 95
97 96
98 void MainWindow::closeEvent(QCloseEvent *) 97 void MainWindow::closeEvent(QCloseEvent *)
99 { 98 {
145 hgTabs->clearSelections(); 144 hgTabs->clearSelections();
146 } 145 }
147 146
148 void MainWindow::hgStat() 147 void MainWindow::hgStat()
149 { 148 {
150 if (runningAction == ACT_NONE) 149 QStringList params;
150 params << "stat" << "-ardum";
151 runner->requestAction(HgAction(ACT_STAT, workFolderPath, params));
152 }
153
154 void MainWindow::hgQueryPaths()
155 {
156 QStringList params;
157 params << "paths";
158 runner->requestAction(HgAction(ACT_QUERY_PATHS, workFolderPath, params));
159 }
160
161 void MainWindow::hgQueryBranch()
162 {
163 QStringList params;
164 params << "branch";
165 runner->requestAction(HgAction(ACT_QUERY_BRANCH, workFolderPath, params));
166 }
167
168 void MainWindow::hgQueryHeads()
169 {
170 QStringList params;
171 params << "heads";
172 // on empty repos, "hg heads" will fail -- we don't care about that.
173 runner->requestAction(HgAction(ACT_QUERY_HEADS, workFolderPath, params));
174 }
175
176 void MainWindow::hgLog()
177 {
178 //!!! This needs to be incremental, except when we pull or set new repo
179 QStringList params;
180 params << "log";
181 params << "--template";
182 params << "id: {rev}:{node|short}\\nauthor: {author}\\nbranch: {branches}\\ntag: {tag}\\ndatetime: {date|isodate}\\ntimestamp: {date|hgdate}\\nage: {date|age}\\nparents: {parents}\\ncomment: {desc|json}\\n\\n";
183
184 runner->requestAction(HgAction(ACT_LOG, workFolderPath, params));
185 }
186
187
188 void MainWindow::hgQueryParents()
189 {
190 QStringList params;
191 params << "parents";
192 runner->requestAction(HgAction(ACT_QUERY_PARENTS, workFolderPath, params));
193 }
194
195 void MainWindow::hgAnnotate()
196 {
197 QStringList params;
198 QString currentFile;//!!! = hgTabs -> getCurrentFileListLine();
199
200 if (!currentFile.isEmpty())
151 { 201 {
152 QStringList params; 202 params << "annotate" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
153 203
154 params << "stat" << "-ardum"; 204 runner->requestAction(HgAction(ACT_ANNOTATE, workFolderPath, params));
155 205 }
156 runner -> startHgCommand(workFolderPath, params); 206 }
157 runningAction = ACT_STAT; 207
158 } 208 void MainWindow::hgResolveMark()
159 } 209 {
160 210 QStringList params;
161 void MainWindow::hgPaths() 211 QString currentFile;//!!! = hgTabs -> getCurrentFileListLine();
162 { 212
163 if (runningAction == ACT_NONE) 213 if (!currentFile.isEmpty())
164 { 214 {
165 QStringList params; 215 params << "resolve" << "--mark" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
166 params << "paths"; 216
167 runner -> startHgCommand(workFolderPath, params); 217 runner->requestAction(HgAction(ACT_RESOLVE_MARK, workFolderPath, params));
168 runningAction = ACT_PATHS; 218 }
169 } 219 }
170 }
171
172 void MainWindow::hgBranch()
173 {
174 if (runningAction == ACT_NONE)
175 {
176 QStringList params;
177 params << "branch";
178 runner -> startHgCommand(workFolderPath, params);
179 runningAction = ACT_BRANCH;
180 }
181 }
182
183 void MainWindow::hgHeads()
184 {
185 if (runningAction == ACT_NONE)
186 {
187 QStringList params;
188 params << "heads";
189
190 //on empty repos, "hg heads" will fail, don't care of that.
191 runner -> startHgCommand(workFolderPath, params);
192 runningAction = ACT_HEADS;
193 }
194 }
195
196 void MainWindow::hgLog()
197 {
198 //!!! This needs to be incremental, except when we pull or set new repo
199 if (runningAction == ACT_NONE)
200 {
201 QStringList params;
202 params << "log";
203 params << "--template";
204 params << "id: {rev}:{node|short}\\nauthor: {author}\\nbranch: {branches}\\ntag: {tag}\\ndatetime: {date|isodate}\\ntimestamp: {date|hgdate}\\nage: {date|age}\\nparents: {parents}\\ncomment: {desc|json}\\n\\n";
205
206 runner -> startHgCommand(workFolderPath, params);
207 runningAction = ACT_LOG;
208 }
209 }
210
211
212 void MainWindow::hgParents()
213 {
214 if (runningAction == ACT_NONE)
215 {
216 QStringList params;
217 params << "parents";
218
219 runner -> startHgCommand(workFolderPath, params);
220 runningAction = ACT_PARENTS;
221 }
222 }
223
224
225 void MainWindow::hgAnnotate()
226 {
227 if (runningAction == ACT_NONE)
228 {
229 QStringList params;
230 QString currentFile;//!!! = hgTabs -> getCurrentFileListLine();
231
232 if (!currentFile.isEmpty())
233 {
234 params << "annotate" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
235
236 runner -> startHgCommand(workFolderPath, params);
237 runningAction = ACT_ANNOTATE;
238 }
239 }
240 }
241
242
243 void MainWindow::hgResolveMark()
244 {
245 if (runningAction == ACT_NONE)
246 {
247 QStringList params;
248 QString currentFile;//!!! = hgTabs -> getCurrentFileListLine();
249
250 if (!currentFile.isEmpty())
251 {
252 params << "resolve" << "--mark" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
253
254 runner -> startHgCommand(workFolderPath, params);
255 runningAction = ACT_RESOLVE_MARK;
256 }
257 }
258 }
259
260
261 220
262 void MainWindow::hgResolveList() 221 void MainWindow::hgResolveList()
263 { 222 {
264 if (runningAction == ACT_NONE) 223 QStringList params;
265 { 224
266 QStringList params; 225 params << "resolve" << "--list";
267 226 runner->requestAction(HgAction(ACT_RESOLVE_LIST, workFolderPath, params));
268 params << "resolve" << "--list"; 227 }
269 runner -> startHgCommand(workFolderPath, params);
270 runningAction = ACT_RESOLVE_LIST;
271 }
272 }
273
274
275 228
276 void MainWindow::hgAdd() 229 void MainWindow::hgAdd()
277 { 230 {
278 if (runningAction == ACT_NONE) 231 QStringList params;
279 { 232
280 QStringList params; 233 // hgExplorer permitted adding "all" files -- I'm not sure
281 234 // that one is a good idea, let's require the user to select
282 // hgExplorer permitted adding "all" files -- I'm not sure 235
283 // that one is a good idea, let's require the user to select 236 QStringList files = hgTabs->getSelectedAddableFiles();
284 237
285 QStringList files = hgTabs->getSelectedAddableFiles(); 238 if (!files.empty()) {
286 239 params << "add" << "--" << files;
287 if (!files.empty()) { 240 runner->requestAction(HgAction(ACT_ADD, workFolderPath, params));
288 params << "add" << "--" << files;
289 runner -> startHgCommand(workFolderPath, params);
290 runningAction = ACT_ADD;
291 }
292 } 241 }
293 } 242 }
294 243
295 244
296 void MainWindow::hgRemove() 245 void MainWindow::hgRemove()
297 { 246 {
298 if (runningAction == ACT_NONE) 247 QStringList params;
299 { 248
300 QStringList params; 249 QStringList files = hgTabs->getSelectedRemovableFiles();
301 250
302 QStringList files = hgTabs->getSelectedRemovableFiles(); 251 //!!! todo: confirmation dialog (with file list in it) (or do we
303 252 // need that? all it does is move the files to the removed
304 //!!! todo: confirmation dialog (with file list in it) 253 // list... doesn't it?)
305 254
306 if (!files.empty()) { 255 if (!files.empty()) {
307 256 params << "remove" << "--after" << "--force" << "--" << files;
308 params << "remove" << "--after" << "--force" << "--" << files; 257 runner->requestAction(HgAction(ACT_REMOVE, workFolderPath, params));
309 runner -> startHgCommand(workFolderPath, params); 258 }
310 runningAction = ACT_REMOVE;
311 }
312 259
313 /*!!! 260 /*!!!
314 QString currentFile;//!!! = hgTabs -> getCurrentFileListLine(); 261 QString currentFile;//!!! = hgTabs -> getCurrentFileListLine();
315 262
316 if (!currentFile.isEmpty()) 263 if (!currentFile.isEmpty())
323 runner -> startHgCommand(workFolderPath, params); 270 runner -> startHgCommand(workFolderPath, params);
324 runningAction = ACT_REMOVE; 271 runningAction = ACT_REMOVE;
325 } 272 }
326 } 273 }
327 */ 274 */
328 }
329 } 275 }
330 276
331 void MainWindow::hgCommit() 277 void MainWindow::hgCommit()
332 { 278 {
333 //!!! Now that hg actions can be fired asynchronously (e.g. from 279 QStringList params;
334 // the filesystem modified callback) we _really_ need to be able to 280 QString comment;
335 // queue important actions rather than just ignore them if busy! 281
336 282 QStringList files = hgTabs->getSelectedCommittableFiles();
337 if (runningAction == ACT_NONE) 283 if (files.empty()) files = hgTabs->getAllCommittableFiles();
338 { 284
339 QStringList params; 285 if (ConfirmCommentDialog::confirmAndGetLongComment
340 QString comment; 286 (this,
341 287 tr("Commit files"),
342 QStringList files = hgTabs->getSelectedCommittableFiles(); 288 tr("<h2>Commit files</h2><p>About to commit the following files:"),
343 if (files.empty()) files = hgTabs->getAllCommittableFiles(); 289 tr("<h2>Commit files</h2><p>About to commit %1 files."),
344 290 files,
345 if (ConfirmCommentDialog::confirmAndComment(this, 291 comment)) {
346 tr("Commit files"), 292
347 tr("About to commit the following files:"), 293 if ((justMerged == false) && //!!! review usage of justMerged, and how it interacts with asynchronous request queue
348 tr("About to commit %1 files."), 294 !files.empty()) {
349 files, 295 // User wants to commit selected file(s) (and this is not merge commit, which would fail if we selected files)
350 comment, 296 params << "commit" << "--message" << comment << "--user" << getUserInfo() << "--" << files;
351 true)) { 297 } else {
352 298 // Commit all changes
353 //!!! do something more sensible when the comment is empty 299 params << "commit" << "--message" << comment << "--user" << getUserInfo();
354 // (i.e. tell the user about it?) 300 }
355 301
356 if ((justMerged == false) && //!!! review usage of justMerged 302 runner->requestAction(HgAction(ACT_COMMIT, workFolderPath, params));
357 !files.empty()) {
358 // User wants to commit selected file(s) (and this is not merge commit, which would fail if we selected files)
359 params << "commit" << "--message" << comment << "--user" << getUserInfo() << "--" << files;
360 } else {
361 // Commit all changes
362 params << "commit" << "--message" << comment << "--user" << getUserInfo();
363 }
364
365 runner -> startHgCommand(workFolderPath, params, false);
366 runningAction = ACT_COMMIT;
367 }
368 } 303 }
369 } 304 }
370 305
371 QString MainWindow::filterTag(QString tag) 306 QString MainWindow::filterTag(QString tag)
372 { 307 {
385 } 320 }
386 321
387 322
388 void MainWindow::hgTag() 323 void MainWindow::hgTag()
389 { 324 {
390 if (runningAction == ACT_NONE) 325 QStringList params;
326 QString tag;
327
328 if (ConfirmCommentDialog::confirmAndGetShortComment
329 (this,
330 tr("Tag"),
331 tr("Enter tag:"),
332 tag)) {
333 if (!tag.isEmpty()) //!!! do something better if it is empty
334 {
335 params << "tag" << "--user" << getUserInfo() << filterTag(tag);
336
337 runner->requestAction(HgAction(ACT_TAG, workFolderPath, params));
338 }
339 }
340 }
341
342
343 void MainWindow::hgIgnore()
344 {
345 QString hgIgnorePath;
346 QStringList params;
347 QString editorName;
348
349 hgIgnorePath = workFolderPath;
350 hgIgnorePath += ".hgignore";
351
352 params << hgIgnorePath;
353
354 if ((getSystem() == "Linux"))
391 { 355 {
392 QStringList params; 356 editorName = "gedit";
393 QString tag; 357 }
394 358 else
395 if (ConfirmCommentDialog::confirmAndComment(this,
396 tr("Tag"),
397 tr("Enter tag:"),
398 tag,
399 false)) {
400 if (!tag.isEmpty()) //!!! do something better if it is empty
401 {
402 params << "tag" << "--user" << getUserInfo() << filterTag(tag);
403
404 runner -> startHgCommand(workFolderPath, params);
405 runningAction = ACT_TAG;
406 }
407 }
408 }
409 }
410
411
412 void MainWindow::hgIgnore()
413 {
414 if (runningAction == ACT_NONE)
415 { 359 {
416 QString hgIgnorePath; 360 editorName = """C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe""";
417 QStringList params; 361 }
418 QString editorName; 362
419 363 HgAction action(ACT_HG_IGNORE, workFolderPath, params);
420 hgIgnorePath = workFolderPath; 364 action.executable = editorName;
421 hgIgnorePath += ".hgignore"; 365
422 366 runner->requestAction(action);
423 params << hgIgnorePath;
424
425 if ((getSystem() == "Linux"))
426 {
427 editorName = "gedit";
428 }
429 else
430 {
431 editorName = """C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe""";
432 }
433
434 runner -> startCommand(editorName, workFolderPath, params);
435 runningAction = ACT_HG_IGNORE;
436 }
437 } 367 }
438 368
439 369
440 370
441 void MainWindow::hgFileDiff() 371 void MainWindow::hgFileDiff()
442 { 372 {
443 if (runningAction == ACT_NONE)
444 {
445 QStringList params; 373 QStringList params;
446 /*!!! 374 /*!!!
447 QString currentFile = hgTabs -> getCurrentFileListLine(); 375 QString currentFile = hgTabs -> getCurrentFileListLine();
448 376
449 if (!currentFile.isEmpty()) 377 if (!currentFile.isEmpty())
452 params << "kdiff3" << "--" << currentFile.mid(2); 380 params << "kdiff3" << "--" << currentFile.mid(2);
453 runner -> startHgCommand(workFolderPath, params); 381 runner -> startHgCommand(workFolderPath, params);
454 runningAction = ACT_FILEDIFF; 382 runningAction = ACT_FILEDIFF;
455 } 383 }
456 */ 384 */
457 }
458 } 385 }
459 386
460 387
461 void MainWindow::hgFolderDiff() 388 void MainWindow::hgFolderDiff()
462 { 389 {
463 if (runningAction == ACT_NONE) 390 QStringList params;
464 { 391
465 QStringList params; 392 //Diff parent against working folder (folder diff)
466 393 params << "--config" << "extensions.extdiff=" << "extdiff" << "-p";
467 //Diff parent against working folder (folder diff) 394
468 params << "kdiff3"; 395 params << "kompare";
469 runner -> startHgCommand(workFolderPath, params); 396
470 runningAction = ACT_FOLDERDIFF; 397 // params << "kdiff3";
471 } 398 runner->requestAction(HgAction(ACT_FOLDERDIFF, workFolderPath, params));
472 } 399 }
473 400
474 401
475 void MainWindow::hgChgSetDiff() 402 void MainWindow::hgChgSetDiff()
476 { 403 {
477 if (runningAction == ACT_NONE)
478 {
479 QStringList params; 404 QStringList params;
480 405
481 //Diff 2 history log versions against each other 406 //Diff 2 history log versions against each other
482 QString revA; 407 QString revA;
483 QString revB; 408 QString revB;
493 else 418 else
494 { 419 {
495 QMessageBox::information(this, tr("Changeset diff"), tr("Please select two changesets from history list or heads list first.")); 420 QMessageBox::information(this, tr("Changeset diff"), tr("Please select two changesets from history list or heads list first."));
496 } 421 }
497 */ 422 */
498 }
499 } 423 }
500 424
501 425
502 426
503 void MainWindow::hgUpdate() 427 void MainWindow::hgUpdate()
504 { 428 {
505 if (runningAction == ACT_NONE) 429 QStringList params;
506 { 430
507 QStringList params; 431 params << "update";
508 432
509 params << "update"; 433 runner->requestAction(HgAction(ACT_UPDATE, workFolderPath, params));
510
511 runner -> startHgCommand(workFolderPath, params);
512 runningAction = ACT_UPDATE;
513 }
514 } 434 }
515 435
516 436
517 void MainWindow::hgUpdateToRev() 437 void MainWindow::hgUpdateToRev()
518 { 438 {
519 if (runningAction == ACT_NONE)
520 {
521 QStringList params; 439 QStringList params;
522 QString rev; 440 QString rev;
523 /*!!! 441 /*!!!
524 hgTabs -> getUpdateToRevRevision(rev); 442 hgTabs -> getUpdateToRevRevision(rev);
525 443
530 448
531 runner -> startHgCommand(workFolderPath, params); 449 runner -> startHgCommand(workFolderPath, params);
532 450
533 runningAction = ACT_UPDATE; 451 runningAction = ACT_UPDATE;
534 */ 452 */
535 } 453
536 } 454 }
537 455
538 456
539 void MainWindow::hgRevert() 457 void MainWindow::hgRevert()
540 { 458 {
541 if (runningAction == ACT_NONE) 459 QStringList params;
542 { 460 QString comment;
543 //!!! todo: ask user! 461
544 462 QStringList files = hgTabs->getSelectedRevertableFiles();
545 QStringList params; 463 if (files.empty()) files = hgTabs->getAllRevertableFiles();
546 464
547 QStringList files = hgTabs->getSelectedCommittableFiles(); 465 if (ConfirmCommentDialog::confirmDangerousFilesAction
548 466 (this,
467 tr("Revert files"),
468 tr("<h2>Revert files</h2><p>About to revert the following files to their previous committed state. This will <b>throw away any changes</b> that you have made to these files but have not committed."),
469 tr("<h2>Revert files</h2><p>About to revert %1 files. This will <b>throw away any changes</b> that you have made to these files but have not committed."),
470 files)) {
471
549 if (files.empty()) { 472 if (files.empty()) {
550 params << "revert" << "--no-backup"; 473 params << "revert" << "--no-backup";
551 } else { 474 } else {
552 params << "revert" << "--no-backup" << "--" << files; 475 params << "revert" << "--no-backup" << "--" << files;
553 } 476 }
554 477
555 runner -> startHgCommand(workFolderPath, params); 478 runner->requestAction(HgAction(ACT_REVERT, workFolderPath, params));
556 runningAction = ACT_REVERT;
557 } 479 }
558 } 480 }
559 481
560 void MainWindow::hgRetryMerge() 482 void MainWindow::hgRetryMerge()
561 { 483 {
562 if (runningAction == ACT_NONE) 484 QStringList params;
563 { 485
564 QStringList params; 486 params << "resolve" << "--all";
565 487 runner->requestAction(HgAction(ACT_RETRY_MERGE, workFolderPath, params));
566 params << "resolve" << "--all";
567 runner -> startHgCommand(workFolderPath, params);
568 runningAction = ACT_RETRY_MERGE;
569 }
570 } 488 }
571 489
572 490
573 void MainWindow::hgMerge() 491 void MainWindow::hgMerge()
574 { 492 {
575 if (runningAction == ACT_NONE) 493 QStringList params;
576 { 494
577 QStringList params; 495 params << "merge";
578 496
579 params << "merge"; 497 runner->requestAction(HgAction(ACT_MERGE, workFolderPath, params));
580
581 runner -> startHgCommand(workFolderPath, params);
582 runningAction = ACT_MERGE;
583 }
584 } 498 }
585 499
586 500
587 void MainWindow::hgCloneFromRemote() 501 void MainWindow::hgCloneFromRemote()
588 { 502 {
589 if (runningAction == ACT_NONE) 503 QStringList params;
590 { 504
591 QStringList params; 505 if (!QDir(workFolderPath).exists()) {
592 506 if (!QDir().mkpath(workFolderPath)) {
593 if (!QDir(workFolderPath).exists()) { 507 DEBUG << "hgCloneFromRemote: Failed to create target path "
594 if (!QDir().mkpath(workFolderPath)) { 508 << workFolderPath << endl;
595 DEBUG << "hgCloneFromRemote: Failed to create target path " 509 //!!! report error
596 << workFolderPath << endl; 510 return;
597 //!!! report error 511 }
598 return; 512 }
599 } 513
600 } 514 params << "clone" << remoteRepoPath << workFolderPath;
601 515
602 params << "clone" << remoteRepoPath << workFolderPath; 516 hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath);
603 517
604 hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath); 518 runner->requestAction(HgAction(ACT_CLONEFROMREMOTE, workFolderPath, params));
605 519 }
606 runner -> startHgCommand(workFolderPath, params, true);
607 runningAction = ACT_CLONEFROMREMOTE;
608 }
609 }
610
611 520
612 void MainWindow::hgInit() 521 void MainWindow::hgInit()
613 { 522 {
614 if (runningAction == ACT_NONE) 523 QStringList params;
615 { 524
616 QStringList params; 525 params << "init";
617 526 params << workFolderPath;
618 params << "init"; 527
619 params << workFolderPath; 528 runner->requestAction(HgAction(ACT_INIT, workFolderPath, params));
620 529 }
621 runner -> startHgCommand(workFolderPath, params);
622 runningAction = ACT_INIT;
623 }
624 }
625
626 530
627 void MainWindow::hgIncoming() 531 void MainWindow::hgIncoming()
628 { 532 {
629 if (runningAction == ACT_NONE) 533 QStringList params;
630 { 534
631 QStringList params; 535 params << "incoming" << "--newest-first" << remoteRepoPath;
632 536
633 params << "incoming" << "--newest-first" << remoteRepoPath; 537 runner->requestAction(HgAction(ACT_INCOMING, workFolderPath, params));
634
635 runner -> startHgCommand(workFolderPath, params, true);
636 runningAction = ACT_INCOMING;
637 }
638 } 538 }
639 539
640 540
641 void MainWindow::hgPull() 541 void MainWindow::hgPull()
642 { 542 {
643 if (runningAction == ACT_NONE) 543 QStringList params;
644 { 544
645 QStringList params; 545 params << "pull" << remoteRepoPath;
646 546
647 params << "pull" << remoteRepoPath; 547 runner->requestAction(HgAction(ACT_PULL, workFolderPath, params));
648
649 runner -> startHgCommand(workFolderPath, params, true);
650 runningAction = ACT_PULL;
651 }
652 } 548 }
653 549
654 550
655 void MainWindow::hgPush() 551 void MainWindow::hgPush()
656 { 552 {
657 if (runningAction == ACT_NONE) 553 QStringList params;
658 { 554
659 QStringList params; 555 params << "push" << remoteRepoPath;
660 556
661 params << "push" << remoteRepoPath; 557 runner->requestAction(HgAction(ACT_PUSH, workFolderPath, params));
662 558 }
663 runner -> startHgCommand(workFolderPath, params, true);
664 runningAction = ACT_PUSH;
665 }
666 }
667
668 559
669 QString MainWindow::listAllUpIpV4Addresses() 560 QString MainWindow::listAllUpIpV4Addresses()
670 { 561 {
671 QString ret; 562 QString ret;
672 QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces(); 563 QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces();
695 } 586 }
696 587
697 588
698 void MainWindow::hgServe() 589 void MainWindow::hgServe()
699 { 590 {
700 if (runningAction == ACT_NONE) 591 QStringList params;
701 { 592 QString msg;
702 QStringList params; 593
703 QString msg; 594 QString addrs = listAllUpIpV4Addresses();
704 595 QTextStream(&msg) << "Server running on address(es) (" << addrs << "), port 8000";
705 QString addrs = listAllUpIpV4Addresses(); 596 params << "serve";
706 QTextStream(&msg) << "Server running on address(es) (" << addrs << "), port 8000"; 597
707 params << "serve"; 598 runner->requestAction(HgAction(ACT_SERVE, workFolderPath, params));
708 599
709 runner -> startHgCommand(workFolderPath, params); 600 QMessageBox::information(this, "Serve", msg, QMessageBox::Close);
710 runningAction = ACT_SERVE; 601 //!!! runner -> killCurrentCommand();
711 602 }
712 QMessageBox::information(this, "Serve", msg, QMessageBox::Close);
713 runner -> killCurrentCommand();
714 }
715 }
716
717 603
718 void MainWindow::startupDialog() 604 void MainWindow::startupDialog()
719 { 605 {
720 StartupDialog *dlg = new StartupDialog(this); 606 StartupDialog *dlg = new StartupDialog(this);
721 if (dlg->exec()) firstStart = false; 607 if (dlg->exec()) firstStart = false;
722 } 608 }
723
724 609
725 void MainWindow::open() 610 void MainWindow::open()
726 { 611 {
727 bool done = false; 612 bool done = false;
728 613
765 result = openInit(arg); 650 result = openInit(arg);
766 } 651 }
767 652
768 if (result) { 653 if (result) {
769 enableDisableActions(); 654 enableDisableActions();
770 hgPaths(); 655 hgQueryPaths();
771 done = true; 656 done = true;
772 } 657 }
773 658
774 } else { 659 } else {
775 660
1094 { 979 {
1095 //!!! should just queue one of these! 980 //!!! should just queue one of these!
1096 hgStat(); 981 hgStat();
1097 } 982 }
1098 983
1099 void MainWindow::commandFailed() 984 void MainWindow::commandFailed(HgAction action, QString stderr)
1100 { 985 {
1101 DEBUG << "MainWindow::commandFailed" << endl; 986 DEBUG << "MainWindow::commandFailed" << endl;
1102 runningAction = ACT_NONE; 987 // runner -> hideProgBar();
1103 runner -> hideProgBar();
1104 988
1105 //!!! N.B hg incoming returns 1 even if successful, if there were no changes 989 //!!! N.B hg incoming returns 1 even if successful, if there were no changes
1106 } 990 }
1107 991
1108 void MainWindow::commandCompleted() 992 void MainWindow::commandCompleted(HgAction completedAction, QString output)
1109 { 993 {
1110 bool shouldHgStat = false; 994 bool shouldHgStat = false;
1111 995
1112 if (runningAction != ACT_NONE) 996 HGACTIONS action = completedAction.action;
997
998 if (action == ACT_NONE) return;
999
1000 switch(action) {
1001
1002 case ACT_QUERY_PATHS:
1113 { 1003 {
1114 //We are running some hg command... 1004 DEBUG << "stdout is " << output << endl;
1115 if (runner -> isCommandRunning() == false) 1005 LogParser lp(output, "=");
1116 { 1006 LogList ll = lp.parse();
1117 //Running has just ended. 1007 DEBUG << ll.size() << " results" << endl;
1118 int exitCode = runner -> getExitCode(); 1008 if (!ll.empty()) {
1119 1009 remoteRepoPath = lp.parse()[0]["default"].trimmed();
1120 runner -> hideProgBar(); 1010 DEBUG << "Set remote path to " << remoteRepoPath << endl;
1121 1011 }
1122 //Clumsy... 1012 MultiChoiceDialog::addRecentArgument("local", workFolderPath);
1123 if ((EXITOK(exitCode)) || ((exitCode == 1) && (runningAction == ACT_INCOMING))) 1013 MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath);
1124 { 1014 hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath);
1125 QString output = runner->getOutput(); 1015 enableDisableActions();
1126 1016 break;
1127 //Successful running. 1017 }
1128 switch(runningAction) 1018
1129 { 1019 case ACT_QUERY_BRANCH:
1130 case ACT_PATHS: 1020 currentBranch = output.trimmed();
1131 { 1021 hgTabs->setBranch(currentBranch);
1132 DEBUG << "stdout is " << output << endl; 1022 break;
1133 LogParser lp(output, "="); 1023
1134 LogList ll = lp.parse(); 1024 case ACT_STAT:
1135 DEBUG << ll.size() << " results" << endl; 1025 hgTabs -> updateWorkFolderFileList(output);
1136 if (!ll.empty()) { 1026 updateFileSystemWatcher();
1137 remoteRepoPath = lp.parse()[0]["default"].trimmed(); 1027 break;
1138 DEBUG << "Set remote path to " << remoteRepoPath << endl; 1028
1139 } 1029 case ACT_INCOMING:
1140 MultiChoiceDialog::addRecentArgument("local", workFolderPath); 1030 case ACT_ANNOTATE:
1141 MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath); 1031 case ACT_RESOLVE_LIST:
1142 hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath); 1032 case ACT_RESOLVE_MARK:
1143 enableDisableActions(); 1033 presentLongStdoutToUser(output);
1144 break; 1034 shouldHgStat = true;
1145 } 1035 break;
1146 1036
1147 case ACT_BRANCH: 1037 case ACT_PULL:
1148 currentBranch = output.trimmed(); 1038 QMessageBox::information(this, "Pull", output);
1149 hgTabs->setBranch(currentBranch); 1039 shouldHgStat = true;
1150 break; 1040 break;
1151 1041
1152 case ACT_STAT: 1042 case ACT_PUSH:
1153 hgTabs -> updateWorkFolderFileList(output); 1043 QMessageBox::information(this, "Push", output);
1154 updateFileSystemWatcher(); 1044 shouldHgStat = true;
1155 break; 1045 break;
1156 1046
1157 case ACT_INCOMING: 1047 case ACT_INIT:
1158 case ACT_ANNOTATE: 1048 MultiChoiceDialog::addRecentArgument("init", workFolderPath);
1159 case ACT_RESOLVE_LIST: 1049 MultiChoiceDialog::addRecentArgument("local", workFolderPath);
1160 case ACT_RESOLVE_MARK: 1050 enableDisableActions();
1161 presentLongStdoutToUser(output); 1051 shouldHgStat = true;
1162 shouldHgStat = true; 1052 break;
1163 break; 1053
1164 1054 case ACT_CLONEFROMREMOTE:
1165 case ACT_PULL: 1055 MultiChoiceDialog::addRecentArgument("local", workFolderPath);
1166 QMessageBox::information(this, "Pull", output); 1056 MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath);
1167 shouldHgStat = true; 1057 MultiChoiceDialog::addRecentArgument("remote", workFolderPath, true);
1168 break; 1058 QMessageBox::information(this, "Clone", output);
1169 1059 enableDisableActions();
1170 case ACT_PUSH: 1060 shouldHgStat = true;
1171 QMessageBox::information(this, "Push", output); 1061 break;
1172 shouldHgStat = true; 1062
1173 break; 1063 case ACT_LOG:
1174 1064 hgTabs -> updateLocalRepoHgLogList(output);
1175 case ACT_INIT: 1065 break;
1176 MultiChoiceDialog::addRecentArgument("init", workFolderPath); 1066
1177 MultiChoiceDialog::addRecentArgument("local", workFolderPath); 1067 case ACT_QUERY_PARENTS:
1178 enableDisableActions(); 1068 foreach (Changeset *cs, currentParents) delete cs;
1179 shouldHgStat = true; 1069 currentParents = Changeset::parseChangesets(output);
1180 break; 1070 break;
1181 1071
1182 case ACT_CLONEFROMREMOTE: 1072 case ACT_QUERY_HEADS:
1183 MultiChoiceDialog::addRecentArgument("local", workFolderPath); 1073 foreach (Changeset *cs, currentHeads) delete cs;
1184 MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath); 1074 currentHeads = Changeset::parseChangesets(output);
1185 MultiChoiceDialog::addRecentArgument("remote", workFolderPath, true); 1075 break;
1186 QMessageBox::information(this, "Clone", output); 1076
1187 enableDisableActions(); 1077 case ACT_REMOVE:
1188 shouldHgStat = true; 1078 case ACT_ADD:
1189 break; 1079 case ACT_COMMIT:
1190 1080 case ACT_FILEDIFF:
1191 case ACT_LOG: 1081 case ACT_FOLDERDIFF:
1192 hgTabs -> updateLocalRepoHgLogList(output); 1082 case ACT_CHGSETDIFF:
1193 break; 1083 case ACT_REVERT:
1194 1084 case ACT_SERVE:
1195 case ACT_PARENTS: 1085 case ACT_TAG:
1196 foreach (Changeset *cs, currentParents) delete cs; 1086 case ACT_HG_IGNORE:
1197 currentParents = Changeset::parseChangesets(output); 1087 shouldHgStat = true;
1198 break; 1088 break;
1199 1089
1200 case ACT_HEADS: 1090 case ACT_UPDATE:
1201 foreach (Changeset *cs, currentHeads) delete cs; 1091 QMessageBox::information(this, tr("Update"), output);
1202 currentHeads = Changeset::parseChangesets(output); 1092 shouldHgStat = true;
1203 break; 1093 break;
1204 1094
1205 case ACT_REMOVE: 1095 case ACT_MERGE:
1206 case ACT_ADD: 1096 QMessageBox::information(this, tr("Merge"), output);
1207 case ACT_COMMIT: 1097 shouldHgStat = true;
1208 case ACT_FILEDIFF: 1098 justMerged = true;
1209 case ACT_FOLDERDIFF: 1099 break;
1210 case ACT_CHGSETDIFF: 1100
1211 case ACT_REVERT: 1101 case ACT_RETRY_MERGE:
1212 case ACT_SERVE: 1102 QMessageBox::information(this, tr("Merge retry"), tr("Merge retry successful."));
1213 case ACT_TAG: 1103 shouldHgStat = true;
1214 case ACT_HG_IGNORE: 1104 justMerged = true;
1215 shouldHgStat = true; 1105 break;
1216 break; 1106
1217 1107 default:
1218 case ACT_UPDATE: 1108 break;
1219 QMessageBox::information(this, tr("Update"), output); 1109 }
1220 shouldHgStat = true; 1110
1221 break; 1111 enableDisableActions();
1222 1112
1223 case ACT_MERGE: 1113 // Typical sequence goes paths -> branch -> stat -> heads -> parents -> log
1224 QMessageBox::information(this, tr("Merge"), output); 1114 if (action == ACT_QUERY_PATHS) {
1225 shouldHgStat = true; 1115 hgQueryBranch();
1226 justMerged = true; 1116 } else if (action == ACT_QUERY_BRANCH) {
1227 break; 1117 hgStat();
1228 1118 } else if (action == ACT_STAT) {
1229 case ACT_RETRY_MERGE: 1119 hgQueryHeads();
1230 QMessageBox::information(this, tr("Merge retry"), tr("Merge retry successful.")); 1120 } else if (action == ACT_QUERY_HEADS) {
1231 shouldHgStat = true; 1121 hgQueryParents();
1232 justMerged = true; 1122 } else if (action == ACT_QUERY_PARENTS) {
1233 break; 1123 hgLog();
1234 1124 } else
1235 default: 1125 /* Move to commandFailed
1236 break; 1126 if ((runningAction == ACT_MERGE) && (exitCode != 0))
1237 }
1238 }
1239
1240
1241 //Typical sequence goes paths -> branch -> stat -> heads -> parents -> log
1242 if (runningAction == ACT_PATHS)
1243 {
1244 runningAction = ACT_NONE;
1245 hgBranch();
1246 }
1247 else if (runningAction == ACT_BRANCH)
1248 {
1249 runningAction = ACT_NONE;
1250 hgStat();
1251 }
1252 else if (runningAction == ACT_STAT)
1253 {
1254 runningAction = ACT_NONE;
1255 hgHeads();
1256 }
1257 else if (runningAction == ACT_HEADS)
1258 {
1259 runningAction = ACT_NONE;
1260 hgParents();
1261 }
1262 else if (runningAction == ACT_PARENTS)
1263 {
1264 runningAction = ACT_NONE;
1265 hgLog();
1266 }
1267 else if ((runningAction == ACT_MERGE) && (exitCode != 0))
1268 { 1127 {
1269 // If we had a failed merge, offer to retry 1128 // If we had a failed merge, offer to retry
1270 if (QMessageBox::Ok == QMessageBox::information(this, tr("Retry merge ?"), tr("Merge attempt failed. retry ?"), QMessageBox::Ok | QMessageBox::Cancel)) 1129 if (QMessageBox::Ok == QMessageBox::information(this, tr("Retry merge ?"), tr("Merge attempt failed. retry ?"), QMessageBox::Ok | QMessageBox::Cancel))
1271 { 1130 {
1272 runningAction = ACT_NONE; 1131 runningAction = ACT_NONE;
1278 hgStat(); 1137 hgStat();
1279 } 1138 }
1280 } 1139 }
1281 else 1140 else
1282 { 1141 {
1283 runningAction = ACT_NONE; 1142 */
1284 if (shouldHgStat) 1143 if (shouldHgStat) {
1285 { 1144 hgQueryPaths();
1286 hgPaths(); 1145 }
1287 }
1288 }
1289 }
1290 }
1291
1292 enableDisableActions();
1293 } 1146 }
1294 1147
1295 void MainWindow::connectActions() 1148 void MainWindow::connectActions()
1296 { 1149 {
1297 connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); 1150 connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
1298 connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); 1151 connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
1299 connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); 1152 connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
1300 1153
1301 connect(hgStatAct, SIGNAL(triggered()), this, SLOT(hgPaths())); 1154 connect(hgStatAct, SIGNAL(triggered()), this, SLOT(hgQueryPaths()));
1302 connect(hgTabs, SIGNAL(workFolderViewTypesChanged()), this, SLOT(hgPaths()));
1303 connect(hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove())); 1155 connect(hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove()));
1304 connect(hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd())); 1156 connect(hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd()));
1305 connect(hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit())); 1157 connect(hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit()));
1306 connect(hgFileDiffAct, SIGNAL(triggered()), this, SLOT(hgFileDiff())); 1158 connect(hgFileDiffAct, SIGNAL(triggered()), this, SLOT(hgFileDiff()));
1307 connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff())); 1159 connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff()));
1320 connect(hgCloneFromRemoteAct, SIGNAL(triggered()), this, SLOT(hgCloneFromRemote())); 1172 connect(hgCloneFromRemoteAct, SIGNAL(triggered()), this, SLOT(hgCloneFromRemote()));
1321 connect(hgIncomingAct, SIGNAL(triggered()), this, SLOT(hgIncoming())); 1173 connect(hgIncomingAct, SIGNAL(triggered()), this, SLOT(hgIncoming()));
1322 connect(hgPullAct, SIGNAL(triggered()), this, SLOT(hgPull())); 1174 connect(hgPullAct, SIGNAL(triggered()), this, SLOT(hgPull()));
1323 connect(hgPushAct, SIGNAL(triggered()), this, SLOT(hgPush())); 1175 connect(hgPushAct, SIGNAL(triggered()), this, SLOT(hgPush()));
1324 1176
1325 connect(hgTabs, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); 1177 // connect(hgTabs, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
1326 1178
1327 connect(hgUpdateToRevAct, SIGNAL(triggered()), this, SLOT(hgUpdateToRev())); 1179 connect(hgUpdateToRevAct, SIGNAL(triggered()), this, SLOT(hgUpdateToRev()));
1328 connect(hgAnnotateAct, SIGNAL(triggered()), this, SLOT(hgAnnotate())); 1180 connect(hgAnnotateAct, SIGNAL(triggered()), this, SLOT(hgAnnotate()));
1329 connect(hgResolveListAct, SIGNAL(triggered()), this, SLOT(hgResolveList())); 1181 connect(hgResolveListAct, SIGNAL(triggered()), this, SLOT(hgResolveList()));
1330 connect(hgResolveMarkAct, SIGNAL(triggered()), this, SLOT(hgResolveMark())); 1182 connect(hgResolveMarkAct, SIGNAL(triggered()), this, SLOT(hgResolveMark()));
1331 connect(hgServeAct, SIGNAL(triggered()), this, SLOT(hgServe())); 1183 connect(hgServeAct, SIGNAL(triggered()), this, SLOT(hgServe()));
1332 connect(clearSelectionsAct, SIGNAL(triggered()), this, SLOT(clearSelections())); 1184 connect(clearSelectionsAct, SIGNAL(triggered()), this, SLOT(clearSelections()));
1333 } 1185 }
1334 1186 /*!!!
1335 void MainWindow::tabChanged(int currTab) 1187 void MainWindow::tabChanged(int currTab)
1336 { 1188 {
1337 tabPage = currTab; 1189 tabPage = currTab;
1338 1190
1339 } 1191 }
1340 1192 */
1341 void MainWindow::enableDisableActions() 1193 void MainWindow::enableDisableActions()
1342 { 1194 {
1343 DEBUG << "MainWindow::enableDisableActions" << endl; 1195 DEBUG << "MainWindow::enableDisableActions" << endl;
1344 1196
1345 QDir localRepoDir; 1197 QDir localRepoDir;
1446 } 1298 }
1447 } 1299 }
1448 } 1300 }
1449 hgMergeAct->setEnabled(localRepoActionsEnabled && canMerge); 1301 hgMergeAct->setEnabled(localRepoActionsEnabled && canMerge);
1450 hgUpdateAct->setEnabled(localRepoActionsEnabled && canUpdate); 1302 hgUpdateAct->setEnabled(localRepoActionsEnabled && canUpdate);
1451
1452 /*!!!
1453 int added, modified, removed, notTracked, selected, selectedAdded, selectedModified, selectedRemoved, selectedNotTracked;
1454
1455 countModifications(hgTabs -> workFolderFileList,
1456 added, modified, removed, notTracked,
1457 selected,
1458 selectedAdded, selectedModified, selectedRemoved, selectedNotTracked);
1459
1460 if (tabPage == WORKTAB)
1461 {
1462 //Enable / disable actions according to workFolderFileList selections / currentSelection / count
1463 hgChgSetDiffAct -> setEnabled(false);
1464 hgUpdateToRevAct -> setEnabled(false);
1465
1466 if (localRepoActionsEnabled)
1467 {
1468 if ((added == 0) && (modified == 0) && (removed == 0))
1469 {
1470 hgCommitAct -> setEnabled(false);
1471 hgRevertAct -> setEnabled(false);
1472 }
1473 else if (selected != 0)
1474 {
1475 if (selectedNotTracked != 0)
1476 {
1477 hgCommitAct -> setEnabled(false);
1478 }
1479 else if ((selectedAdded == 0) && (selectedModified == 0) && (selectedRemoved == 0))
1480 {
1481 hgCommitAct -> setEnabled(false);
1482 }
1483 }
1484
1485 if (modified == 0)
1486 {
1487 hgFolderDiffAct -> setEnabled(false);
1488 }
1489
1490 if (!isSelectedModified(hgTabs -> workFolderFileList))
1491 {
1492 hgFileDiffAct -> setEnabled(false);
1493 hgRevertAct -> setEnabled(false);
1494 }
1495
1496 //JK 14.5.2010: Fixed confusing add button. Now this is simple: If we have something to add (any non-tracked files), add is enabled.
1497 if (notTracked == 0)
1498 {
1499 hgAddAct -> setEnabled(false);
1500 }
1501
1502 if (!isSelectedDeletable(hgTabs -> workFolderFileList))
1503 {
1504 hgRemoveAct -> setEnabled(false);
1505 }
1506
1507 hgResolveListAct -> setEnabled(true);
1508
1509 if (hgTabs -> localRepoHeadsList->count() < 2)
1510 {
1511 hgMergeAct -> setEnabled(false);
1512 hgRetryMergeAct -> setEnabled(false);
1513 }
1514
1515 if (hgTabs -> localRepoHeadsList->count() < 1)
1516 {
1517 hgTagAct -> setEnabled(false);
1518 }
1519
1520 QString currentFile = hgTabs -> getCurrentFileListLine();
1521 if (!currentFile.isEmpty())
1522 {
1523 hgAnnotateAct -> setEnabled(true);
1524 hgResolveMarkAct -> setEnabled(true);
1525 }
1526 else
1527 {
1528 hgAnnotateAct -> setEnabled(false);
1529 hgResolveMarkAct -> setEnabled(false);
1530 }
1531 }
1532 }
1533 else
1534 {
1535 QList <QListWidgetItem *> headSelList = hgTabs -> localRepoHeadsList->selectedItems();
1536 QList <QListWidgetItem *> historySelList = hgTabs -> localRepoHgLogList->selectedItems();
1537
1538 if ((historySelList.count() == 2) || (headSelList.count() == 2))
1539 {
1540 hgChgSetDiffAct -> setEnabled(true);
1541 }
1542 else
1543 {
1544 hgChgSetDiffAct -> setEnabled(false);
1545 }
1546
1547 if (historySelList.count() == 1)
1548 {
1549 hgUpdateToRevAct -> setEnabled(true);
1550 }
1551 else
1552 {
1553 hgUpdateToRevAct -> setEnabled(false);
1554 }
1555 }
1556 */
1557 } 1303 }
1558 1304
1559 void MainWindow::createActions() 1305 void MainWindow::createActions()
1560 { 1306 {
1561 //File actions 1307 //File actions
1750 1496
1751 QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint(); 1497 QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
1752 QSize size = settings.value("size", QSize(400, 400)).toSize(); 1498 QSize size = settings.value("size", QSize(400, 400)).toSize();
1753 firstStart = settings.value("firststart", QVariant(true)).toBool(); 1499 firstStart = settings.value("firststart", QVariant(true)).toBool();
1754 1500
1755 initialFileTypesBits = (unsigned char) settings.value("viewFileTypes", QVariant(DEFAULT_HG_STAT_BITS)).toInt(); 1501 //!!! initialFileTypesBits = (unsigned char) settings.value("viewFileTypes", QVariant(DEFAULT_HG_STAT_BITS)).toInt();
1756 resize(size); 1502 resize(size);
1757 move(pos); 1503 move(pos);
1758 } 1504 }
1759 1505
1760 1506