changeset 88:c5e34ed5b791

* Start work on new file-status widget
author Chris Cannam
date Tue, 23 Nov 2010 11:33:15 +0000
parents a7904378ac6a
children 622da79c0f4f
files easyhg.pro filestatuswidget.cpp filestatuswidget.h hgexpwidget.cpp hgexpwidget.h statparser.h
diffstat 6 files changed, 170 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/easyhg.pro	Mon Nov 22 21:28:00 2010 +0000
+++ b/easyhg.pro	Tue Nov 23 11:33:15 2010 +0000
@@ -31,7 +31,8 @@
     repositorydialog.h \
     multichoicedialog.h \
     selectablelabel.h \
-    statparser.h
+    statparser.h \
+    filestatuswidget.h
 SOURCES = main.cpp \
     mainwindow.cpp \
     hgexpwidget.cpp \
@@ -54,7 +55,8 @@
     repositorydialog.cpp \
     multichoicedialog.cpp \
     selectablelabel.cpp \
-    statparser.cpp
+    statparser.cpp \
+    filestatuswidget.cpp
 
 macx-* {
     SOURCES += common_osx.mm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filestatuswidget.cpp	Tue Nov 23 11:33:15 2010 +0000
@@ -0,0 +1,90 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
+
+/*
+    EasyMercurial
+
+    Based on HgExplorer by Jari Korhonen
+    Copyright (c) 2010 Jari Korhonen
+    Copyright (c) 2010 Chris Cannam
+    Copyright (c) 2010 Queen Mary, University of London
+    
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License as
+    published by the Free Software Foundation; either version 2 of the
+    License, or (at your option) any later version.  See the file
+    COPYING included with this distribution for more information.
+*/
+
+#include "filestatuswidget.h"
+
+#include <QLabel>
+#include <QListWidget>
+#include <QGridLayout>
+
+FileStatusWidget::FileStatusWidget(QWidget *parent) :
+    QWidget(parent)
+{
+    QGridLayout *layout = new QGridLayout;
+    setLayout(layout);
+
+    int row = 0;
+    
+    layout->addWidget(new QLabel(tr("Local:")), row, 0);
+    m_localPathLabel = new QLabel;
+    layout->addWidget(m_localPathLabel, row, 1);
+
+    ++row;
+    layout->addWidget(new QLabel(tr("Remote:")), row, 0);
+    m_remoteURLLabel = new QLabel;
+    layout->addWidget(m_remoteURLLabel, row, 1);
+
+    m_modifiedList = new QListWidget;
+    m_addedList = new QListWidget;
+    m_unknownList = new QListWidget;
+    m_removedList = new QListWidget;
+    m_missingList = new QListWidget;
+
+    layout->addWidget(m_modifiedList, ++row, 0, 1, 2);
+    layout->addWidget(m_addedList, ++row, 0, 1, 2);
+    layout->addWidget(m_removedList, ++row, 0, 1, 2);
+    layout->addWidget(m_unknownList, ++row, 0, 1, 2);
+    layout->addWidget(m_missingList, ++row, 0, 1, 2);
+}
+
+void
+FileStatusWidget::setLocalPath(QString p)
+{
+    m_localPath = p;
+    m_localPathLabel->setText(p);
+}
+
+void
+FileStatusWidget::setRemoteURL(QString r)
+{
+    m_remoteURL = r;
+    m_remoteURLLabel->setText(r);
+}
+
+void
+FileStatusWidget::setStatParser(StatParser p)
+{
+    m_statParser = p;
+    updateWidgets();
+}
+
+void
+FileStatusWidget::updateWidgets()
+{
+    m_modifiedList->clear();
+    m_addedList->clear();
+    m_unknownList->clear();
+    m_removedList->clear();
+    m_missingList->clear();
+
+    m_modifiedList->addItems(m_statParser.modified);
+    m_addedList->addItems(m_statParser.added);
+    m_unknownList->addItems(m_statParser.unknown);
+    m_removedList->addItems(m_statParser.removed);
+    m_missingList->addItems(m_statParser.missing);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filestatuswidget.h	Tue Nov 23 11:33:15 2010 +0000
@@ -0,0 +1,62 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
+
+/*
+    EasyMercurial
+
+    Based on HgExplorer by Jari Korhonen
+    Copyright (c) 2010 Jari Korhonen
+    Copyright (c) 2010 Chris Cannam
+    Copyright (c) 2010 Queen Mary, University of London
+    
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License as
+    published by the Free Software Foundation; either version 2 of the
+    License, or (at your option) any later version.  See the file
+    COPYING included with this distribution for more information.
+*/
+
+#ifndef FILESTATUSWIDGET_H
+#define FILESTATUSWIDGET_H
+
+#include "statparser.h"
+
+#include <QWidget>
+
+class QLabel;
+class QListWidget;
+
+class FileStatusWidget : public QWidget
+{
+    Q_OBJECT
+
+public:
+    FileStatusWidget(QWidget *parent = 0);
+
+    QString localPath() const { return m_localPath; }
+    void setLocalPath(QString p);
+
+    QString remoteURL() const { return m_remoteURL; }
+    void setRemoteURL(QString u);
+
+    StatParser statParser() const { return m_statParser; }
+    void setStatParser(StatParser sp);
+
+private:
+    QString m_localPath;
+    QLabel *m_localPathLabel;
+
+    QString m_remoteURL;
+    QLabel *m_remoteURLLabel;
+    
+    StatParser m_statParser;
+
+    QListWidget *m_modifiedList;
+    QListWidget *m_addedList;
+    QListWidget *m_unknownList;
+    QListWidget *m_removedList;
+    QListWidget *m_missingList;
+
+    void updateWidgets();
+};
+
+#endif
--- a/hgexpwidget.cpp	Mon Nov 22 21:28:00 2010 +0000
+++ b/hgexpwidget.cpp	Tue Nov 23 11:33:15 2010 +0000
@@ -23,6 +23,7 @@
 #include "grapher.h"
 #include "panner.h"
 #include "panned.h"
+#include "filestatuswidget.h"
 
 #include <QClipboard>
 #include <QContextMenuEvent>
@@ -46,7 +47,10 @@
                                                     "I: Ignored (via .hgignore file)"};
 
 
-HgExpWidget::HgExpWidget(QWidget *parent, QString remoteRepo, QString workFolderPath, unsigned char viewFileTypesBits): QTabWidget(parent)
+HgExpWidget::HgExpWidget(QWidget *parent, QString remoteRepo,
+                         QString workFolderPath,
+                         unsigned char viewFileTypesBits) :
+    QTabWidget(parent)
 {
     //Work page
     //Work page
@@ -105,6 +109,10 @@
     mainLayout -> addWidget(grpWorkFolder, 12);
     addTab(workPageWidget, tr("My work"));
 
+    // New work page
+    fileStatusWidget = new FileStatusWidget;
+    addTab(fileStatusWidget, tr("My work (new)"));
+
     // History graph page
     historyGraphPageWidget = new QWidget;
     Panned *panned = new Panned;
--- a/hgexpwidget.h	Mon Nov 22 21:28:00 2010 +0000
+++ b/hgexpwidget.h	Tue Nov 23 11:33:15 2010 +0000
@@ -28,10 +28,12 @@
 #include <QVBoxLayout>
 #include <QCheckBox>
 #include <QLabel>
-
+#include <QTabWidget>
 
 #define NUM_STAT_FILE_TYPES 7
 
+class FileStatusWidget;
+
 
 class HgExpWidget: public QTabWidget
 {
@@ -65,6 +67,8 @@
     void copyComment();
 
 private:
+    FileStatusWidget *fileStatusWidget;
+
     QGroupBox   *grpRemoteRepo;
     QWidget     *workPageWidget;
     QWidget     *historyGraphPageWidget;
--- a/statparser.h	Mon Nov 22 21:28:00 2010 +0000
+++ b/statparser.h	Tue Nov 23 11:33:15 2010 +0000
@@ -31,7 +31,6 @@
     QStringList unknown;
     QStringList removed;
     QStringList missing;
-
 };
 
 #endif // STATPARSER_H