Mercurial > hg > easyhg
comparison filestatuswidget.cpp @ 287:3fbafca196e4 status_outside_tabs
Move work-folder state area outside tabs widget
author | Chris Cannam |
---|---|
date | Mon, 21 Feb 2011 11:07:21 +0000 |
parents | bc39f2e28da8 |
children | e4284fab6962 |
comparison
equal
deleted
inserted
replaced
286:3b0ff2b96c53 | 287:3fbafca196e4 |
---|---|
16 */ | 16 */ |
17 | 17 |
18 #include "filestatuswidget.h" | 18 #include "filestatuswidget.h" |
19 #include "debug.h" | 19 #include "debug.h" |
20 #include "multichoicedialog.h" | 20 #include "multichoicedialog.h" |
21 #include "workstatuswidget.h" | |
22 | 21 |
23 #include <QLabel> | 22 #include <QLabel> |
24 #include <QListWidget> | 23 #include <QListWidget> |
25 #include <QGridLayout> | 24 #include <QGridLayout> |
26 #include <QFileInfo> | 25 #include <QFileInfo> |
40 QGridLayout *layout = new QGridLayout; | 39 QGridLayout *layout = new QGridLayout; |
41 layout->setMargin(10); | 40 layout->setMargin(10); |
42 setLayout(layout); | 41 setLayout(layout); |
43 | 42 |
44 int row = 0; | 43 int row = 0; |
45 | |
46 m_workStatus = new WorkStatusWidget(this); | |
47 layout->addWidget(m_workStatus, row, 0, 1, 3); | |
48 ++row; | |
49 | 44 |
50 m_noModificationsLabel = new QLabel; | 45 m_noModificationsLabel = new QLabel; |
51 setNoModificationsLabelText(); | 46 setNoModificationsLabelText(); |
52 layout->addWidget(m_noModificationsLabel, row, 1, 1, 2); | 47 layout->addWidget(m_noModificationsLabel, row, 1, 1, 2); |
53 m_noModificationsLabel->hide(); | 48 m_noModificationsLabel->hide(); |
360 } | 355 } |
361 | 356 |
362 QString | 357 QString |
363 FileStatusWidget::localPath() const | 358 FileStatusWidget::localPath() const |
364 { | 359 { |
365 return m_workStatus->localPath(); | 360 return m_localPath; |
366 } | 361 } |
367 | 362 |
368 void | 363 void |
369 FileStatusWidget::setLocalPath(QString p) | 364 FileStatusWidget::setLocalPath(QString p) |
370 { | 365 { |
371 m_workStatus->setLocalPath(p); | 366 m_localPath = p; |
372 delete m_dateReference; | 367 delete m_dateReference; |
373 m_dateReference = new QFileInfo(p + "/.hg/dirstate"); | 368 m_dateReference = new QFileInfo(p + "/.hg/dirstate"); |
374 if (!m_dateReference->exists() || | 369 if (!m_dateReference->exists() || |
375 !m_dateReference->isFile() || | 370 !m_dateReference->isFile() || |
376 !m_dateReference->isReadable()) { | 371 !m_dateReference->isReadable()) { |
381 delete m_dateReference; | 376 delete m_dateReference; |
382 m_dateReference = 0; | 377 m_dateReference = 0; |
383 } | 378 } |
384 } | 379 } |
385 | 380 |
386 QString | |
387 FileStatusWidget::remoteURL() const | |
388 { | |
389 return m_workStatus->remoteURL(); | |
390 } | |
391 | |
392 void | |
393 FileStatusWidget::setRemoteURL(QString r) | |
394 { | |
395 m_workStatus->setRemoteURL(r); | |
396 } | |
397 | |
398 QString | |
399 FileStatusWidget::state() const | |
400 { | |
401 return m_workStatus->state(); | |
402 } | |
403 | |
404 void | |
405 FileStatusWidget::setState(QString b) | |
406 { | |
407 m_workStatus->setState(b); | |
408 } | |
409 | |
410 void | 381 void |
411 FileStatusWidget::setFileStates(FileStates p) | 382 FileStatusWidget::setFileStates(FileStates p) |
412 { | 383 { |
413 m_fileStates = p; | 384 m_fileStates = p; |
414 updateWidgets(); | 385 updateWidgets(); |
441 bool highlighted = false; | 412 bool highlighted = false; |
442 | 413 |
443 if (s == FileStates::Unknown) { | 414 if (s == FileStates::Unknown) { |
444 // We want to highlight untracked files that have appeared | 415 // We want to highlight untracked files that have appeared |
445 // since the last interaction with the repo | 416 // since the last interaction with the repo |
446 QString fn(m_workStatus->localPath() + "/" + file); | 417 QString fn(m_localPath + "/" + file); |
447 DEBUG << "comparing with " << fn << endl; | 418 DEBUG << "comparing with " << fn << endl; |
448 QFileInfo fi(fn); | 419 QFileInfo fi(fn); |
449 if (fi.exists() && fi.created() > lastInteractionTime) { | 420 if (fi.exists() && fi.created() > lastInteractionTime) { |
450 DEBUG << "file " << fn << " is newer (" << fi.lastModified() | 421 DEBUG << "file " << fn << " is newer (" << fi.lastModified() |
451 << ") than reference" << endl; | 422 << ") than reference" << endl; |