]> gitweb.hamatoma.de Git - reqt/commitdiff
Option dialog, context menu
authorhama <hama@siduction.net>
Sun, 3 May 2015 21:52:10 +0000 (23:52 +0200)
committerhama <hama@siduction.net>
Sun, 3 May 2015 21:52:10 +0000 (23:52 +0200)
23 files changed:
appl/refind/dialogfileplaceholder.ui
appl/refind/dialogglobalplaceholder.ui
appl/refind/dialogoptions.cpp [new file with mode: 0644]
appl/refind/dialogoptions.hpp [new file with mode: 0644]
appl/refind/dialogoptions.ui [new file with mode: 0644]
appl/refind/filefinder.cpp
appl/refind/icons/eye.png [new file with mode: 0644]
appl/refind/icons/paste_plain.png [new file with mode: 0644]
appl/refind/icons/wrench.png [new file with mode: 0644]
appl/refind/main.cpp
appl/refind/mainwindow.cpp
appl/refind/mainwindow.hpp
appl/refind/mainwindow.ui
appl/refind/refind.pro
appl/refind/refind.qrc
appl/refind/textfinder.cpp
appl/refind/utils.cpp [new file with mode: 0644]
appl/refind/utils.hpp [new file with mode: 0644]
base/ReQStringUtil.cpp
base/ReQStringUtil.hpp
base/rebase.hpp
gui/ReStateStorage.cpp
gui/ReStateStorage.hpp

index 2b3dde14fc43c4b1df16e39fdc11c908afdc2149..f274a2aca220b9a316fe47fa377215c2e6f3308b 100644 (file)
   <property name="modal">
    <bool>true</bool>
   </property>
-  <widget class="QDialogButtonBox" name="buttonBox">
-   <property name="geometry">
-    <rect>
-     <x>440</x>
-     <y>380</y>
-     <width>341</width>
-     <height>32</height>
-    </rect>
-   </property>
-   <property name="orientation">
-    <enum>Qt::Horizontal</enum>
-   </property>
-   <property name="standardButtons">
-    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-   </property>
-  </widget>
-  <widget class="QTableWidget" name="tableWidget">
-   <property name="geometry">
-    <rect>
-     <x>20</x>
-     <y>20</y>
-     <width>761</width>
-     <height>351</height>
-    </rect>
-   </property>
-   <attribute name="horizontalHeaderDefaultSectionSize">
-    <number>190</number>
-   </attribute>
-   <attribute name="horizontalHeaderStretchLastSection">
-    <bool>true</bool>
-   </attribute>
-   <attribute name="verticalHeaderVisible">
-    <bool>false</bool>
-   </attribute>
-   <attribute name="verticalHeaderStretchLastSection">
-    <bool>true</bool>
-   </attribute>
-   <row>
-    <property name="text">
-     <string notr="true">New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <column>
-    <property name="text">
-     <string>Placeholder</string>
-    </property>
-   </column>
-   <column>
-    <property name="text">
-     <string>Example</string>
-    </property>
-   </column>
-   <column>
-    <property name="text">
-     <string>Description</string>
-    </property>
-   </column>
-   <item row="0" column="0">
-    <property name="text">
-     <string notr="true">${base}</string>
-    </property>
-   </item>
-   <item row="0" column="1">
-    <property name="text">
-     <string notr="true">/home/bob</string>
-    </property>
-   </item>
-   <item row="0" column="2">
-    <property name="text">
-     <string>base directory</string>
-    </property>
-   </item>
-   <item row="1" column="0">
-    <property name="text">
-     <string notr="true">${full}</string>
-    </property>
-   </item>
-   <item row="1" column="1">
-    <property name="text">
-     <string notr="true">/home/bob/doc/intro.txt</string>
-    </property>
-   </item>
-   <item row="1" column="2">
-    <property name="text">
-     <string>filename with absolute path</string>
-    </property>
-   </item>
-   <item row="2" column="0">
-    <property name="text">
-     <string notr="true">${path}</string>
-    </property>
-   </item>
-   <item row="2" column="1">
-    <property name="text">
-     <string notr="true">doc</string>
-    </property>
-   </item>
-   <item row="2" column="2">
-    <property name="text">
-     <string>relative path</string>
-    </property>
-   </item>
-   <item row="3" column="0">
-    <property name="text">
-     <string notr="true">${node}</string>
-    </property>
-   </item>
-   <item row="3" column="1">
-    <property name="text">
-     <string notr="true">intro.txt</string>
-    </property>
-   </item>
-   <item row="3" column="2">
-    <property name="text">
-     <string>filename with extension</string>
-    </property>
-   </item>
-   <item row="4" column="0">
-    <property name="text">
-     <string notr="true">${name}</string>
-    </property>
-   </item>
-   <item row="4" column="1">
-    <property name="text">
-     <string notr="true">intro</string>
-    </property>
-   </item>
-   <item row="4" column="2">
-    <property name="text">
-     <string>filename without extension</string>
-    </property>
-   </item>
-   <item row="5" column="0">
-    <property name="text">
-     <string notr="true">${ext}</string>
-    </property>
-   </item>
-   <item row="5" column="1">
-    <property name="text">
-     <string notr="true">.txt</string>
-    </property>
-   </item>
-   <item row="5" column="2">
-    <property name="text">
-     <string>extension</string>
-    </property>
-   </item>
-   <item row="6" column="0">
-    <property name="text">
-     <string notr="true">${modified}</string>
-    </property>
-   </item>
-   <item row="6" column="1">
-    <property name="text">
-     <string notr="true">2015.04.03/08:07:14</string>
-    </property>
-   </item>
-   <item row="6" column="2">
-    <property name="text">
-     <string>date/time of the last change</string>
-    </property>
-   </item>
-   <item row="7" column="0">
-    <property name="text">
-     <string notr="true">${size}</string>
-    </property>
-   </item>
-   <item row="7" column="1">
-    <property name="text">
-     <string notr="true">0.001223</string>
-    </property>
-   </item>
-   <item row="7" column="2">
-    <property name="text">
-     <string>file length in megabyte</string>
-    </property>
-   </item>
-   <item row="8" column="0">
-    <property name="text">
-     <string notr="true">${type}</string>
-    </property>
-   </item>
-   <item row="8" column="1">
-    <property name="text">
-     <string notr="true">file</string>
-    </property>
-   </item>
-   <item row="8" column="2">
-    <property name="text">
-     <string>'file', 'dir', 'link (file)', 'link (dir)'</string>
-    </property>
-   </item>
-   <item row="9" column="0">
-    <property name="text">
-     <string notr="true">\t</string>
-    </property>
-   </item>
-   <item row="9" column="1">
-    <property name="text">
-     <string notr="true">\t</string>
-    </property>
-   </item>
-   <item row="9" column="2">
-    <property name="text">
-     <string>tabulator</string>
-    </property>
-   </item>
-   <item row="10" column="0">
-    <property name="text">
-     <string notr="true">\n</string>
-    </property>
-   </item>
-   <item row="10" column="1">
-    <property name="text">
-     <string notr="true">\n</string>
-    </property>
-   </item>
-   <item row="10" column="2">
-    <property name="text">
-     <string>newline</string>
-    </property>
-   </item>
-  </widget>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QTableWidget" name="tableWidget">
+     <attribute name="horizontalHeaderDefaultSectionSize">
+      <number>190</number>
+     </attribute>
+     <attribute name="horizontalHeaderStretchLastSection">
+      <bool>true</bool>
+     </attribute>
+     <attribute name="verticalHeaderVisible">
+      <bool>false</bool>
+     </attribute>
+     <attribute name="verticalHeaderStretchLastSection">
+      <bool>true</bool>
+     </attribute>
+     <row>
+      <property name="text">
+       <string notr="true">New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <column>
+      <property name="text">
+       <string>Placeholder</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Example</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Description</string>
+      </property>
+     </column>
+     <item row="0" column="0">
+      <property name="text">
+       <string notr="true">${base}</string>
+      </property>
+     </item>
+     <item row="0" column="1">
+      <property name="text">
+       <string notr="true">/home/bob</string>
+      </property>
+     </item>
+     <item row="0" column="2">
+      <property name="text">
+       <string>base directory</string>
+      </property>
+     </item>
+     <item row="1" column="0">
+      <property name="text">
+       <string notr="true">${full}</string>
+      </property>
+     </item>
+     <item row="1" column="1">
+      <property name="text">
+       <string notr="true">/home/bob/doc/intro.txt</string>
+      </property>
+     </item>
+     <item row="1" column="2">
+      <property name="text">
+       <string>filename with absolute path</string>
+      </property>
+     </item>
+     <item row="2" column="0">
+      <property name="text">
+       <string notr="true">${path}</string>
+      </property>
+     </item>
+     <item row="2" column="1">
+      <property name="text">
+       <string notr="true">doc</string>
+      </property>
+     </item>
+     <item row="2" column="2">
+      <property name="text">
+       <string>relative path</string>
+      </property>
+     </item>
+     <item row="3" column="0">
+      <property name="text">
+       <string notr="true">${node}</string>
+      </property>
+     </item>
+     <item row="3" column="1">
+      <property name="text">
+       <string notr="true">intro.txt</string>
+      </property>
+     </item>
+     <item row="3" column="2">
+      <property name="text">
+       <string>filename with extension</string>
+      </property>
+     </item>
+     <item row="4" column="0">
+      <property name="text">
+       <string notr="true">${name}</string>
+      </property>
+     </item>
+     <item row="4" column="1">
+      <property name="text">
+       <string notr="true">intro</string>
+      </property>
+     </item>
+     <item row="4" column="2">
+      <property name="text">
+       <string>filename without extension</string>
+      </property>
+     </item>
+     <item row="5" column="0">
+      <property name="text">
+       <string notr="true">${ext}</string>
+      </property>
+     </item>
+     <item row="5" column="1">
+      <property name="text">
+       <string notr="true">.txt</string>
+      </property>
+     </item>
+     <item row="5" column="2">
+      <property name="text">
+       <string>extension</string>
+      </property>
+     </item>
+     <item row="6" column="0">
+      <property name="text">
+       <string notr="true">${modified}</string>
+      </property>
+     </item>
+     <item row="6" column="1">
+      <property name="text">
+       <string notr="true">2015.04.03/08:07:14</string>
+      </property>
+     </item>
+     <item row="6" column="2">
+      <property name="text">
+       <string>date/time of the last change</string>
+      </property>
+     </item>
+     <item row="7" column="0">
+      <property name="text">
+       <string notr="true">${size}</string>
+      </property>
+     </item>
+     <item row="7" column="1">
+      <property name="text">
+       <string notr="true">0.001223</string>
+      </property>
+     </item>
+     <item row="7" column="2">
+      <property name="text">
+       <string>file length in megabyte</string>
+      </property>
+     </item>
+     <item row="8" column="0">
+      <property name="text">
+       <string notr="true">${type}</string>
+      </property>
+     </item>
+     <item row="8" column="1">
+      <property name="text">
+       <string notr="true">file</string>
+      </property>
+     </item>
+     <item row="8" column="2">
+      <property name="text">
+       <string>'file', 'dir', 'link (file)', 'link (dir)'</string>
+      </property>
+     </item>
+     <item row="9" column="0">
+      <property name="text">
+       <string notr="true">\t</string>
+      </property>
+     </item>
+     <item row="9" column="1">
+      <property name="text">
+       <string notr="true">\t</string>
+      </property>
+     </item>
+     <item row="9" column="2">
+      <property name="text">
+       <string>tabulator</string>
+      </property>
+     </item>
+     <item row="10" column="0">
+      <property name="text">
+       <string notr="true">\n</string>
+      </property>
+     </item>
+     <item row="10" column="1">
+      <property name="text">
+       <string notr="true">\n</string>
+      </property>
+     </item>
+     <item row="10" column="2">
+      <property name="text">
+       <string>newline</string>
+      </property>
+     </item>
+    </widget>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
  </widget>
  <resources/>
  <connections>
