Chris@88
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@88
|
2
|
Chris@88
|
3 /*
|
Chris@88
|
4 EasyMercurial
|
Chris@88
|
5
|
Chris@88
|
6 Based on HgExplorer by Jari Korhonen
|
Chris@88
|
7 Copyright (c) 2010 Jari Korhonen
|
Chris@88
|
8 Copyright (c) 2010 Chris Cannam
|
Chris@88
|
9 Copyright (c) 2010 Queen Mary, University of London
|
Chris@88
|
10
|
Chris@88
|
11 This program is free software; you can redistribute it and/or
|
Chris@88
|
12 modify it under the terms of the GNU General Public License as
|
Chris@88
|
13 published by the Free Software Foundation; either version 2 of the
|
Chris@88
|
14 License, or (at your option) any later version. See the file
|
Chris@88
|
15 COPYING included with this distribution for more information.
|
Chris@88
|
16 */
|
Chris@88
|
17
|
Chris@88
|
18 #include "filestatuswidget.h"
|
Chris@88
|
19
|
Chris@88
|
20 #include <QLabel>
|
Chris@88
|
21 #include <QListWidget>
|
Chris@88
|
22 #include <QGridLayout>
|
Chris@88
|
23
|
Chris@88
|
24 FileStatusWidget::FileStatusWidget(QWidget *parent) :
|
Chris@88
|
25 QWidget(parent)
|
Chris@88
|
26 {
|
Chris@88
|
27 QGridLayout *layout = new QGridLayout;
|
Chris@88
|
28 setLayout(layout);
|
Chris@88
|
29
|
Chris@88
|
30 int row = 0;
|
Chris@88
|
31
|
Chris@88
|
32 layout->addWidget(new QLabel(tr("Local:")), row, 0);
|
Chris@88
|
33 m_localPathLabel = new QLabel;
|
Chris@88
|
34 layout->addWidget(m_localPathLabel, row, 1);
|
Chris@88
|
35
|
Chris@88
|
36 ++row;
|
Chris@88
|
37 layout->addWidget(new QLabel(tr("Remote:")), row, 0);
|
Chris@88
|
38 m_remoteURLLabel = new QLabel;
|
Chris@88
|
39 layout->addWidget(m_remoteURLLabel, row, 1);
|
Chris@88
|
40
|
Chris@88
|
41 m_modifiedList = new QListWidget;
|
Chris@88
|
42 m_addedList = new QListWidget;
|
Chris@88
|
43 m_unknownList = new QListWidget;
|
Chris@88
|
44 m_removedList = new QListWidget;
|
Chris@88
|
45 m_missingList = new QListWidget;
|
Chris@88
|
46
|
Chris@88
|
47 layout->addWidget(m_modifiedList, ++row, 0, 1, 2);
|
Chris@88
|
48 layout->addWidget(m_addedList, ++row, 0, 1, 2);
|
Chris@88
|
49 layout->addWidget(m_removedList, ++row, 0, 1, 2);
|
Chris@88
|
50 layout->addWidget(m_unknownList, ++row, 0, 1, 2);
|
Chris@88
|
51 layout->addWidget(m_missingList, ++row, 0, 1, 2);
|
Chris@88
|
52 }
|
Chris@88
|
53
|
Chris@88
|
54 void
|
Chris@88
|
55 FileStatusWidget::setLocalPath(QString p)
|
Chris@88
|
56 {
|
Chris@88
|
57 m_localPath = p;
|
Chris@88
|
58 m_localPathLabel->setText(p);
|
Chris@88
|
59 }
|
Chris@88
|
60
|
Chris@88
|
61 void
|
Chris@88
|
62 FileStatusWidget::setRemoteURL(QString r)
|
Chris@88
|
63 {
|
Chris@88
|
64 m_remoteURL = r;
|
Chris@88
|
65 m_remoteURLLabel->setText(r);
|
Chris@88
|
66 }
|
Chris@88
|
67
|
Chris@88
|
68 void
|
Chris@88
|
69 FileStatusWidget::setStatParser(StatParser p)
|
Chris@88
|
70 {
|
Chris@88
|
71 m_statParser = p;
|
Chris@88
|
72 updateWidgets();
|
Chris@88
|
73 }
|
Chris@88
|
74
|
Chris@88
|
75 void
|
Chris@88
|
76 FileStatusWidget::updateWidgets()
|
Chris@88
|
77 {
|
Chris@88
|
78 m_modifiedList->clear();
|
Chris@88
|
79 m_addedList->clear();
|
Chris@88
|
80 m_unknownList->clear();
|
Chris@88
|
81 m_removedList->clear();
|
Chris@88
|
82 m_missingList->clear();
|
Chris@88
|
83
|
Chris@88
|
84 m_modifiedList->addItems(m_statParser.modified);
|
Chris@88
|
85 m_addedList->addItems(m_statParser.added);
|
Chris@88
|
86 m_unknownList->addItems(m_statParser.unknown);
|
Chris@88
|
87 m_removedList->addItems(m_statParser.removed);
|
Chris@88
|
88 m_missingList->addItems(m_statParser.missing);
|
Chris@88
|
89 }
|
Chris@88
|
90
|