]> gitweb.hamatoma.de Git - reqt/commitdiff
refind: filtering works, tooltips
authorhama <hama@siduction.net>
Sun, 12 Apr 2015 18:31:26 +0000 (20:31 +0200)
committerhama <hama@siduction.net>
Sun, 12 Apr 2015 18:31:26 +0000 (20:31 +0200)
appl/refind/filefinder.cpp
appl/refind/mainwindow.cpp
appl/refind/mainwindow.ui

index 1b89746b7264dabff5852ba1a615a5c4b8a8e394..996ee801d7c8fabd2edb3a4e29ade9e9a78fc112 100644 (file)
@@ -94,10 +94,13 @@ QString fileSize(int64_t size){
  */
 QString typeOf(QFileInfo& info){
    QString rc;
-   if (info.isDir())
+   if (info.isSymLink()){
+       if (info.isDir())
+           rc = QObject::tr("link (dir)");
+       else
+           rc = QObject::tr("link (file)");
+   } else if (info.isDir())
       rc = QObject::tr("dir");
-   else if (info.isSymLink())
-      rc = QObject::tr("link");
    else
       rc = QObject::tr("file");
    return rc;
@@ -111,13 +114,13 @@ QString typeOf(QFileInfo& info){
  * @param table     OUT: the table to fill
  */
 void FileFinder::fillTable(const QString& path, int depth, QTableWidget* table){
-   QDir dir(path);
    QFileInfoList entries;
-   if (m_patterns.count() > 0)
-       dir.setNameFilters(m_patterns);
+   QDir dir(path);
    QDir::Filters filters = m_fileTypes | QDir::NoDotAndDotDot;
-   dir.setFilter(filters);
-   dir.setFilter(m_fileTypes);
+   if (m_patterns.count() == 0)
+         entries = dir.entryInfoList(filters, QDir::NoSort);
+      else
+         entries = dir.entryInfoList(m_patterns, filters, QDir::NoSort);
    QList <QFileInfo>::iterator it;
    QString relativePath = path.mid(1 + m_baseDir.length());
    QString node, ext;
@@ -152,7 +155,7 @@ void FileFinder::fillTable(const QString& path, int depth, QTableWidget* table){
          m_lines++;
       }
    }
-   if (depth < m_maxDepth){
+   if (depth < m_maxDepth || m_maxDepth < 0){
       entries = dir.entryInfoList(
          QDir::NoSymLinks | QDir::NoDotAndDotDot | QDir::AllDirs, QDir::NoSort);
       bool filtered = m_excludedDirs.length() > 0;
index 941cfb10a69e1382fc93ae159914d93a64a8aace..ddbf672433b7a994f01a20d2e45f3d05a50adcba 100644 (file)
@@ -39,7 +39,7 @@ MainWindow::MainWindow(QWidget *parent) :
    ui->tableWidget->setColumnWidth(TC_EXT, 40);
    ui->tableWidget->setColumnWidth(TC_SIZE, 125);
    ui->tableWidget->setColumnWidth(TC_MODIFIED, 175);
-   ui->tableWidget->setColumnWidth(TC_TYPE, 50);
+   ui->tableWidget->setColumnWidth(TC_TYPE, 75);
    ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
 }
 
@@ -213,7 +213,7 @@ void MainWindow::search(){
 void MainWindow::selectDirectory(){
     QString dir = QFileDialog::getExistingDirectory(this,
       tr("Select Directory"), ui->comboBoxDirectory->currentText(),
-      QFileDialog::ShowDirsOnly| QFileDialog::DontResolveSymlinks);
+      QFileDialog::ShowDirsOnly);
     if (! dir.isEmpty())
         ui->comboBoxDirectory->setCurrentText(dir);
 }
index 7ef477f1fdbc9dd1cb7c1c24503654ec79fd95ad..213f712486efb32cc5bfaf3d94fd7bfe96042810 100644 (file)
@@ -6,12 +6,12 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>888</width>
+    <width>1030</width>
     <height>579</height>
    </rect>
   </property>
   <property name="windowTitle">
-   <string>MainWindow</string>
+   <string>RePubLib File Finder</string>
   </property>
   <widget class="QWidget" name="centralWidget">
    <layout class="QVBoxLayout" name="verticalLayout_3">
@@ -57,7 +57,7 @@
             <item row="2" column="5" colspan="2">
              <layout class="QHBoxLayout" name="horizontalLayout">
               <item>
-               <widget class="QCheckBox" name="checkBoxFiles">
+               <widget class="QCheckBox" name="checkBoxDirs">
                 <property name="minimumSize">
                  <size>
                   <width>75</width>
             <item row="2" column="1">
              <widget class="QComboBox" name="comboBoxFilePatterns">
               <property name="toolTip">
-               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;a comma (',') separated list of filename patterns&lt;/p&gt;&lt;p&gt;Example: *.txt,*.odt&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;A comma (',') separated list of filename patterns&lt;/p&gt;&lt;p&gt;Example: *.txt,*.odt&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
               </property>
               <property name="editable">
                <bool>true</bool>
             </item>
             <item row="0" column="6">
              <widget class="QPushButton" name="pushButtonSearch">
+              <property name="toolTip">
+               <string>Execute the search</string>
+              </property>
               <property name="text">
                <string>Search</string>
               </property>
                  </size>
                 </property>
                 <property name="toolTip">
-                 <string>change to parent directory</string>
+                 <string>Change to the parent directory</string>
                 </property>
                 <property name="text">
                  <string>⇑</string>
                  </size>
                 </property>
                 <property name="toolTip">
-                 <string>select directory by a dialog box</string>
+                 <string>Select directory by a dialog box</string>
                 </property>
                 <property name="text">
                  <string>...</string>
             </item>
             <item row="0" column="1" colspan="2">
              <widget class="QComboBox" name="comboBoxDirectory">
+              <property name="toolTip">
+               <string>The base directory (starting point of the search)</string>
+              </property>
               <property name="editable">
                <bool>true</bool>
               </property>
              </widget>
             </item>
             <item row="2" column="2">
-             <widget class="QCheckBox" name="checkBoxDirs">
+             <widget class="QCheckBox" name="checkBoxFiles">
               <property name="text">
                <string>Files</string>
               </property>
                <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>
                <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>
            </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>
                <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>
                <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>
            </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>
            <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>
+              <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>
           <string>Size (MByte)</string>
          </property>
          <property name="textAlignment">
-          <set>AlignRight|AlignVCenter</set>
+          <set>AlignRight|AlignBottom</set>
          </property>
         </column>
         <column>
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>888</width>
+     <width>1030</width>
      <height>23</height>
     </rect>
    </property>
   <tabstop>pushButtonUp</tabstop>
   <tabstop>pushButtonDirectory</tabstop>
   <tabstop>comboBoxFilePatterns</tabstop>
-  <tabstop>checkBoxDirs</tabstop>
   <tabstop>checkBoxFiles</tabstop>
+  <tabstop>checkBoxDirs</tabstop>
   <tabstop>checkBoxLinks</tabstop>
   <tabstop>checkBoxHidden</tabstop>
   <tabstop>checkBoxWritable</tabstop>