index 070d4d185256341267acbb216ae7d6b0bfa4b996..a8bab09d5e4fed21835ef9a7615c82c54c021e54 100644 (file)
   <property name="modal">
    <bool>true</bool>
   </property>
-  <widget class="QDialogButtonBox" name="buttonBox">
-   <property name="geometry">
-    <rect>
-     <x>220</x>
-     <y>420</y>
-     <width>341</width>
-     <height>32</height>
-    </rect>
-   </property>
-   <property name="orientation">
-    <enum>Qt::Horizontal</enum>
-   </property>
-   <property name="standardButtons">
-    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-   </property>
-  </widget>
-  <widget class="QTableWidget" name="tableWidget">
-   <property name="geometry">
-    <rect>
-     <x>20</x>
-     <y>20</y>
-     <width>541</width>
-     <height>391</height>
-    </rect>
-   </property>
-   <attribute name="horizontalHeaderDefaultSectionSize">
-    <number>150</number>
-   </attribute>
-   <attribute name="horizontalHeaderStretchLastSection">
-    <bool>true</bool>
-   </attribute>
-   <attribute name="verticalHeaderVisible">
-    <bool>false</bool>
-   </attribute>
-   <attribute name="verticalHeaderStretchLastSection">
-    <bool>true</bool>
-   </attribute>
-   <row>
-    <property name="text">
-     <string notr="true">New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <row>
-    <property name="text">
-     <string>New Row</string>
-    </property>
-   </row>
-   <column>
-    <property name="text">
-     <string>Placeholder</string>
-    </property>
-   </column>
-   <column>
-    <property name="text">
-     <string>Description</string>
-    </property>
-   </column>
-   <item row="0" column="0">
-    <property name="text">
-     <string notr="true">${datetime}</string>
-    </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QTableWidget" name="tableWidget">
+     <attribute name="horizontalHeaderDefaultSectionSize">
+      <number>150</number>
+     </attribute>
+     <attribute name="horizontalHeaderStretchLastSection">
+      <bool>true</bool>
+     </attribute>
+     <attribute name="verticalHeaderVisible">
+      <bool>false</bool>
+     </attribute>
+     <attribute name="verticalHeaderStretchLastSection">
+      <bool>true</bool>
+     </attribute>
+     <row>
+      <property name="text">
+       <string notr="true">New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <row>
+      <property name="text">
+       <string>New Row</string>
+      </property>
+     </row>
+     <column>
+      <property name="text">
+       <string>Placeholder</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
+       <string>Description</string>
+      </property>
+     </column>
+     <item row="0" column="0">
+      <property name="text">
+       <string notr="true">${datetime}</string>
+      </property>
+     </item>
+     <item row="0" column="1">
+      <property name="text">
+       <string>current date/time</string>
+      </property>
+     </item>
+     <item row="1" column="0">
+      <property name="text">
+       <string notr="true">${filepatterns}</string>
+      </property>
+     </item>
+     <item row="1" column="1">
+      <property name="text">
+       <string>current file patterns</string>
+      </property>
+     </item>
+     <item row="2" column="0">
+      <property name="text">
+       <string notr="true">${textpattern}</string>
+      </property>
+     </item>
+     <item row="2" column="1">
+      <property name="text">
+       <string>current text pattern</string>
+      </property>
+     </item>
+     <item row="3" column="0">
+      <property name="text">
+       <string notr="true">${dirs}</string>
+      </property>
+     </item>
+     <item row="3" column="1">
+      <property name="text">
+       <string>count of found directories</string>
+      </property>
+     </item>
+     <item row="4" column="0">
+      <property name="text">
+       <string notr="true">${files}</string>
+      </property>
+     </item>
+     <item row="4" column="1">
+      <property name="text">
+       <string>count of found files</string>
+      </property>
+     </item>
+     <item row="5" column="0">
+      <property name="text">
+       <string notr="true">${bytes}</string>
+      </property>
+     </item>
+     <item row="5" column="1">
+      <property name="text">
+       <string>sum of the lengths of the found files</string>
+      </property>
+     </item>
+     <item row="6" column="0">
+      <property name="text">
+       <string notr="true">${megabytes}</string>
+      </property>
+     </item>
+     <item row="6" column="1">
+      <property name="text">
+       <string>sum of the lengths of the found files in MBytes</string>
+      </property>
+     </item>
+     <item row="7" column="0">
+      <property name="text">
+       <string notr="true">${runtime}</string>
+      </property>
+     </item>
+     <item row="7" column="1">
+      <property name="text">
+       <string>runtime of the search in seconds</string>
+      </property>
+     </item>
+     <item row="8" column="0">
+      <property name="text">
+       <string notr="true">\n</string>
+      </property>
+     </item>
+     <item row="8" column="1">
+      <property name="text">
+       <string>newline (line feed)</string>
+      </property>
+     </item>
+     <item row="9" column="0">
+      <property name="text">
+       <string notr="true">\r</string>
+      </property>
+     </item>
+     <item row="9" column="1">
+      <property name="text">
+       <string>newline character (carriage return)</string>
+      </property>
+     </item>
+     <item row="10" column="0">
+      <property name="text">
+       <string notr="true">\t</string>
+      </property>
+     </item>
+     <item row="10" column="1">
+      <property name="text">
+       <string>tabulator</string>
+      </property>
+     </item>
+     <item row="11" column="0">
+      <property name="text">
+       <string notr="true">\\</string>
+      </property>
+     </item>
+     <item row="11" column="1">
+      <property name="text">
+       <string>backslash</string>
+      </property>
+     </item>
+    </widget>
    </item>
-   <item row="0" column="1">
-    <property name="text">
-     <string>current date/time</string>
-    </property>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
    </item>
-   <item row="1" column="0">
-    <property name="text">
-     <string notr="true">${filepatterns}</string>
-    </property>
-   </item>
-   <item row="1" column="1">
-    <property name="text">
-     <string>current file patterns</string>
-    </property>
-   </item>
-   <item row="2" column="0">
-    <property name="text">
-     <string notr="true">${textpattern}</string>
-    </property>
-   </item>
-   <item row="2" column="1">
-    <property name="text">
-     <string>current text pattern</string>
-    </property>
-   </item>
-   <item row="3" column="0">
-    <property name="text">
-     <string notr="true">${dirs}</string>
-    </property>
-   </item>
-   <item row="3" column="1">
-    <property name="text">
-     <string>count of found directories</string>
-    </property>
-   </item>
-   <item row="4" column="0">
-    <property name="text">
-     <string notr="true">${files}</string>
-    </property>
-   </item>
-   <item row="4" column="1">
-    <property name="text">
-     <string>count of found files</string>
-    </property>
-   </item>
-   <item row="5" column="0">
-    <property name="text">
-     <string notr="true">${bytes}</string>
-    </property>
-   </item>
-   <item row="5" column="1">
-    <property name="text">
-     <string>sum of the lengths of the found files</string>
-    </property>
-   </item>
-   <item row="6" column="0">
-    <property name="text">
-     <string notr="true">${megabytes}</string>
-    </property>
-   </item>
-   <item row="6" column="1">
-    <property name="text">
-     <string>sum of the lengths of the found files in MBytes</string>
-    </property>
-   </item>
-   <item row="7" column="0">
-    <property name="text">
-     <string notr="true">${runtime}</string>
-    </property>
-   </item>
-   <item row="7" column="1">
-    <property name="text">
-     <string>runtime of the search in seconds</string>
-    </property>
-   </item>
-   <item row="8" column="0">
-    <property name="text">
-     <string notr="true">\n</string>
-    </property>
-   </item>
-   <item row="8" column="1">
-    <property name="text">
-     <string>newline (line feed)</string>
-    </property>
-   </item>
-   <item row="9" column="0">
-    <property name="text">
-     <string notr="true">\r</string>
-    </property>
-   </item>
-   <item row="9" column="1">
-    <property name="text">
-     <string>newline character (carriage return)</string>
-    </property>
-   </item>
-   <item row="10" column="0">
-    <property name="text">
-     <string notr="true">\t</string>
-    </property>
-   </item>
-   <item row="10" column="1">
-    <property name="text">
-     <string>tabulator</string>
-    </property>
-   </item>
-   <item row="11" column="0">
-    <property name="text">
-     <string notr="true">\\</string>
-    </property>
-   </item>
-   <item row="11" column="1">
-    <property name="text">
-     <string>backslash</string>
-    </property>
-   </item>
-  </widget>
+  </layout>
  </widget>
  <resources/>
  <connections>
