changeset 414:939701b848e5 ignore

Start to introduce HgIgnoreDialog
author Chris Cannam
date Wed, 15 Jun 2011 16:32:21 +0100
parents 2a19d5706673
children 6d7dad48b13c
files easyhg.pro src/hgignoredialog.cpp src/hgignoredialog.h src/mainwindow.cpp
diffstat 4 files changed, 115 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/easyhg.pro	Mon Jun 13 17:28:49 2011 +0100
+++ b/easyhg.pro	Wed Jun 15 16:32:21 2011 +0100
@@ -4,6 +4,9 @@
 TEMPLATE = app
 TARGET = EasyMercurial
 
+QMAKE_CXX = clang++
+QMAKE_LINK = clang++
+
 # We use the 10.4 SDK and Carbon for all 32-bit OS/X,
 # and 10.6 with Cocoa for all 64-bit
 macx-g++40 {
@@ -61,7 +64,8 @@
     src/clickablelabel.h \
     src/workstatuswidget.h \
     src/moreinformationdialog.h \
-    src/annotatedialog.h
+    src/annotatedialog.h \
+    src/hgignoredialog.h
 SOURCES = \
     src/main.cpp \
     src/mainwindow.cpp \
@@ -95,7 +99,8 @@
     src/settingsdialog.cpp \
     src/workstatuswidget.cpp \
     src/moreinformationdialog.cpp \
-    src/annotatedialog.cpp
+    src/annotatedialog.cpp \
+    src/hgignoredialog.cpp
 
 macx-* {
     SOURCES += src/common_osx.mm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hgignoredialog.cpp	Wed Jun 15 16:32:21 2011 +0100
@@ -0,0 +1,54 @@
+/* -*- 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) 2011 Chris Cannam
+    Copyright (c) 2011 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 "hgignoredialog.h"
+#include "common.h"
+#include "debug.h"
+
+HgIgnoreDialog::IgnoreType
+HgIgnoreDialog::confirmIgnore(QStringList files, QStringList suffixes)
+{
+    QString text = "<qt>";
+
+    if (files.size() < 10) {
+        text += tr("You have asked to ignore the following files:");
+        text += "<p><code>";
+        foreach (QString f, files) {
+            text += "&nbsp;&nbsp;&nbsp;" + xmlEncode(f) + "<br>";
+        }
+        text += "</code>";
+    } else {
+        text += "<p>";
+        text += tr("You have asked to ignore %1 file(s).", "", files.size());
+        text += "</p>";
+    }
+
+    if (suffixes.size() > 0) {
+
+        text += "<p>";
+        text += tr("Would you like to:");
+        text += "<ul>";
+
+
+	//...
+    
+    }
+
+
+    return IgnoreNothing;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hgignoredialog.h	Wed Jun 15 16:32:21 2011 +0100
@@ -0,0 +1,39 @@
+/* -*- 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) 2011 Chris Cannam
+    Copyright (c) 2011 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 _HGIGNORE_DIALOG_H_
+#define _HGIGNORE_DIALOG_H_
+
+#include <QDialog>
+
+class HgIgnoreDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+    enum IgnoreType {
+	IgnoreNothing,
+	IgnoreGivenFilesOnly,
+	IgnoreAllFilesOfGivenNames,
+	IgnoreAllFilesOfGivenSuffixes
+    };
+
+    static IgnoreType confirmIgnore(QStringList files, QStringList suffixes);
+
+};
+
+#endif
--- a/src/mainwindow.cpp	Mon Jun 13 17:28:49 2011 +0100
+++ b/src/mainwindow.cpp	Wed Jun 15 16:32:21 2011 +0100
@@ -48,6 +48,7 @@
 #include "annotatedialog.h"
 #include "version.h"
 #include "workstatuswidget.h"
+#include "hgignoredialog.h"
 
 
 MainWindow::MainWindow(QString myDirPath) :
@@ -603,7 +604,20 @@
     // Do we need different mechanisms based on whether we have glob
     // or regex syntax?
 
-    DEBUG << "MainWindow::hgIgnoreFiles: Not implemented" << endl;
+    DEBUG << "MainWindow::hgIgnoreFiles: File names are:" << endl;
+    foreach (QString file, files) DEBUG << file << endl;
+
+    QSet<QString> suffixes;
+    foreach (QString file, files) {
+        QString s = QFileInfo(file).suffix();
+        if (s != "") suffixes.insert(s);
+    }
+
+    HgIgnoreDialog::IgnoreType itype =
+        HgIgnoreDialog::confirmIgnore(files, QStringList::fromSet(suffixes));
+
+    
+    
 }
 
 void MainWindow::hgUnIgnoreFiles(QStringList files)