]> gitweb.hamatoma.de Git - reqt/commitdiff
ReFinder: fix delete problem in option dialog
authorhama <hama@siduction.net>
Tue, 19 May 2015 22:05:48 +0000 (00:05 +0200)
committerhama <hama@siduction.net>
Tue, 19 May 2015 22:05:48 +0000 (00:05 +0200)
* ReFinder: handling of up-down keys in option dialog
* ReFind: improvements
* ReViewer: base classes

14 files changed:
appl/refind/dialogoptions.cpp
appl/refind/dialogoptions.hpp
appl/refind/mainwindow.cpp
appl/reviewer/about.ui [new file with mode: 0644]
appl/reviewer/aboutdialog.cpp [new file with mode: 0644]
appl/reviewer/aboutdialog.hpp [new file with mode: 0644]
appl/reviewer/aboutdialog.ui [new file with mode: 0644]
appl/reviewer/main.cpp [new file with mode: 0644]
appl/reviewer/mainwindow.cpp [new file with mode: 0644]
appl/reviewer/mainwindow.hpp [new file with mode: 0644]
appl/reviewer/mainwindow.ui [new file with mode: 0644]
appl/reviewer/reviewer.pro [new file with mode: 0644]
appl/reviewer/reviewer.qrc [new file with mode: 0644]
base/ReFile.cpp

index 75bfb199dae1d5abe728b3af16c17e03e895b7bf..358cc3db62b823480e571d073708bca28e17c1b7 100644 (file)
 #include "ui_dialogoptions.h"
 #include "math.h"
 #include <QFileDialog>
+#include <QEvent>
+#include <QKeyEvent>
 
+/**
+ * Constructor.
+ *
+ * @param dialog    the option dialog
+ */
+TableKeyPressEater::TableKeyPressEater(DialogOptions* dialog) :
+    QObject(dialog),
+    m_dialog(dialog)
+{
+}
+
+
+/**
+ * Event handler for the up/down keys of the table widget.
+ *
+ * @param obj       the table widget
+ * @param event     the current event
+ * @return
+ */
+bool TableKeyPressEater::eventFilter(QObject *obj, QEvent *event)
+{
+    if (event->type() == QEvent::KeyPress){
+        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+        int key = keyEvent->key();
+        if (key == Qt::Key_Up || key == Qt::Key_Down)
+            m_dialog->handleKey(key);
+    }
+    // standard event processing
+    return QObject::eventFilter(obj, event);
+}
 /**
  * Constructor.
  *
@@ -33,6 +65,9 @@ DialogOptions::DialogOptions(ContextHandlerList& handlers, QWidget *parent) :
    connect(ui->pushButtonUp, SIGNAL(clicked()), this, SLOT(up()));
    connect(ui->tableWidget, SIGNAL(cellClicked(int,int)), this, SLOT(cellEntered(int,int)));
    connect(ui->tableWidget, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
+   connect(ui->tableWidget, SIGNAL(currentItemChanged()), this, SLOT(currentItemChanged()));
+   ui->tableWidget->installEventFilter(new TableKeyPressEater(this));
+
    for (int ix = 0; ix < ui->comboBoxFileType->count(); ix++)
       m_fileTypes.append(ui->comboBoxFileType->itemText(ix));
    for (int ix = 0; ix < ui->comboBoxDirMode->count(); ix++)
@@ -48,6 +83,11 @@ DialogOptions::~DialogOptions(){
    delete ui;
 }
 
+void DialogOptions::currentItemChanged(QTableWidgetItem * current,
+                                       QTableWidgetItem * previous){
+    QString text = current->text() + " " + previous->text();
+}
+
 /**
  * Handles the event "pushed button add".
  */