diff --git a/appl/refind/dialogoptions.cpp b/appl/refind/dialogoptions.cpp
new file mode 100644 (file)
index 0000000..b4bc9e3
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * 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 "dialogoptions.hpp"
+#include "ui_dialogoptions.h"
+
+DialogOptions::DialogOptions(ContextHandlerList& handlers, QWidget *parent) :
+         QDialog(parent), ui(new Ui::DialogOptions), m_contextHandlers(handlers){
+   ui->setupUi(this);
+   fillTable();
+}
+
+DialogOptions::~DialogOptions(){
+   delete ui;
+}
+/**
+ * Fills the table with the data from the list.
+ */
+void DialogOptions::fillTable(){
+   int count = m_contextHandlers.list().size();
+   ui->tableWidget->setRowCount(count);
+   QString value;
+   QList < QString > dirMode;
+   for (int row = 0; row < count; row++){
+      ContextHandler* handler = m_contextHandlers.list().at(row);
+      ui->tableWidget->setItem(row, COL_TITLE,
+         new QTableWidgetItem(handler->m_text));
+      ui->tableWidget->setItem(row, COL_PROGRAM,
+         new QTableWidgetItem(handler->m_program));
+      ui->tableWidget->setItem(row, COL_ARGUMENTS,
+         new QTableWidgetItem(handler->m_arguments));
+      value = ui->comboBoxFileType->itemText(handler->m_fileType - 1);
+      ui->tableWidget->setItem(row, COL_FILE_TYPE, new QTableWidgetItem(value));
+      value = ui->comboBoxCurrentDirectory->itemText(
+         handler->m_directoryMode - 1);
+      ui->tableWidget->setItem(row, COL_CURRENT_DIR,
+         new QTableWidgetItem(value));
+   }
+}
+
+/**
+ * Fills the list from the data of the table.
+ */
+void DialogOptions::fromTable(){
+   m_contextHandlers.clear();
+   QList < QString > fileTypes;
+   for (int ix = 0; ix < ui->comboBoxFileType->count(); ix++)
+      fileTypes.append(ui->comboBoxFileType->itemText(ix));
+   for (int ix = 0; ix < ui->comboBoxCurrentDirectory->count(); ix++)
+      fileTypes.append(ui->comboBoxCurrentDirectory->itemText(ix));
+   for (int row = 0; row < ui->tableWidget->rowCount(); row++){
+      ContextHandler* handler = new ContextHandler;
+      handler->m_text = ui->tableWidget->item(row, COL_TITLE)->text();
+      handler->m_program = ui->tableWidget->item(row, COL_PROGRAM)->text();
+      handler->m_arguments = ui->tableWidget->item(row, COL_ARGUMENTS)->text();
+      handler->m_fileType = ContextHandler::FileType(
+         1
+            + fileTypes.indexOf(
+               ui->comboBoxFileType->itemText(row, COL_FILE_TYPE)->text()));
+      handler->m_directoryMode = ContextHandler::DirMode(
+         1
+            + fileTypes.indexOf(
+               ui->comboBoxCurrentDirectory->itemText(row, COL_CURRENT_DIR)));
+      m_contextHandlers.list().append(handler);
+   }
+}
+
diff --git a/appl/refind/dialogoptions.hpp b/appl/refind/dialogoptions.hpp
new file mode 100644 (file)
index 0000000..8cd0d46
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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 DIALOGOPTIONS_HPP
+#define DIALOGOPTIONS_HPP
+#include "utils.hpp"
+#include <QDialog>
+
+namespace Ui {
+class DialogOptions;
+}
+
+class DialogOptions: public QDialog {
+   Q_OBJECT
+
+public:
+   explicit DialogOptions(ContextHandlerList& handlers, QWidget *parent = 0);
+   ~DialogOptions();
+private:
+   void fillTable();
+   void fromTable();
+private:
+   Ui::DialogOptions *ui;
+   ContextHandlerList& m_contextHandlers;
+};
+
+#endif // DIALOGOPTIONS_HPP
diff --git a/appl/refind/dialogoptions.ui b/appl/refind/dialogoptions.ui
new file mode 100644 (file)
index 0000000..66e6dce
--- /dev/null
@@ -0,0 +1,410 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogOptions</class>
+ <widget class="QDialog" name="DialogOptions">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>944</width>
+    <height>591</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <widget class="QTabWidget" name="tabWidget">
+     <property name="currentIndex">
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="tab">
+      <attribute name="title">
+       <string>Programs (Context Menu)</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QTableWidget" name="tableWidget">
+         <property name="minimumSize">
+          <size>
+           <width>850</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="editTriggers">
+          <set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::EditKeyPressed</set>
+         </property>
+         <property name="alternatingRowColors">
+          <bool>false</bool>
+         </property>
+         <property name="selectionMode">
+          <enum>QAbstractItemView::SingleSelection</enum>
+         </property>
+         <property name="selectionBehavior">
+          <enum>QAbstractItemView::SelectRows</enum>
+         </property>
+         <attribute name="horizontalHeaderDefaultSectionSize">
+          <number>175</number>
+         </attribute>
+         <attribute name="horizontalHeaderStretchLastSection">
+          <bool>true</bool>
+         </attribute>
+         <attribute name="verticalHeaderVisible">
+          <bool>false</bool>
+         </attribute>
+         <row>
+          <property name="text">
+           <string>Neue Zeile</string>
+          </property>
+         </row>
+         <row>
+          <property name="text">
+           <string>edit</string>
+          </property>
+         </row>
+         <column>
+          <property name="text">
+           <string>File Type</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>Titel (Menu)</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>Program</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>Arguments</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>Current Directory</string>
+          </property>
+         </column>
+         <item row="0" column="1">
+          <property name="text">
+           <string>Editor</string>
+          </property>
+         </item>
+         <item row="0" column="2">
+          <property name="text">
+           <string>/usr/bin/kate</string>
+          </property>
+         </item>
+         <item row="0" column="3">
+          <property name="text">
+           <string>${full}</string>
+          </property>
+         </item>
+         <item row="0" column="4">
+          <property name="text">
+           <string/>
+          </property>
+         </item>
+         <item row="1" column="1">
+          <property name="text">
+           <string>Shell</string>
+          </property>
+         </item>
+         <item row="1" column="2">
+          <property name="text">
+           <string>/usr/bin/bash</string>
+          </property>
+         </item>
+         <item row="1" column="3">
+          <property name="text">
+           <string/>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <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="QPushButton" name="pushButtonAdd">
+           <property name="text">
+            <string>&amp;Add</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButtonDel">
+           <property name="text">
+            <string>D&amp;elete</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_3">
+           <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="QPushButton" name="pushButtonUp">
+           <property name="text">
+            <string>&amp;Up</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButtonDown">
+           <property name="text">
+            <string>&amp;Down</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="groupBox">
+         <property name="title">
+          <string>Current Entry</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label">
+            <property name="text">
+             <string>File Type:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QLabel" name="label_2">
+            <property name="text">
+             <string>Title:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="2">
+           <widget class="QLabel" name="label_3">
+            <property name="text">
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Program:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="3">
+           <widget class="QLabel" name="label_4">
+            <property name="text">
+             <string>Arguments:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="4">
+           <widget class="QLabel" name="label_5">
+            <property name="text">
+             <string>Current Directory:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QComboBox" name="comboBoxFileType">
+            <property name="maximumSize">
+             <size>
+              <width>100</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <item>
+             <property name="text">
+              <string>File</string>
+             </property>
+            </item>
+            <item>
+             <property name="text">
+              <string>Directory</string>
+             </property>
+            </item>
+            <item>
+             <property name="text">
+              <string>Both</string>
+             </property>
+            </item>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QLineEdit" name="lineEditTitle">
+            <property name="maximumSize">
+             <size>
+              <width>100</width>
+              <height>16777215</height>
+             </size>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="2">
+           <layout class="QHBoxLayout" name="horizontalLayout_2">
+            <item>
+             <widget class="QComboBox" name="comboBoxProgram">
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="pushButtonSelectProgram">
+              <property name="maximumSize">
+               <size>
+                <width>50</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>...</string>
+              </property>
+              <property name="icon">
+               <iconset resource="refind.qrc">
+                <normaloff>:/main/icons/layout_add.png</normaloff>:/main/icons/layout_add.png</iconset>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="1" column="3">
+           <widget class="QComboBox" name="comboBoxArgument">
+            <property name="maximumSize">
+             <size>
+              <width>100</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="editable">
+             <bool>true</bool>
+            </property>
+            <item>
+             <property name="text">
+              <string notr="true">${full}</string>
+             </property>
+            </item>
+            <item>
+             <property name="text">
+              <string notr="true">${path}</string>
+             </property>
+            </item>
+            <item>
+             <property name="text">
+              <string notr="true">${node}</string>
+             </property>
+            </item>
+            <item>
+             <property name="text">
+              <string notr="true">${ext}</string>
+             </property>
+            </item>
+           </widget>
+          </item>
+          <item row="1" column="4">
+           <widget class="QComboBox" name="comboBoxCurrentDirectory">
+            <property name="maximumSize">
+             <size>
+              <width>150</width>
+              <height>16777215</height>
+             </size>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="tab_2">
+      <attribute name="title">
+       <string>Tab 2</string>
+      </attribute>
+     </widget>
+    </widget>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+     <property name="centerButtons">
+      <bool>false</bool>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="refind.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>DialogOptions</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>DialogOptions</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
index bc21de72f593344d76cbcddfecea2e93189a3fef..8a754b9092a60c45df0ff4de55e6e3251bcf7751 100644 (file)
@@ -9,6 +9,7 @@
 #include <QDir>
 #include "base/rebase.hpp"
 #include "gui/regui.hpp"
+#include "utils.hpp"
 #include "mainwindow.hpp"
 #include "filefinder.hpp"
 #include "textfinder.hpp"
@@ -112,7 +113,7 @@ void FileFinder::fillTable(const QString& path, int depth, QTableWidget* table,
       entries = dir.entryInfoList(m_patterns, filters, QDir::NoSort);
    QList <QFileInfo>::iterator it;
    QString relativePath = ReQStringUtil::nativePath(
-               path.mid(1 + m_baseDir.length()));
+      path.mid(1 + m_baseDir.length()));
    QString node, ext;
 
    for (it = entries.begin(); it != entries.end(); ++it){
diff --git a/appl/refind/icons/eye.png b/appl/refind/icons/eye.png
new file mode 100644 (file)
index 0000000..564a1a9
Binary files /dev/null and b/appl/refind/icons/eye.png differ
diff --git a/appl/refind/icons/paste_plain.png b/appl/refind/icons/paste_plain.png
new file mode 100644 (file)
index 0000000..c0490eb
Binary files /dev/null and b/appl/refind/icons/paste_plain.png differ
diff --git a/appl/refind/icons/wrench.png b/appl/refind/icons/wrench.png
new file mode 100644 (file)
index 0000000..5c8213f
Binary files /dev/null and b/appl/refind/icons/wrench.png differ
index d9e4218a9c1fe8dba80ac687be568a0184fda2c9..60031bd31fe830b97fec8e237ba2a79b4bbac898 100644 (file)
@@ -12,6 +12,7 @@
 #include <QApplication>
 #include "base/rebase.hpp"
 #include "gui/regui.hpp"
+#include "utils.hpp"
 #include "mainwindow.hpp"
 
 int main(int argc, char *argv[]){
index ac74665a0e8555ffa7e5ec96225b3a74514d1c2c..33fb4a80e72d3ee27325f9f4bb2a0765d2520e7b 100644 (file)
@@ -9,16 +9,9 @@
  * The latest sources: https://github.com/republib
  */
 
-#include <QDir>
-#include <QFileDialog>
-#include <QClipboard>
-#include <QLineEdit>
-#include <QMouseEvent>
-#include <QDrag>
-#include <QMimeData>
-#include <QProcess>
 #include "base/rebase.hpp"
 #include "gui/regui.hpp"
+#include "utils.hpp"
 #include "textfinder.hpp"
 #include "mainwindow.hpp"
 #include "ui_mainwindow.h"
 #include "dialogglobalplaceholder.hpp"
 #include "filefinder.hpp"
 #include "aboutdialog.hpp"
+#include "dialogoptions.hpp"
+#include <QDir>
+#include <QFileDialog>
+#include <QClipboard>
+#include <QLineEdit>
+#include <QMouseEvent>
+#include <QDrag>
+#include <QMimeData>
+#include <QProcess>
+#include <QMessageBox>
 
 /**
  * @brief Constructor.
@@ -44,8 +47,7 @@ MainWindow::MainWindow(const QString& startDir, const QString& homeDir,
             m_lastOrder(Qt::DescendingOrder),
             m_homeDir(),
             m_storageFile(),
-            m_fileHandler(),
-            m_dirHandler(){
+            m_contextHandlers(){
    ui->setupUi(this);
    initializeHome();
    m_statusMessage = new QLabel(tr("Willkommen bei refind"));
@@ -66,6 +68,7 @@ MainWindow::MainWindow(const QString& startDir, const QString& homeDir,
    connect(ui->pushButtonDirectory, SIGNAL(clicked()), this,
       SLOT(selectDirectory()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
+   connect(ui->actionOptions, SIGNAL(triggered()), this, SLOT(options()));
    connect(ui->actionGetAbsPath, SIGNAL(triggered()), this,
       SLOT(absPathToClipboard()));
    connect(ui->actionGetFullName, SIGNAL(triggered()), this,
@@ -84,6 +87,8 @@ MainWindow::MainWindow(const QString& startDir, const QString& homeDir,
       SLOT(headerPlaceholder()));
    connect(ui->pushButtonFooterPlaceholder, SIGNAL(clicked()), this,
       SLOT(footerPlaceholder()));
+   connect(ui->actionPreview, SIGNAL(triggered()), this, SLOT(preview()));
+   connect(ui->pushButtonPreview, SIGNAL(clicked()), this, SLOT(preview()));
 
    m_horizontalHeader = ui->tableWidget->horizontalHeader();
    connect(m_horizontalHeader, SIGNAL(sectionClicked ( int ) ),
@@ -93,7 +98,7 @@ MainWindow::MainWindow(const QString& startDir, const QString& homeDir,
    ui->tableWidget->setColumnWidth(TC_SIZE, 125);
    ui->tableWidget->setColumnWidth(TC_MODIFIED, 175);
    ui->tableWidget->setColumnWidth(TC_TYPE, 75);
-   addContextMenu();
+   prepareContextMenu();
 }
 
 /**
@@ -103,50 +108,24 @@ MainWindow::~MainWindow(){
    delete ui;
 }
 
-/**
- * Prepares the context menu of the result table.
- *
- */
-void MainWindow::addContextMenu(){
-    ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
-    connect(ui->tableWidget,
-            SIGNAL(customContextMenuRequested(const QPoint&)),
-            SLOT(handleTableContextMenu(const QPoint&)));
-    ContextHandler* handler = new ContextHandler();
-    handler->m_text = "kedit";
-    handler->m_program = "kedit";
-    handler->m_arguments = "${full}";
-    handler->m_changeToParentDirectory = ContextHandler::DM_UNDEF;
-    m_fileHandler.append(handler);
-    handler = new ContextHandler();
-    handler->m_text = "bash";
-    handler->m_program = "konsole";
-    handler->m_arguments = "${full}";
-    handler->m_changeToParentDirectory = ContextHandler::DM_TO_FILE;
-    m_dirHandler.append(handler);
-}
-
-=======
->>>>>>> branch 'master' of git@f-r-e-i.de:/home/git/repo/rplqt
-void MainWindow::mousePressEvent(QMouseEvent* event)
-{
-    if (event->button() == Qt::LeftButton
-        && ui->tableWidget->geometry().contains(event->pos())) {
-
-        QDrag *drag = new QDrag(this);
-        QMimeData *mimeData = new QMimeData;
-
-        mimeData->setText("test text");
-        drag->setMimeData(mimeData);
+void MainWindow::mousePressEvent(QMouseEvent* event){
+   if (event->button() == Qt::LeftButton
+      && ui->tableWidget->geometry().contains(event->pos())){
+
+      QDrag *drag = new QDrag(this);
+      QMimeData *mimeData = new QMimeData;
+
+      mimeData->setText("test text");
+      drag->setMimeData(mimeData);
 #if 0
-        const QPixmap image = iconShader.pixmap(QSize(16,16));
-        drag->drawPixmap(0, 0, 16, 16, image);
-        drag->drawText(QRect(20, 0, 170, 20), tr("copy or move") );
+      const QPixmap image = iconShader.pixmap(QSize(16,16));
+      drag->drawPixmap(0, 0, 16, 16, image);
+      drag->drawText(QRect(20, 0, 170, 20), tr("copy or move") );
 
-        drag->setPixmap(iconPixmap);
+      drag->setPixmap(iconPixmap);
 #endif
-        Qt::DropAction dropAction = drag->exec();
-    }
+      Qt::DropAction dropAction = drag->exec();
+   }
 }
 /**
  * initializeHomeializes the program home directory.
@@ -170,30 +149,18 @@ void MainWindow::initializeHome(){
 }
 
 /**
- * Handles the event "header column clicked".
- *
- * @param col   the col
+ * Starts the about dialog.
  */
-void MainWindow::headerClicked(int col){
-   m_lastOrder =
-            m_lastOrder == Qt::AscendingOrder ?
-               Qt::DescendingOrder : Qt::AscendingOrder;
-   ui->tableWidget->sortItems(col, m_lastOrder);
-   m_horizontalHeader->setSortIndicatorShown(true);
-   m_horizontalHeader->setSortIndicator(col, m_lastOrder);
-}
-
-void MainWindow::preview(){
-   QString value;
-   QTextStream stream(&value);
-   exportToStream(stream, 1);
+void MainWindow::about(){
+   AboutDialog dialog;
+   dialog.exec();
 }
 
 /**
- * Starts the about dialog.
+ * Starts the options dialog.
  */
-void MainWindow::about(){
-   AboutDialog dialog;
+void MainWindow::options(){
+   DialogOptions dialog(m_contextHandlers, NULL);
    dialog.exec();
 }
 
@@ -352,8 +319,8 @@ void MainWindow::exportFiles(){
  * @param maxRow    -1 or the maximum row to export
  */
 void MainWindow::exportToStream(QTextStream& stream, int maxRow){
-    QHash<QString, QString> placeholders;
-    buildGlobalPlaceholders(placeholders);
+   QMap < QString, QString > placeholders;
+   buildGlobalPlaceholders (placeholders);
    if (!ui->comboBoxHeader->currentText().isEmpty()){
       stream << replaceGlobalPlaceholders(ui->comboBoxHeader, placeholders)
          << endl;
@@ -364,20 +331,20 @@ void MainWindow::exportToStream(QTextStream& stream, int maxRow){
    QString error;
    for (int ii = 0; ii < count; ii++){
       QString line = ui->comboBoxTemplate->currentText();
-      QHash<QString, QString> placeholders;
+      QMap < QString, QString > placeholders;
       QString path = m_lastBaseDir.absoluteFilePath(
-                  ReQStringUtil::pathAppend(
-                  ui->tableWidget->item(ii, TC_PATH)->text(),
-                  ui->tableWidget->item(ii, TC_NODE)->text()));
+         ReQStringUtil::pathAppend(ui->tableWidget->item(ii, TC_PATH)->text(),
+            ui->tableWidget->item(ii, TC_NODE)->text()));
       placeholders.insert("full", ReQStringUtil::nativePath(path));
       placeholders.insert("path", ui->tableWidget->item(ii, TC_PATH)->text());
       placeholders.insert("ext", ui->tableWidget->item(ii, TC_EXT)->text());
       placeholders.insert("node", ui->tableWidget->item(ii, TC_NODE)->text());
-      placeholders.insert("modified", ui->tableWidget->item(ii, TC_MODIFIED)->text());
+      placeholders.insert("modified",
+         ui->tableWidget->item(ii, TC_MODIFIED)->text());
       placeholders.insert("size", ui->tableWidget->item(ii, TC_SIZE)->text());
-      if (! ReQStringUtil::replacePlaceholders(line, placeholders, &error)){
-          guiError(ui->comboBoxTemplate, error);
-          break;
+      if (!ReQStringUtil::replacePlaceholders(line, placeholders, &error)){
+         guiError(ui->comboBoxTemplate, error);
+         break;
       }
       stream << replaceEscSequences(line) << endl;
    }
@@ -437,65 +404,82 @@ void MainWindow::handlePlaceholder(QComboBox* target){
  * @param position  the position of a mouse click
  */
 void MainWindow::handleTableContextMenu(const QPoint& position){
-    int row = ui->tableWidget->rowAt(position.y());
-    if (row >= 0){
-        QMenu menu;
-
-        QString node = ui->tableWidget->item(row, TC_NODE)->text();
-        QString parent = buildAbsPath(row);
-        QString full = ReQStringUtil::pathAppend(parent, node);
-        QFileInfo file(full);
-        QList<ContextHandler*>& list = file.isDir() ? m_dirHandler : m_fileHandler;
-        QList<ContextHandler*>::const_iterator it;
-        QHash<QAction*, ContextHandler*> actions;
-        ContextHandler* handler;
-        for (it = list.begin(); it != list.end(); ++it){
-            handler = *it;
-            QString text = handler->m_text + " " + node;
-            actions.insert(menu.addAction(text), handler);
-        }
-        QAction* selectedItem = menu.exec(ui->tableWidget->viewport()->mapToGlobal(position));
-        if (selectedItem != NULL)
-        {
-            handler = *actions.find(selectedItem);
-            QString arguments = handler->m_arguments;
-            QString dir;
-            switch(handler->m_changeToParentDirectory){
-            case ContextHandler::DM_TO_PARENT:
-                dir = parent;
-                break;
-            case ContextHandler::DM_TO_FILE:
-                dir = full;
-                break;
-            default:
-                dir = ui->comboBoxDirectory->currentText();
-                break;
-            }
-            QMap<QString, QString> placeholders;
-            placeholders.insert("full", full);
-            placeholders.insert("node", node);
-            placeholders.insert("path", parent);
-            placeholders.insert("ext", ReQStringUtil::extensionOf(node));
-            QString error;
-            QStringList args = arguments.split(' ');
-            bool hasErrors = false;
-            for (int ix = 0; ix < args.size(); ix++){
-                QString arg = args.at(ix);
-                if (! ReQStringUtil::replacePlaceholders(arg, placeholders, &error)){
-                    guiError(NULL, error);
-                    hasErrors = true;
-                    break;
-                }
-                args.replace(ix, arg);
-            }
-            if (! hasErrors){
-                QProcess::startDetached(handler->m_program, args, dir, NULL);
-                setStatusMessage(false, "call of " + handler->m_program + " "
-                             + arguments);
+   int row = ui->tableWidget->rowAt(position.y());
+   if (row >= 0){
+      QMenu menu;
+
+      QString node = ui->tableWidget->item(row, TC_NODE)->text();
+      QString parent = buildAbsPath(row);
+      QString full = ReQStringUtil::pathAppend(parent, node);
+      QFileInfo file(full);
+      bool isDir = file.isDir();
+      QList <ContextHandler*>::const_iterator it;
+      QMap <QAction*, ContextHandler*> actions;
+      ContextHandler* handler;
+      for (it = m_contextHandlers.list().begin();
+               it != m_contextHandlers.list().end(); ++it){
+         handler = *it;
+         if ((isDir && handler->m_fileType == ContextHandler::FT_FILE)
+            || (!isDir && handler->m_fileType == ContextHandler::FT_DIR))
+            continue;
+         QString text = handler->m_text + " " + node;
+         actions.insert(menu.addAction(text), handler);
+      }
+      QAction* selectedItem = menu.exec(
+         ui->tableWidget->viewport()->mapToGlobal(position));
+      if (selectedItem != NULL){
+         handler = *actions.find(selectedItem);
+         QString arguments = handler->m_arguments;
+         QString dir;
+         switch (handler->m_directoryMode) {
+         case ContextHandler::DM_TO_PARENT:
+            dir = parent;
+            break;
+         case ContextHandler::DM_TO_FILE:
+            dir = full;
+            break;
+         default:
+            dir = ui->comboBoxDirectory->currentText();
+            break;
+         }
+         QMap < QString, QString > placeholders;
+         placeholders.insert("full", full);
+         placeholders.insert("node", node);
+         placeholders.insert("path", parent);
+         placeholders.insert("ext", ReQStringUtil::extensionOf(node));
+         QString error;
+         QStringList args = arguments.split(' ');
+         bool hasErrors = false;
+         for (int ix = 0; ix < args.size(); ix++){
+            QString arg = args.at(ix);
+            if (!ReQStringUtil::replacePlaceholders(arg, placeholders, &error)){
+               guiError(NULL, error);
+               hasErrors = true;
+               break;
             }
-        }
+            args.replace(ix, arg);
+         }
+         if (!hasErrors){
+            QProcess::startDetached(handler->m_program, args, dir, NULL);
+            setStatusMessage(false,
+               tr("started:") + " " + handler->m_program + " " + arguments);
+         }
+      }
+   }
+}
 
-    }
+/**
+ * Handles the event "header column clicked".
+ *
+ * @param col   the col
+ */
+void MainWindow::headerClicked(int col){
+   m_lastOrder =
+            m_lastOrder == Qt::AscendingOrder ?
+               Qt::DescendingOrder : Qt::AscendingOrder;
+   ui->tableWidget->sortItems(col, m_lastOrder);
+   m_horizontalHeader->setSortIndicatorShown(true);
+   m_horizontalHeader->setSortIndicator(col, m_lastOrder);
 }
 
 /**
@@ -505,6 +489,31 @@ void MainWindow::headerPlaceholder(){
    handlePlaceholder(ui->comboBoxHeader);
 }
 
+/**
+ * Prepares the context menu of the result table.
+ *
+ */
+void MainWindow::prepareContextMenu(){
+   ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
+   connect(ui->tableWidget,
+            SIGNAL(customContextMenuRequested(const QPoint&)),
+            SLOT(handleTableContextMenu(const QPoint&)));
+   ContextHandler* handler = new ContextHandler();
+   handler->m_text = "kedit";
+   handler->m_program = "/usr/bin/kate";
+   handler->m_arguments = "${full}";
+   handler->m_directoryMode = ContextHandler::DM_UNDEF;
+   handler->m_fileType = ContextHandler::FT_FILE;
+   m_contextHandlers.list().append(handler);
+   handler = new ContextHandler();
+   handler->m_text = "bash";
+   handler->m_program = "/usr/bin/konsole";
+   handler->m_arguments = "${full}";
+   handler->m_directoryMode = ContextHandler::DM_TO_FILE;
+   handler->m_fileType = ContextHandler::FT_DIR;
+   m_contextHandlers.list().append(handler);
+}
+
 /**
  * Prepares the text search.
  */
@@ -518,18 +527,36 @@ void MainWindow::prepareTextFind(){
    }
 }
 
-void MainWindow::buildGlobalPlaceholders(QHash<QString, QString>& hash){
-
-    hash.insert("filepatterns", ui->comboBoxFilePatterns->currentText());
-    hash.insert("base", m_lastBaseDir.absolutePath());
-    hash.insert("textpattern", ui->comboBoxTextPattern->currentText());
-    hash.insert("dirs", QString::number(m_statistics.m_dirs));
-    hash.insert("files", QString::number(m_statistics.m_files));
-    hash.insert("runtime", QString::number(m_statistics.m_runtimeSeconds, 'g', 3));
-    hash.insert("bytes", QString::number(m_statistics.m_bytes));
-    hash.insert("megabytes", QString::number((double) m_statistics.m_bytes / 1000000));
-    hash.insert("datetime", QDateTime::currentDateTime().toLocalTime().toString(
-          "yyyy.MM.dd/hh:mm:ss"));
+/**
+ * Shows a preview of the result export.
+ */
+void MainWindow::preview(){
+   QString value;
+   QTextStream stream(&value);
+   exportToStream(stream, 1);
+   QMessageBox msgBox;
+   msgBox.setText(value);
+   msgBox.setInformativeText(tr("Preview of the Export"));
+   msgBox.setStandardButtons(QMessageBox::Cancel);
+   msgBox.setDefaultButton(QMessageBox::Save);
+   msgBox.exec();
+}
+
+void MainWindow::buildGlobalPlaceholders(QMap <QString, QString>& hash){
+
+   hash.insert("filepatterns", ui->comboBoxFilePatterns->currentText());
+   hash.insert("base", m_lastBaseDir.absolutePath());
+   hash.insert("textpattern", ui->comboBoxTextPattern->currentText());
+   hash.insert("dirs", QString::number(m_statistics.m_dirs));
+   hash.insert("files", QString::number(m_statistics.m_files));
+   hash.insert("runtime",
+      QString::number(m_statistics.m_runtimeSeconds, 'g', 3));
+   hash.insert("bytes", QString::number(m_statistics.m_bytes));
+   hash.insert("megabytes",
+      QString::number((double) m_statistics.m_bytes / 1000000));
+   hash.insert("datetime",
+      QDateTime::currentDateTime().toLocalTime().toString(
+         "yyyy.MM.dd/hh:mm:ss"));
 }
 /**
  * Replaces placeholders valid in header and footer.
@@ -538,11 +565,11 @@ void MainWindow::buildGlobalPlaceholders(QHash<QString, QString>& hash){
  * @return      <code>text</code> with the esc sequences replaced
  */
 QString MainWindow::replaceGlobalPlaceholders(QComboBox* combo,
-       QHash<QString, QString>& placeholders){
-    QString rc = combo->currentText();
-    QString error;
-    if (! ReQStringUtil::replacePlaceholders(rc, placeholders, &error))
-        guiError(combo, error);
+   QMap <QString, QString>& placeholders){
+   QString rc = combo->currentText();
+   QString error;
+   if (!ReQStringUtil::replacePlaceholders(rc, placeholders, &error))
+      guiError(combo, error);
    return replaceEscSequences(rc);
 }
 
@@ -592,6 +619,7 @@ void MainWindow::restoreState(){
    storage.restore(ui->comboBoxTemplate, "comboBoxTemplate", true);
    storage.restore(ui->comboBoxTextPattern, "comboBoxTextPattern");
    storage.restore(ui->comboBoxYounger, "comboBoxYounger");
+   m_contextHandlers.restore(storage);
    storage.close();
 }
 
@@ -615,6 +643,7 @@ void MainWindow::saveState(){
    storage.store(ui->comboBoxTemplate, "comboBoxTemplate");
    storage.store(ui->comboBoxTextPattern, "comboBoxTextPattern");
    storage.store(ui->comboBoxYounger, "comboBoxYounger");
+   m_contextHandlers.save(storage);
    storage.close();
 }
 
index 55cd987b5c87a9422f2c5c610a9c1e9a1d98f024..6585f8febfdae1aa4bb4750b7f791c09762c2054 100644 (file)
@@ -25,6 +25,9 @@
 #if ! defined GUI_REGUI_HPP_
 #include "gui/regui.hpp"
 #endif
+#if ! defined UTILS_HPP
+#include "utils.hpp"
+#endif
 namespace Ui {
 class MainWindow;
 }
@@ -32,36 +35,6 @@ enum TableColumns {
    TC_NODE, TC_EXT, TC_SIZE, TC_MODIFIED, TC_TYPE, TC_PATH
 };
 
-struct Statistics {
-   Statistics(){
-      clear();
-   }
-   void clear(){
-      m_dirs = m_files = 0;
-      m_bytes = 0;
-      m_runtimeSeconds = 0;
-   }
-   int m_dirs;
-   int m_files;
-   int64_t m_bytes;
-   double m_runtimeSeconds;
-};
-
-class ContextHandler {
-public:
-    enum DirMode {
-        DM_UNDEF,
-        DM_TO_PARENT,
-        DM_TO_FILE
-    };
-
-public:
-    QString m_text;
-    QString m_program;
-    QString m_arguments;
-    DirMode m_changeToParentDirectory;
-};
-
 class MainWindow: public QMainWindow, public ReGuiValidator {
 
    Q_OBJECT
@@ -83,6 +56,7 @@ private slots:
    void handleTableContextMenu(const QPoint& position);
    void headerClicked(int col);
    void headerPlaceholder();
+   void options();
    void preview();
    void resetParameters();
    void saveState();
@@ -92,10 +66,10 @@ private slots:
    void up();
 
 private:
-   void addContextMenu();
+   void prepareContextMenu();
    QString buildAbsPath(int row);
    QDir::Filters buildFileTypes();
-   void buildGlobalPlaceholders(QHash<QString, QString>& hash);
+   void buildGlobalPlaceholders(QMap <QString, QString>& hash);
    QString cellAsText(int row, int col);
    void exportToStream(QTextStream& stream, int maxRow = -1);
    void handlePlaceholder(QComboBox* target);
@@ -103,7 +77,7 @@ private:
    void mousePressEvent(QMouseEvent* event);
    void prepareTextFind();
    QString replaceGlobalPlaceholders(QComboBox* combo,
-                                     QHash<QString, QString>& placeholders);
+      QMap <QString, QString>& placeholders);
    void restoreState();
    virtual void setStatusMessage(bool error, const QString& message);
 private:
@@ -120,8 +94,7 @@ private:
    QString m_storageFile;
    QAction* m_actionEditor;
    QAction* m_actionStartShell;
-   QList <ContextHandler*> m_fileHandler;
-   QList <ContextHandler*> m_dirHandler;
+   ContextHandlerList m_contextHandlers;
 };
 
 #endif // MAINWINDOW_HPP
index 6752c61c7903bd15f767e2ed926105bded9dbb69..a8543deb1729da93ff622e3dd75fdf72d85c3b9f 100644 (file)
          <attribute name="title">
           <string>&amp;Size, Date, Depth, Excluded Dirs</string>
          </attribute>
-         <widget class="QWidget" name="layoutWidget">
-          <property name="geometry">
-           <rect>
-            <x>10</x>
-            <y>0</y>
-            <width>812</width>
-            <height>113</height>
-           </rect>
-          </property>
-          <layout class="QGridLayout" name="gridLayout_2">
-           <property name="topMargin">
-            <number>10</number>
-           </property>
-           <property name="bottomMargin">
-            <number>10</number>
-           </property>
-           <item row="0" column="0">
-            <widget class="QLabel" name="label_4">
-             <property name="maximumSize">
-              <size>
-               <width>150</width>
-               <height>16777215</height>
-              </size>
-             </property>
-             <property name="text">
-              <string>Min. Size:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="0" column="1">
-            <widget class="QComboBox" name="comboBoxMinSize">
-             <property name="minimumSize">
-              <size>
-               <width>175</width>
-               <height>0</height>
-              </size>
-             </property>
-             <property name="maximumSize">
-              <size>
-               <width>200</width>
-               <height>16777215</height>
-              </size>
-             </property>
-             <property name="toolTip">
-              <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Formula of the minimal size.&lt;/p&gt;&lt;p&gt;Example: 3*512ki + 5MiByte + -2^10&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;A non zero value excludes automatically directories.&lt;/p&gt;&lt;p&gt;A formula is a arithmetic expression with the operators '+', '*' and '^' (potentioning).&lt;/p&gt;&lt;p&gt;Usual precedence: '+' &amp;lt; '*' &amp;lt; '^'&lt;/p&gt;&lt;p&gt;The operands are integer numbers with potentionally a unit.&lt;/p&gt;&lt;p&gt;Units: factor 1000: KByte, MByte, GByte, TByte&lt;br/&gt;factor 1024: KiByte, MiByte, GiByte, TiByte&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-             </property>
-             <property name="editable">
-              <bool>true</bool>
-             </property>
-            </widget>
-           </item>
-           <item row="0" column="2">
-            <widget class="QLabel" name="label_6">
-             <property name="maximumSize">
-              <size>
-               <width>200</width>
-               <height>16777215</height>
-              </size>
-             </property>
-             <property name="text">
-              <string>Younger than:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="0" column="3">
-            <widget class="QComboBox" name="comboBoxYounger">
-             <property name="minimumSize">
-              <size>
-               <width>200</width>
-               <height>0</height>
-              </size>
-             </property>
-             <property name="maximumSize">
-              <size>
-               <width>16777215</width>
-               <height>16777215</height>
-              </size>
-             </property>
-             <property name="toolTip">
-              <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Formula of the minimal file date.&lt;/p&gt;&lt;p&gt;Example (relative): 3*5days+ 2hour&lt;/p&gt;&lt;p&gt;Example (absolute): 2015.12.31/23:59:59 - 3weeks&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;A formula is a arithmetic expression with the operators '+', '*' and '^' (potentioning).&lt;/p&gt;&lt;p&gt;Usual precedence: '+' &amp;lt; '*' &amp;lt; '^'&lt;/p&gt;&lt;p&gt;The operands are integer numbers with potentionally a unit.&lt;/p&gt;&lt;p&gt;The first operand may be an absolute date, date and time or time:&lt;/p&gt;&lt;p&gt;Date syntax: yyyy.mm.dd&lt;/p&gt;&lt;p&gt;Time syntax HH:MM:SS&lt;/p&gt;&lt;p&gt;Units: minutes, hours, days, weeks&lt;/p&gt;&lt;p&gt;Abbrevation is allowed: 'd' is the same as 'days'&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-             </property>
-             <property name="editable">
-              <bool>true</bool>
-             </property>
-            </widget>
-           </item>
-           <item row="0" column="4">
-            <widget class="QLabel" name="label_11">
-             <property name="text">
-              <string>Min. Depth:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="0" column="5">
-            <widget class="QComboBox" name="comboBoxMinDepth">
-             <property name="toolTip">
-              <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Minimal distance of the subdirectory containing the found file from the base directory.&lt;/p&gt;&lt;p&gt;Example:&lt;br/&gt;Min.Depth: 1&lt;br/&gt;Direcory: /home&lt;/p&gt;&lt;p&gt;/home/x will not be found&lt;/p&gt;&lt;p&gt;/home/dir/x will be found&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-             </property>
-             <property name="editable">
-              <bool>true</bool>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="0">
-            <widget class="QLabel" name="label_5">
-             <property name="maximumSize">
-              <size>
-               <width>150</width>
-               <height>16777215</height>
-              </size>
-             </property>
-             <property name="text">
-              <string>Max Size:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="1">
-            <widget class="QComboBox" name="comboBoxMaxSize">
-             <property name="minimumSize">
-              <size>
-               <width>175</width>
-               <height>0</height>
-              </size>
-             </property>
-             <property name="maximumSize">
-              <size>
-               <width>200</width>
-               <height>16777215</height>
-              </size>
-             </property>
-             <property name="toolTip">
-              <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Formula of the maximum size.&lt;/p&gt;&lt;p&gt;Example: 3*512ki + 5MiByte + -2^10&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;A non zero value excludes automatically directories.&lt;/p&gt;&lt;p&gt;A formula is a arithmetic expression with the operators '+', '*' and '^' (potentioning).&lt;/p&gt;&lt;p&gt;Usual precedence: '+' &amp;lt; '*' &amp;lt; '^'&lt;/p&gt;&lt;p&gt;The operands are integer numbers with potentionally a unit.&lt;/p&gt;&lt;p&gt;Units: factor 1000: KByte, MByte, GByte, TByte&lt;br/&gt;factor 1024: KiByte, MiByte, GiByte, TiByte&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-             </property>
-             <property name="editable">
-              <bool>true</bool>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="2">
-            <widget class="QLabel" name="label_7">
-             <property name="maximumSize">
-              <size>
-               <width>200</width>
-               <height>16777215</height>
-              </size>
-             </property>
-             <property name="text">
-              <string>Older than:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="3">
-            <widget class="QComboBox" name="comboBoxOlder">
-             <property name="maximumSize">
-              <size>
-               <width>200</width>
-               <height>16777215</height>
-              </size>
-             </property>
-             <property name="toolTip">
-              <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Formula of the maximal file date.&lt;/p&gt;&lt;p&gt;Example (relative): 3*5days+ 2hour&lt;/p&gt;&lt;p&gt;Example (absolute): 2015.12.31/23:59:59 - 3weeks&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;A formula is a arithmetic expression with the operators '+', '*' and '^' (potentioning).&lt;/p&gt;&lt;p&gt;Usual precedence: '+' &amp;lt; '*' &amp;lt; '^'&lt;/p&gt;&lt;p&gt;The operands are integer numbers with potentionally a unit.&lt;/p&gt;&lt;p&gt;The first operand may be an absolute date, date and time or time:&lt;/p&gt;&lt;p&gt;Date syntax: yyyy.mm.dd&lt;/p&gt;&lt;p&gt;Time syntax HH:MM:SS&lt;/p&gt;&lt;p&gt;Units: minutes, hours, days, weeks&lt;/p&gt;&lt;p&gt;Abbrevation is allowed: 'd' is the same as 'days'&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-             </property>
-             <property name="editable">
-              <bool>true</bool>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="4">
-            <widget class="QLabel" name="label_12">
-             <property name="text">
-              <string>Max. Depth:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="5">
-            <widget class="QComboBox" name="comboBoxMaxDepth">
-             <property name="toolTip">
-              <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Maximum distance of the subdirectory containing the found file from the base directory.&lt;/p&gt;&lt;p&gt;Example:&lt;br/&gt;Max. Depth: 0&lt;br/&gt;It found no files in subdirectories.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-             </property>
-             <property name="editable">
-              <bool>true</bool>
-             </property>
-            </widget>
-           </item>
-           <item row="2" column="0">
-            <widget class="QLabel" name="label_13">
-             <property name="text">
-              <string>Excluded Dirs:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="2" column="1" colspan="3">
-            <widget class="QComboBox" name="comboBoxExcludedDirs">
-             <property name="toolTip">
-              <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;a comma (',') separated list of directory names not entered for the search.&lt;/p&gt;&lt;p&gt;Example: .git,.cache&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-             </property>
-             <property name="editable">
-              <bool>true</bool>
-             </property>
-            </widget>
-           </item>
-           <item row="2" column="4" colspan="2">
-            <widget class="QPushButton" name="pushButtonSearch2">
-             <property name="text">
-              <string>&amp;Run search</string>
-             </property>
-             <property name="icon">
-              <iconset>
-               <normaloff>:/main/icons/action_go.gif</normaloff>
-               <normalon>:/main/icons/action_go.png</normalon>:/main/icons/action_go.gif</iconset>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </widget>
+         <layout class="QHBoxLayout" name="horizontalLayout_9">
+          <item>
+           <layout class="QGridLayout" name="gridLayout_2">
+            <property name="topMargin">
+             <number>10</number>
+            </property>
+            <property name="bottomMargin">
+             <number>10</number>
+            </property>
+            <item row="1" column="0">
+             <widget class="QLabel" name="label_5">
+              <property name="maximumSize">
+               <size>
+                <width>150</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>Max Size:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="1">
+             <widget class="QComboBox" name="comboBoxMaxSize">
+              <property name="minimumSize">
+               <size>
+                <width>175</width>
+                <height>0</height>
+               </size>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>200</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="toolTip">
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Formula of the maximum size.&lt;/p&gt;&lt;p&gt;Example: 3*512ki + 5MiByte + -2^10&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;A non zero value excludes automatically directories.&lt;/p&gt;&lt;p&gt;A formula is a arithmetic expression with the operators '+', '*' and '^' (potentioning).&lt;/p&gt;&lt;p&gt;Usual precedence: '+' &amp;lt; '*' &amp;lt; '^'&lt;/p&gt;&lt;p&gt;The operands are integer numbers with potentionally a unit.&lt;/p&gt;&lt;p&gt;Units: factor 1000: KByte, MByte, GByte, TByte&lt;br/&gt;factor 1024: KiByte, MiByte, GiByte, TiByte&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+              </property>
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="3">
+             <widget class="QComboBox" name="comboBoxYounger">
+              <property name="minimumSize">
+               <size>
+                <width>200</width>
+                <height>0</height>
+               </size>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>16777215</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="toolTip">
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Formula of the minimal file date.&lt;/p&gt;&lt;p&gt;Example (relative): 3*5days+ 2hour&lt;/p&gt;&lt;p&gt;Example (absolute): 2015.12.31/23:59:59 - 3weeks&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;A formula is a arithmetic expression with the operators '+', '*' and '^' (potentioning).&lt;/p&gt;&lt;p&gt;Usual precedence: '+' &amp;lt; '*' &amp;lt; '^'&lt;/p&gt;&lt;p&gt;The operands are integer numbers with potentionally a unit.&lt;/p&gt;&lt;p&gt;The first operand may be an absolute date, date and time or time:&lt;/p&gt;&lt;p&gt;Date syntax: yyyy.mm.dd&lt;/p&gt;&lt;p&gt;Time syntax HH:MM:SS&lt;/p&gt;&lt;p&gt;Units: minutes, hours, days, weeks&lt;/p&gt;&lt;p&gt;Abbrevation is allowed: 'd' is the same as 'days'&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+              </property>
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="1">
+             <widget class="QComboBox" name="comboBoxMinSize">
+              <property name="minimumSize">
+               <size>
+                <width>175</width>
+                <height>0</height>
+               </size>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>200</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="toolTip">
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Formula of the minimal size.&lt;/p&gt;&lt;p&gt;Example: 3*512ki + 5MiByte + -2^10&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;A non zero value excludes automatically directories.&lt;/p&gt;&lt;p&gt;A formula is a arithmetic expression with the operators '+', '*' and '^' (potentioning).&lt;/p&gt;&lt;p&gt;Usual precedence: '+' &amp;lt; '*' &amp;lt; '^'&lt;/p&gt;&lt;p&gt;The operands are integer numbers with potentionally a unit.&lt;/p&gt;&lt;p&gt;Units: factor 1000: KByte, MByte, GByte, TByte&lt;br/&gt;factor 1024: KiByte, MiByte, GiByte, TiByte&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+              </property>
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="3">
+             <widget class="QComboBox" name="comboBoxOlder">
+              <property name="maximumSize">
+               <size>
+                <width>200</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="toolTip">
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Formula of the maximal file date.&lt;/p&gt;&lt;p&gt;Example (relative): 3*5days+ 2hour&lt;/p&gt;&lt;p&gt;Example (absolute): 2015.12.31/23:59:59 - 3weeks&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;A formula is a arithmetic expression with the operators '+', '*' and '^' (potentioning).&lt;/p&gt;&lt;p&gt;Usual precedence: '+' &amp;lt; '*' &amp;lt; '^'&lt;/p&gt;&lt;p&gt;The operands are integer numbers with potentionally a unit.&lt;/p&gt;&lt;p&gt;The first operand may be an absolute date, date and time or time:&lt;/p&gt;&lt;p&gt;Date syntax: yyyy.mm.dd&lt;/p&gt;&lt;p&gt;Time syntax HH:MM:SS&lt;/p&gt;&lt;p&gt;Units: minutes, hours, days, weeks&lt;/p&gt;&lt;p&gt;Abbrevation is allowed: 'd' is the same as 'days'&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+              </property>
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="5">
+             <widget class="QComboBox" name="comboBoxMaxDepth">
+              <property name="toolTip">
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Maximum distance of the subdirectory containing the found file from the base directory.&lt;/p&gt;&lt;p&gt;Example:&lt;br/&gt;Max. Depth: 0&lt;br/&gt;It found no files in subdirectories.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+              </property>
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="0">
+             <widget class="QLabel" name="label_4">
+              <property name="maximumSize">
+               <size>
+                <width>150</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>Min. Size:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="5">
+             <widget class="QComboBox" name="comboBoxMinDepth">
+              <property name="toolTip">
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Minimal distance of the subdirectory containing the found file from the base directory.&lt;/p&gt;&lt;p&gt;Example:&lt;br/&gt;Min.Depth: 1&lt;br/&gt;Direcory: /home&lt;/p&gt;&lt;p&gt;/home/x will not be found&lt;/p&gt;&lt;p&gt;/home/dir/x will be found&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+              </property>
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="2">
+             <widget class="QLabel" name="label_6">
+              <property name="maximumSize">
+               <size>
+                <width>200</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>Younger than:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="4" colspan="2">
+             <widget class="QPushButton" name="pushButtonSearch2">
+              <property name="text">
+               <string>&amp;Run search</string>
+              </property>
+              <property name="icon">
+               <iconset>
+                <normaloff>:/main/icons/action_go.gif</normaloff>
+                <normalon>:/main/icons/action_go.png</normalon>:/main/icons/action_go.gif</iconset>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="2">
+             <widget class="QLabel" name="label_7">
+              <property name="maximumSize">
+               <size>
+                <width>200</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>Older than:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="1" colspan="3">
+             <widget class="QComboBox" name="comboBoxExcludedDirs">
+              <property name="toolTip">
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;a comma (',') separated list of directory names not entered for the search.&lt;/p&gt;&lt;p&gt;Example: .git,.cache&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+              </property>
+              <property name="editable">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="4">
+             <widget class="QLabel" name="label_11">
+              <property name="text">
+               <string>Min. Depth:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="4">
+             <widget class="QLabel" name="label_12">
+              <property name="text">
+               <string>Max. Depth:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="0">
+             <widget class="QLabel" name="label_13">
+              <property name="text">
+               <string>Excluded Dirs:</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
         </widget>
         <widget class="QWidget" name="tabExport">
          <attribute name="title">
             <x>10</x>
             <y>11</y>
             <width>981</width>
-            <height>101</height>
+            <height>103</height>
            </rect>
           </property>
           <layout class="QGridLayout" name="gridLayout_3">
                </property>
               </spacer>
              </item>
+             <item>
+              <widget class="QPushButton" name="pushButtonPreview">
+               <property name="text">
+                <string>&amp;Preview</string>
+               </property>
+               <property name="icon">
+                <iconset resource="refind.qrc">
+                 <normaloff>:/main/icons/eye.png</normaloff>:/main/icons/eye.png</iconset>
+               </property>
+              </widget>
+             </item>
             </layout>
            </item>
            <item row="1" column="1">
     </property>
     <addaction name="actionSearch"/>
     <addaction name="separator"/>
+    <addaction name="actionPreview"/>
     <addaction name="actionExport"/>
     <addaction name="separator"/>
     <addaction name="actionSaveProgramState"/>
     <addaction name="separator"/>
     <addaction name="separator"/>
     <addaction name="actionReset"/>
+    <addaction name="separator"/>
+    <addaction name="actionOptions"/>
    </widget>
    <addaction name="menuFile"/>
    <addaction name="menu_Edit"/>
    <addaction name="actionGetBaseDirectory"/>
    <addaction name="separator"/>
    <addaction name="actionReset"/>
+   <addaction name="separator"/>
+   <addaction name="actionOptions"/>
   </widget>
   <widget class="QToolBar" name="toolBarExit">
    <property name="windowTitle">
    <attribute name="toolBarBreak">
     <bool>false</bool>
    </attribute>
+   <addaction name="actionPreview"/>
    <addaction name="actionExport"/>
    <addaction name="actionSaveProgramState"/>
    <addaction name="actionExit"/>
     <string>&amp;About</string>
    </property>
    <property name="shortcut">
-    <string>Ctrl+A</string>
+    <string>Ctrl+Shift+A</string>
    </property>
   </action>
   <action name="actionExport">
     <string>Puts the absolute path of the selected file into the clipboard</string>
    </property>
    <property name="shortcut">
-    <string>Ctrl+P</string>
+    <string>Ctrl+Shift+P</string>
    </property>
   </action>
   <action name="actionGetFullName">
     <string>Sets the file filter properties to the default</string>
    </property>
    <property name="shortcut">
-    <string>Ctrl+E</string>
+    <string>Ctrl+Shift+R</string>
    </property>
   </action>
   <action name="actionSaveProgramState">
     <string>Saves the program state (position, history...) to a file</string>
    </property>
    <property name="shortcut">
-    <string>Ctrl+S</string>
+    <string>Ctrl+Shift+S</string>
+   </property>
+  </action>
+  <action name="actionOptions">
+   <property name="icon">
+    <iconset resource="refind.qrc">
+     <normaloff>:/main/icons/wrench.png</normaloff>:/main/icons/wrench.png</iconset>
+   </property>
+   <property name="text">
+    <string>&amp;Options</string>
+   </property>
+   <property name="toolTip">
+    <string>Dialog for changing the options</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+Shift+O</string>
+   </property>
+  </action>
+  <action name="actionPreview">
+   <property name="icon">
+    <iconset resource="refind.qrc">
+     <normaloff>:/main/icons/eye.png</normaloff>:/main/icons/eye.png</iconset>
+   </property>
+   <property name="text">
+    <string>Pre&amp;view</string>
+   </property>
+   <property name="toolTip">
+    <string>Shows a preview of the result export</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+Shift+V</string>
    </property>
   </action>
  </widget>
index 709b269d8cd142903b7d34b78166da6045b8ae61..5e62b72a5dfe3e173c8527599a1d6ffa9429ef1d 100644 (file)
@@ -25,7 +25,8 @@ SOURCES += main.cpp\
         ../../gui/ReGuiValidator.cpp \
         dialogglobalplaceholder.cpp \
         dialogfileplaceholder.cpp \
-    utils.cpp
+    utils.cpp \
+    dialogoptions.cpp
 
 
 HEADERS  += mainwindow.hpp \
@@ -39,13 +40,15 @@ HEADERS  += mainwindow.hpp \
         ../../gui/regui.hpp \
         dialogglobalplaceholder.hpp \
         dialogfileplaceholder.hpp \
-    utils.hpp
+    utils.hpp \
+    dialogoptions.hpp
 
 
 FORMS    += mainwindow.ui \
         aboutdialog.ui \
         dialogglobalplaceholder.ui \
-        dialogfileplaceholder.ui
+        dialogfileplaceholder.ui \
+    dialogoptions.ui
 
 TRANSLATIONS = refind_de.ts
 
index 7c6cce90851acd0440e11c5fb3fcaf46a32e2f26..5f2890a32452b20b929888733a397ea44cd9626a 100644 (file)
@@ -18,5 +18,7 @@
         <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 c3055b03f3c96463f8f88e9d9cb7defc29d134be..16a5cfd17269281ff80df109ae99337dca5be3ff 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include "base/rebase.hpp"
+#include "utils.hpp"
 #include "textfinder.hpp"
 
 /**
diff --git a/appl/refind/utils.cpp b/appl/refind/utils.cpp
new file mode 100644 (file)
index 0000000..d5123a9
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * 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 "base/rebase.hpp"
+#include "utils.hpp"
+
+/**
+ * Constructor.
+ */
+ContextHandler::ContextHandler() :
+            m_text(),
+            m_program(),
+            m_arguments(),
+            m_directoryMode(DM_TO_PARENT),
+            m_fileType(FT_FILE){
+}
+
+/**
+ * Constructor.
+ */
+ContextHandlerList::ContextHandlerList() :
+         m_list(){
+}
+
+/**
+ * Constructor.
+ */
+ContextHandlerList::~ContextHandlerList(){
+   clear();
+}
+/**
+ * Copy constructor.
+ *
+ * @param source    source to copy
+ * @return          the instance itself
+ */
+ContextHandlerList::ContextHandlerList(const ContextHandlerList& source) :
+         m_list(){
+   copy(source);
+}
+
+/**
+ * Assignment operator.
+ *
+ * @param source    source to copy
+ * @return          the instance itself
+ */
+ContextHandlerList& ContextHandlerList::operator =(
+   const ContextHandlerList& source){
+   return copy(source);
+}
+
+/**
+ * Frees the resources.
+ */
+void ContextHandlerList::clear(){
+   QList <ContextHandler*>::const_iterator it;
+   for (it = m_list.begin(); it != m_list.end(); ++it){
+      delete *it;
+   }
+   m_list.clear();
+}
+
+/**
+ * Assignment operator.
+ *
+ * @param source    source to copy
+ * @return          the instance itself
+ */
+ContextHandlerList& ContextHandlerList::copy(const ContextHandlerList& source){
+   clear();
+   QList <ContextHandler*>::const_iterator it;
+   for (it = source.m_list.begin(); it != source.m_list.end(); ++it){
+      ContextHandler* handler = *it;
+      m_list.append(handler);
+   }
+   return *this;
+}
+
+/**
+ * Stores the list in the storage.
+ *
+ * @param storage   IN/OUT: the storage
+ */
+void ContextHandlerList::save(ReStateStorage& storage){
+   QString name = "context.program";
+   QString value;
+   for (int ix = 0; ix < m_list.size(); ix++){
+      ContextHandler* handler = m_list.at(ix);
+      value = handler->m_text + "\t" + handler->m_program + "\t"
+         + QString::number(handler->m_fileType) + "\t"
+         + QString::number(handler->m_directoryMode);
+      storage.store(name, value, ix);
+   }
+}
+
+/**
+ * Reads the list from the storage.
+ *
+ * @param storage
+ */
+void ContextHandlerList::restore(ReStateStorage& storage){
+   QString name = "context.program";
+   clear();
+   int ix = -1;
+   QString value;
+   QStringList cols;
+   while (true){
+      ix++;
+      value = storage.restore(name, ix);
+      if (value.isEmpty())
+         break;
+      cols = value.split('\t');
+      if (cols.size() != 5)
+         break;
+      ContextHandler* handler = new ContextHandler;
+      handler->m_text = cols.at(0);
+      handler->m_program = cols.at(1);
+      handler->m_arguments = cols.at(2);
+      handler->m_fileType = ContextHandler::FileType(
+         1 + atol(cols.at(3).toUtf8().constData()));
+      handler->m_directoryMode = ContextHandler::DirMode(
+         1 + atol(cols.at(4).toUtf8().constData()));
+      m_list.append(handler);
+   }
+}
+
+/**
+ * Constructor.
+ */
+Statistics::Statistics(){
+   clear();
+}
+
+/**
+ * Resets all members.
+ */
+void Statistics::clear(){
+   m_dirs = m_files = 0;
+   m_bytes = 0;
+   m_runtimeSeconds = 0;
+}
diff --git a/appl/refind/utils.hpp b/appl/refind/utils.hpp
new file mode 100644 (file)
index 0000000..0a90b6e
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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 UTILS_HPP
+#define UTILS_HPP
+
+#include <QTableWidget>
+#include "gui/ReStateStorage.hpp"
+enum {
+   COL_FILE_TYPE, COL_TITLE, COL_PROGRAM, COL_ARGUMENTS, COL_CURRENT_DIR
+};
+class ContextHandler {
+public:
+   enum DirMode {
+      DM_UNDEF, DM_TO_PARENT, DM_TO_FILE
+   };
+   enum FileType {
+      FT_UNDEF, FT_DIR, FT_FILE, FT_ALL
+   };
+public:
+   ContextHandler();
+public:
+   QString m_text;
+   QString m_program;
+   QString m_arguments;
+   DirMode m_directoryMode;
+   FileType m_fileType;
+};
+
+class ContextHandlerList {
+public:
+   ContextHandlerList();
+   ~ContextHandlerList();
+   ContextHandlerList(const ContextHandlerList& source);
+   ContextHandlerList& operator =(const ContextHandlerList& source);
+public:
+   void clear();
+   ContextHandlerList&copy(const ContextHandlerList& source);
+   QList <ContextHandler*>& list(){
+      return m_list;
+   }
+   void save(ReStateStorage& storage);
+   void restore(ReStateStorage& storage);
+private:
+   QList <ContextHandler*> m_list;
+};
+
+class Statistics {
+public:
+   Statistics();
+public:
+   void clear();
+public:
+   int m_dirs;
+   int m_files;
+   int64_t m_bytes;
+   double m_runtimeSeconds;
+};
+
+#endif // UTILS_HPP
index af4a9606f7a00ea7abd23f6596fa8ab12e9ebf68..9ee3619b37592a1341d17e83ae98a9d65399f680 100644 (file)
@@ -390,12 +390,12 @@ QString ReQStringUtil::pathAppend(const QString& base, const QString& path)
  * @return              <code>true</code>: success<br>
  *                      <code>false</code>: unknown name found (not replaced)
  */
-bool ReQStringUtil::replacePlaceholders(QString& text,
-    const QHash<QString, QString>& placeholders, QString* error){
+bool ReQStringUtil::replacePlaceholders(QString& text, const QMap<QString,
+                                  QString>& placeholders, QString* error){
     int start = 0;
     bool rc = true;
     QString name;
-    QHash<QString, QString>::const_iterator it;
+    QMap<QString, QString>::const_iterator it;
     while (start >= 0){
        start = text.indexOf("${", start);
        if (start < 0)
index 55a08881f9375b8e9c9067a01add6637a628343f..11f70b082536d83dd2897f20d0baf85d35976474 100644 (file)
@@ -43,7 +43,7 @@ public:
 #endif
    }
    static QString pathAppend(const QString& base, const QString& path);
-   static bool replacePlaceholders(QString& text, const QHash<QString,
+   static bool replacePlaceholders(QString& text, const QMap<QString,
                                   QString>& placeholders, QString* error);
    static void skipExpected(const ReString& text, QChar expected, int& index,
                             int& length);
index 2c7ab8596e855988dcb6f16d45dc437925600b15..a91f568967a39258c0505068786f7b33e26d7280 100644 (file)
@@ -27,7 +27,7 @@
 #include <QThread>
 #include <QIODevice>
 #include <QTextStream>
-#include <QHash>
+#include <QMap>
 #include <QVector>
 #include <QDataStream>
 #include <QMutex>
index 9bec52e545d0a077acb4c27120be814ea6b97b48..fbadb0af611e227a8475790017e2c7a7727813e8 100644 (file)
@@ -129,6 +129,26 @@ void ReStateStorage::restore(QComboBox* combo, const QString& name,
       }
    }
 }
+/**
+ * Reads a value from the storage.
+ *
+ * @param name  name of the variable
+ * @param index -1 (no array) or the index of the entry
+ * @return      "": not found<br>
+ *              otherwise: the stored value of the variable
+ */
+QString ReStateStorage::restore(const QString& name, int index)
+{
+    QString rc;
+    if (initForRead()){
+        QString key(name);
+        if (index >= 0)
+            key += QString::number(index);
+        if (m_map.contains(key))
+           rc = m_map.value(key);
+    }
+    return rc;
+}
 /**
  * Stores the data of a combobox.
  *
@@ -154,3 +174,22 @@ void ReStateStorage::store(const QComboBox* combo, const QString& name,
    m_stream->flush();
 }
 
+/**
+ * Stores the data of a combobox.
+ *
+ * @param combo             the combobox to store
+ * @param name              the name of the combobox
+ * @param withCurrentText   <code>true</code>: the current text will be saved too
+ */
+void ReStateStorage::store(const QString& name, const QString& value, int index)
+{
+    if (initForWrite()){
+       QString key(name);
+       if (index >= 0)
+           key += QString::number(index);
+       *m_stream << key << "=" << value << endl;
+    }
+    m_stream->flush();
+
+}
+
index 3f3665c7b618f695e21d8e7886ec120828d168df..5d250350571d2d41839d61d54cf6009b36643d2d 100644 (file)
@@ -27,9 +27,11 @@ public:
    bool initForWrite();
    void restore(QComboBox* combo, const QString& name, bool withCurrentText =
       false);
+   QString restore(const QString& name, int index = -1);
+   void setForm(const QString& form);
    void store(const QComboBox* combo, const QString& name,
       bool withCurrentText = true);
-   void setForm(const QString& form);
+   void store(const QString& name, const QString& value, int index = -1);
 
 private:
    QString m_filename;