@@ -118,10 +158,7 @@ void DialogOptions::currentToTable(int row){
  */
 void DialogOptions::del(){
    int count = ui->tableWidget->rowCount() - 1;
-   int start = m_selectedRow;
-   if (start == 0)
-      start = 1;
-   for (int row = start; row < count; row++){
+   for (int row = m_selectedRow + 1; row <= count; row++){
       swapRows(row, row - 1);
    }
    ui->tableWidget->setRowCount(count);
@@ -191,6 +228,22 @@ void DialogOptions::fromTable(){
    }
 }
 
+/**
+ * Handles the up/down key press event.
+ *
+ * @param key   the key (up or down)
+ */
+void DialogOptions::handleKey(int key)
+{
+    if (key == Qt::Key_Down){
+        if (m_selectedRow < ui->tableWidget->rowCount() - 1)
+            m_selectedRow++;
+    } else if (key == Qt::Key_Up){
+        if (m_selectedRow > 0)
+            m_selectedRow--;
+    }
+}
+
 /**
  * Deselects the current row and selects another.
  * @param row   the number of the new selected row
index da9d9ec79e8e2caa406cbf96fb4b1e06e2ea008c..5f15e91794d7f63815f6fe3ac70f60202314ca10 100644 (file)
@@ -15,6 +15,18 @@ namespace Ui {
 class DialogOptions;
 }
 
+class DialogOptions;
+class TableKeyPressEater : public QObject
+{
+    Q_OBJECT
+public:
+    TableKeyPressEater(DialogOptions* dialog);
+protected:
+    bool eventFilter(QObject *obj, QEvent *event);
+private:
+    DialogOptions* m_dialog;
+};
+
 class DialogOptions: public QDialog {
    Q_OBJECT
 
@@ -30,8 +42,11 @@ private slots:
    void selectProgram();
    void selectionChanged();
    void up();
+public:
+   void handleKey(int key);
 private:
    void currentToTable(int row);
+   void currentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
    void fillContextHandler(int row, ContextHandler& handler);
    void fillTable();
    void fromTable();
index f2011d9b0179fe53a81d01b34a7d225009e8043e..170fd211146e5908d1b39bfc5a6fa76ad501de5e 100644 (file)
@@ -45,7 +45,7 @@ MainWindow::MainWindow(const QString& startDir, const QString& homeDir,
             m_lastBaseDir(),
             m_horizontalHeader(NULL),
             m_lastOrder(Qt::DescendingOrder),
-            m_homeDir(),
+            m_homeDir(homeDir),
             m_storageFile(),
             m_contextHandlers(){
    ui->setupUi(this);
diff --git a/appl/reviewer/about.ui b/appl/reviewer/about.ui
new file mode 100644 (file)
index 0000000..a6d80c5
--- /dev/null
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AboutDialog</class>
+ <widget class="QDialog" name="AboutDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>225</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>About</string>
+  </property>
+  <widget class="QTextEdit" name="textEdit">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>20</y>
+     <width>351</width>
+     <height>141</height>
+    </rect>
+   </property>
+   <property name="html">
+    <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;ReFind&lt;/span&gt; for searching files in a directory tree&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This is a program of the project &amp;quot;&lt;span style=&quot; font-weight:600;&quot;&gt;Re&lt;/span&gt;al &lt;span style=&quot; font-weight:600;&quot;&gt;Pub&lt;/span&gt;lic &lt;span style=&quot; font-weight:600;&quot;&gt;Lib&lt;/span&gt;rary&amp;quot;.&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Sources are public domain and available under https://github.com/republib&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Implemented in QT (C++) 5.x&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>280</x>
+     <y>180</y>
+     <width>93</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&amp;OK</string>
+   </property>
+  </widget>
+  <action name="action_OK">
+   <property name="text">
+    <string>&amp;OK</string>
+   </property>
+  </action>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>action_OK</sender>
+   <signal>triggered()</signal>
+   <receiver>AboutDialog</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>112</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/appl/reviewer/aboutdialog.cpp b/appl/reviewer/aboutdialog.cpp
new file mode 100644 (file)
index 0000000..43a6eb5
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Licence:
+ * You can use and modify this file without any restriction.
+ * There is no warranty.
+ * You also can use the licence from http://www.wtfpl.net/.
+ * The original sources can be found on https://github.com/republib.
+ */
+
+#include "aboutdialog.hpp"
+#include "ui_aboutdialog.h"
+
+AboutDialog::AboutDialog(QWidget *parent) :
+         QDialog(parent), ui(new Ui::AboutDialog){
+   ui->setupUi(this);
+}
+
+AboutDialog::~AboutDialog(){
+   delete ui;
+}
diff --git a/appl/reviewer/aboutdialog.hpp b/appl/reviewer/aboutdialog.hpp
new file mode 100644 (file)
index 0000000..b15b499
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Licence:
+ * You can use and modify this file without any restriction.
+ * There is no warranty.
+ * You also can use the licence from http://www.wtfpl.net/.
+ * The original sources can be found on https://github.com/republib.
+ */
+
+#ifndef ABOUTDIALOG_HPP
+#define ABOUTDIALOG_HPP
+
+#include <QDialog>
+
+namespace Ui {
+class AboutDialog;
+}
+
+class AboutDialog: public QDialog {
+   Q_OBJECT
+
+public:
+   explicit AboutDialog(QWidget *parent = 0);
+   ~AboutDialog();
+
+private:
+   Ui::AboutDialog *ui;
+};
+
+#endif // ABOUTDIALOG_HPP
diff --git a/appl/reviewer/aboutdialog.ui b/appl/reviewer/aboutdialog.ui
new file mode 100644 (file)
index 0000000..b5d0c1d
--- /dev/null
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AboutDialog</class>
+ <widget class="QDialog" name="AboutDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>423</width>
+    <height>289</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <property name="modal">
+   <bool>true</bool>
+  </property>
+  <widget class="QTextEdit" name="textEdit">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>20</y>
+     <width>381</width>
+     <height>221</height>
+    </rect>
+   </property>
+   <property name="readOnly">
+    <bool>true</bool>
+   </property>
+   <property name="html">
+    <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;ReFind&lt;/span&gt; for searching files in a directory tree.&lt;/p&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This is a program of the project&lt;/p&gt;
+&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Re&lt;/span&gt;al &lt;span style=&quot; font-weight:600;&quot;&gt;Pub&lt;/span&gt;lic &lt;span style=&quot; font-weight:600;&quot;&gt;Lib&lt;/span&gt;rary (RePubLib)&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Sources are public domain and available under&lt;/p&gt;
+&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;https://github.com/republib&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/republib&lt;/span&gt;&lt;/a&gt; &lt;/p&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Implemented in QT (C++) 5.x&lt;/p&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Icons: Mark James, &lt;a href=&quot;http://famfamfam.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://famfamfam.com&lt;/span&gt;&lt;/a&gt; &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+   </property>
+   <property name="acceptRichText">
+    <bool>false</bool>
+   </property>
+   <property name="textInteractionFlags">
+    <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButtonOK">
+   <property name="geometry">
+    <rect>
+     <x>310</x>
+     <y>250</y>
+     <width>93</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>&amp;OK</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>pushButtonOK</sender>
+   <signal>clicked()</signal>
+   <receiver>AboutDialog</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>196</x>
+     <y>183</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>108</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/appl/reviewer/main.cpp b/appl/reviewer/main.cpp
new file mode 100644 (file)
index 0000000..d6cf1aa
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * main.cpp
+ *
+ * License: Public Domain
+ * You can use and modify this file without any restriction.
+ * Do what you want.
+ * No warranties and disclaimer of any damages.
+ * You also can use this license: http://www.wtfpl.net
+ * The latest sources: https://github.com/republib
+ */
+
+#include <QApplication>
+#include "base/rebase.hpp"
+#include "gui/regui.hpp"
+#include "mainwindow.hpp"
+
+int main(int argc, char *argv[]){
+   QApplication app(argc, argv);
+   QString file = argc > 1 ? argv[1] : "";
+   MainWindow w(file);
+
+   QObject::connect(&app, SIGNAL(aboutToQuit()), &w, SLOT(closing()));
+
+   w.show();
+
+   return app.exec();
+}
diff --git a/appl/reviewer/mainwindow.cpp b/appl/reviewer/mainwindow.cpp
new file mode 100644 (file)
index 0000000..cca307d
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * mainwindow.cpp
+ *
+ * License: Public Domain
+ * You can use and modify this file without any restriction.
+ * Do what you want.
+ * No warranties and disclaimer of any damages.
+ * You also can use this license: http://www.wtfpl.net
+ * The latest sources: https://github.com/republib
+ */
+
+#include "base/rebase.hpp"
+#include "gui/regui.hpp"
+#include "mainwindow.hpp"
+#include "ui_mainwindow.h"
+#include "aboutdialog.hpp"
+#include <QDir>
+#include <QFileDialog>
+#include <QClipboard>
+#include <QLineEdit>
+#include <QMouseEvent>
+#include <QDrag>
+#include <QMimeData>
+#include <QProcess>
+#include <QMessageBox>
+
+/**
+ * @brief Constructor.
+ *
+ * @param parent    NULL or the parent widget
+ */
+MainWindow::MainWindow(const QString& file,
+   QWidget *parent) :
+            QMainWindow(parent),
+            ui(new Ui::MainWindow),
+            m_statusMessage(NULL),
+            m_stdLabelBackgroundRole(NULL),
+            m_homeDir(),
+            m_file(file),
+            m_storageFile(){
+   ui->setupUi(this);
+   initializeHome();
+   m_statusMessage = new QLabel(tr("Welcome at reviewer"));
+   statusBar()->addWidget(m_statusMessage);
+}
+
+/**
+ * @brief Destructor.
+ */
+MainWindow::~MainWindow(){
+   delete ui;
+}
+
+/**
+ * initializeHomeializes the program home directory.
+ */
+void MainWindow::initializeHome(){
+   if (m_homeDir.isEmpty()){
+      m_homeDir = QDir::home().absoluteFilePath(".review");
+   }
+
+   QDir home(m_homeDir);
+   if (!home.exists()){
+      if (!home.mkpath(m_homeDir)){
+         m_homeDir = home.tempPath() + "/.refind";
+         home.mkpath(m_homeDir);
+      }
+   }
+   if (!m_homeDir.endsWith("/"))
+      m_homeDir += "/";
+   m_storageFile = m_homeDir + "state.conf";
+   restoreState();
+}
+
+/**
+ * Starts the about dialog.
+ */
+void MainWindow::about(){
+   AboutDialog dialog;
+   dialog.exec();
+}
+
+void MainWindow::closing(){
+   saveState();
+}
+
+
+
+
+/**
+ * Handles the push of the button "select directory".
+ */
+void MainWindow::restoreState(){
+   ReStateStorage storage(m_storageFile);
+   storage.setForm("main");
+   //storage.restore(ui->comboBoxDirectory, "comboBoxDirectory", true);
+   storage.close();
+}
+
+/**
+ * Handles the push of the button "select directory".
+ */
+void MainWindow::saveState(){
+   ReStateStorage storage(m_storageFile);
+   storage.setForm("main");
+   //storage.store(ui->comboBoxDirectory, "comboBoxDirectory");
+   storage.close();
+}
+
+
+/**
+ * Writes a text to the status line.
+ *
+ * @param error     <code>true</code>: the message is an error message
+ * @param message   the text to set
+ */
+void MainWindow::setStatusMessage(bool error, const QString& message){
+   if (m_stdLabelBackgroundRole == NULL)
+      m_stdLabelBackgroundRole = new QPalette::ColorRole(
+         m_statusMessage->backgroundRole());
+   m_statusMessage->setBackgroundRole(
+      error ? QPalette::HighlightedText : *m_stdLabelBackgroundRole);
+   m_statusMessage->setText(message);
+}
+
diff --git a/appl/reviewer/mainwindow.hpp b/appl/reviewer/mainwindow.hpp
new file mode 100644 (file)
index 0000000..00c3fc8
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * mainwindow.hpp
+ *
+ * License: Public Domain
+ * You can use and modify this file without any restriction.
+ * Do what you want.
+ * No warranties and disclaimer of any damages.
+ * You also can use this license: http://www.wtfpl.net
+ * The latest sources: https://github.com/republib
+ */
+
+#ifndef MAINWINDOW_HPP
+#define MAINWINDOW_HPP
+#ifndef REBASE_HPP
+#include "base/rebase.hpp"
+#endif
+#include <QHeaderView>
+#include <QMainWindow>
+#include <QComboBox>
+#include <QLabel>
+#include <QDir>
+#if ! defined GUI_REGUI_HPP_
+#include "gui/regui.hpp"
+#endif
+namespace Ui {
+class MainWindow;
+}
+enum TableColumns {
+   TC_NODE, TC_EXT, TC_SIZE, TC_MODIFIED, TC_TYPE, TC_PATH
+};
+
+class MainWindow: public QMainWindow, public ReGuiValidator {
+
+   Q_OBJECT
+
+public:
+   explicit MainWindow(const QString& file, QWidget *parent = 0);
+   ~MainWindow();
+
+private slots:
+   void about();
+   void closing();
+   void saveState();
+
+private:
+   void initializeHome();
+   void restoreState();
+   virtual void setStatusMessage(bool error, const QString& message);
+private:
+   Ui::MainWindow *ui;
+   QLabel* m_statusMessage;
+   QPalette::ColorRole* m_stdLabelBackgroundRole;
+   QString m_homeDir;
+   QString m_file;
+   QString m_storageFile;
+};
+
+#endif // MAINWINDOW_HPP
diff --git a/appl/reviewer/mainwindow.ui b/appl/reviewer/mainwindow.ui
new file mode 100644 (file)
index 0000000..20bd40f
--- /dev/null
@@ -0,0 +1,411 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1030</width>
+    <height>579</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>RePubLib File Finder</string>
+  </property>
+  <widget class="QWidget" name="centralWidget">
+   <layout class="QGridLayout" name="gridLayout_2">
+    <item row="0" column="0">
+     <widget class="QTabWidget" name="tabWidget">
+      <widget class="QWidget" name="tab">
+       <attribute name="title">
+        <string>Tab 1</string>
+       </attribute>
+       <layout class="QVBoxLayout" name="verticalLayout">
+        <item>
+         <layout class="QGridLayout" name="gridLayout">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label">
+            <property name="maximumSize">
+             <size>
+              <width>50</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Start:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QComboBox" name="comboBoxStart">
+            <property name="editable">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="2">
+           <widget class="QCheckBox" name="checkBoxRegExprStart">
+            <property name="maximumSize">
+             <size>
+              <width>100</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Reg.Expr.</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="3">
+           <widget class="QLabel" name="label_2">
+            <property name="maximumSize">
+             <size>
+              <width>50</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>End:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="4">
+           <widget class="QComboBox" name="comboBoxEnd">
+            <property name="editable">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="5">
+           <widget class="QCheckBox" name="checkBoxRegExprEnd">
+            <property name="maximumSize">
+             <size>
+              <width>100</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Reg.Expr</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_3">
+            <property name="maximumSize">
+             <size>
+              <width>50</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Show:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QComboBox" name="comboBoxVisible">
+            <property name="editable">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="2">
+           <widget class="QCheckBox" name="checkBoxRegExprVisible">
+            <property name="maximumSize">
+             <size>
+              <width>100</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Reg.Expr.</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="3">
+           <widget class="QLabel" name="label_4">
+            <property name="maximumSize">
+             <size>
+              <width>50</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Hide:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="4">
+           <widget class="QComboBox" name="comboBoxHide">
+            <property name="editable">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="5">
+           <widget class="QCheckBox" name="checkBoxRegExprHide">
+            <property name="maximumSize">
+             <size>
+              <width>100</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Reg.Expr.</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="0">
+           <widget class="QLabel" name="label_5">
+            <property name="maximumSize">
+             <size>
+              <width>50</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Mark:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1">
+           <widget class="QComboBox" name="comboBoxMark">
+            <property name="editable">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="2">
+           <widget class="QCheckBox" name="checkBoxRegExprMark">
+            <property name="maximumSize">
+             <size>
+              <width>100</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="text">
+             <string>Reg.Expr.</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="4">
+           <widget class="QPushButton" name="pushButtonSearch">
+            <property name="text">
+             <string>&amp;Suchen</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
+          <property name="spacing">
+           <number>0</number>
+          </property>
+          <item>
+           <widget class="QPlainTextEdit" name="plainTextEdit">
+            <property name="maximumSize">
+             <size>
+              <width>100</width>
+              <height>16777215</height>
+             </size>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QTextEdit" name="textEdit"/>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_2">
+          <item>
+           <widget class="QPushButton" name="pushButtonPrev">
+            <property name="text">
+             <string>&amp;Previous</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="pushButton">
+            <property name="text">
+             <string>&amp;Next</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <spacer name="horizontalSpacer">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>40</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item>
+           <widget class="QLabel" name="label_6">
+            <property name="text">
+             <string>First Line:</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QComboBox" name="comboBoxFirstLine">
+            <property name="editable">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="tab_2">
+       <attribute name="title">
+        <string>Tab 2</string>
+       </attribute>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>1030</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuFile">
+    <property name="title">
+     <string>&amp;File</string>
+    </property>
+    <addaction name="separator"/>
+    <addaction name="separator"/>
+    <addaction name="separator"/>
+    <addaction name="actionExit"/>
+    <addaction name="separator"/>
+   </widget>
+   <widget class="QMenu" name="menuHelp">
+    <property name="title">
+     <string>&amp;Help</string>
+    </property>
+    <addaction name="actionAbout"/>
+   </widget>
+   <widget class="QMenu" name="menuNavigation">
+    <property name="title">
+     <string>&amp;Navigate</string>
+    </property>
+   </widget>
+   <widget class="QMenu" name="menu_Edit">
+    <property name="title">
+     <string>&amp;Edit</string>
+    </property>
+    <addaction name="separator"/>
+    <addaction name="separator"/>
+    <addaction name="separator"/>
+   </widget>
+   <addaction name="menuFile"/>
+   <addaction name="menu_Edit"/>
+   <addaction name="menuNavigation"/>
+   <addaction name="menuHelp"/>
+  </widget>
+  <widget class="QToolBar" name="mainToolBar">
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+  </widget>
+  <widget class="QStatusBar" name="statusBar"/>
+  <widget class="QToolBar" name="toolBarNavigate">
+   <property name="windowTitle">
+    <string>toolBar</string>
+   </property>
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+  </widget>
+  <widget class="QToolBar" name="toolBarEdit">
+   <property name="windowTitle">
+    <string>toolBar_2</string>
+   </property>
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+   <addaction name="separator"/>
+   <addaction name="separator"/>
+  </widget>
+  <widget class="QToolBar" name="toolBarExit">
+   <property name="windowTitle">
+    <string>toolBar_2</string>
+   </property>
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+   <addaction name="actionExit"/>
+  </widget>
+  <action name="actionExit">
+   <property name="icon">
+    <iconset resource="reviewer.qrc">
+     <normaloff>:/main/icons/door_in.png</normaloff>:/main/icons/door_in.png</iconset>
+   </property>
+   <property name="text">
+    <string>E&amp;xit</string>
+   </property>
+   <property name="toolTip">
+    <string>Exits the program</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+X</string>
+   </property>
+  </action>
+  <action name="actionAbout">
+   <property name="text">
+    <string>&amp;About</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+Shift+A</string>
+   </property>
+  </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources>
+  <include location="reviewer.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>actionExit</sender>
+   <signal>triggered()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>566</x>
+     <y>289</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/appl/reviewer/reviewer.pro b/appl/reviewer/reviewer.pro
new file mode 100644 (file)
index 0000000..bbe3336
--- /dev/null
@@ -0,0 +1,44 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2015-04-02T23:48:19
+#
+#-------------------------------------------------
+
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = refind
+TEMPLATE = app
+
+INCLUDEPATH = ../.. /usr/include/c++/4.9
+
+SOURCES += main.cpp\
+                 mainwindow.cpp \
+        ../../base/ReException.cpp \
+        ../../base/ReQStringUtil.cpp \
+        ../../base/ReLogger.cpp \
+        aboutdialog.cpp \
+        ../../gui/ReStateStorage.cpp \
+        ../../gui/ReGuiValidator.cpp \
+        ../../base/ReBigFile.cpp
+
+HEADERS  += mainwindow.hpp \
+        ../../base/rebase.hpp \
+        ../../base/ReQStringUtil.hpp \
+        ../../gui/ReStateStorage.hpp \
+        aboutdialog.hpp \
+        ../../gui/ReGuiValidator.hpp \
+        ../../gui/regui.hpp \
+        ../../base/ReBigFile.hpp
+
+
+FORMS    += mainwindow.ui \
+        aboutdialog.ui
+
+TRANSLATIONS = reviewer_de.ts
+
+CODECFORSRC = UTF-8
+
+RESOURCES += \
+        reviewer.qrc
diff --git a/appl/reviewer/reviewer.qrc b/appl/reviewer/reviewer.qrc
new file mode 100644 (file)
index 0000000..5f2890a
--- /dev/null
@@ -0,0 +1,24 @@
+<RCC>
+    <qresource prefix="/main">
+        <file>icons/bullet_go.png</file>
+        <file>icons/door_in.png</file>
+        <file>icons/layout_add.png</file>
+        <file>icons/resultset_next.png</file>
+        <file>icons/sitemap_color.png</file>
+        <file>icons/arrow_turn_left.png</file>
+        <file>icons/table.png</file>
+        <file>icons/tables.png</file>
+        <file>icons/action_go.png</file>
+        <file>icons/action_paste.png</file>
+        <file>icons/folder_find.png</file>
+        <file>icons/folder_go.png</file>
+        <file>icons/folder_magnify.png</file>
+        <file>icons/folder.png</file>
+        <file>icons/wand.png</file>
+        <file>icons/cog_edit.png</file>
+        <file>icons/database_save.png</file>
+        <file>icons/disk.png</file>
+        <file>icons/wrench.png</file>
+        <file>icons/eye.png</file>
+    </qresource>
+</RCC>
index ee567314daf9f3d4d4d805cb5055a3b744a49990..9b9551da26aefaf0f756308e300b7b68eef19d4a 100644 (file)
@@ -97,16 +97,17 @@ bool ReFile::findLine(const char* toFind, bool ignoreCase, int& lineNo,
       const char* ptr = start;
       int restLength = length - sourceLength + 1;
       while (restLength > 0
-         && (ptr =
-                  ignoreCase ?
+         && (ptr = reinterpret_cast<const char*>(ignoreCase ?
                      memchr(start, first, restLength) :
-                     memichr(start, cc, restLength)) != NULL){
+                     memichr(start, first, restLength))) != NULL){
          if ((ignoreCase ?
             memicmp(ptr, toFind, sourceLength) :
             memcmp(ptr, toFind, sourceLength)) == 0){
             rc = true;
             lineNo = m_lineNo;
-            line = QString::fromUtf8(QByteBuffer(m_startOfLine, m_lineLength));
+            QByteArray buffer(m_startOfLine, m_lineLength);
+            if (line == NULL)
+                *line = QString::fromUtf8(buffer);
             break;
          }
          restLength = length - (ptr - start) - sourceLength + 1;
@@ -121,17 +122,19 @@ bool ReFile::findLine(const char* toFind, bool ignoreCase, int& lineNo,
  * @param includePattern    "" or the pattern matching the result
  * @param includeIsRegExpr  true: the pattern is a regular expression<br>
  *                          false: the pattern is a string without meta chars
+ * @param includeIgnoreCase true: includePattern is case insensitive
  * @param excludePattern    "" or the pattern wich must not match the result
  * @param excludeIsRegExpr  true: the exclude pattern is a regular expression<br>
  *                          false: the pattern is a string without meta chars
-
+ * @param excludeIgnoreCase true: excludePattern is case insensitive
  * @param lineNo            OUT: 0 or the line number
  * @param line              OUT: "" or the found line
  * @return                  true: a line has been found<br>
  *                          false: a line has not been found
  */
 bool ReFile::findLine(const QString& includePattern, bool includeIsRegExpr,
-   const QString& excludePattern, bool excludeIsRegExpr, int& lineNo,
+   bool includeIgnoreCase, const QString& excludePattern,
+   bool excludeIsRegExpr, bool includeIgnoreCase, int& lineNo,
    QString* line){
    line = "";
    lineNo = 0;