}
m_lastHitPosition.m_line = lineNo;
m_lastHitPosition.m_hitNo = ++lastHit;
+ if (m_lastHitPosition.m_hitNo > m_lastHitPosition.m_maxHitNo)
+ m_lastHitPosition.m_maxHitNo = m_lastHitPosition.m_hitNo;
if (lastHit >= m_fromHit){
for (int ix = max(lastLine + 1, max(0, lineNo - m_linesAbove));
ix <= min(lineNo + m_linesBelow, lastIx);
#include "QFileDialog"
-static const char* VERSION = "2016.11.16";
+static const char* VERSION = "2016.11.26";
MainWindow::MainWindow(QApplication& application, const QString& homeDir,
QWidget *parent) :
ui->tableWidget->setColumnWidth(colNode, 200);
ui->tableWidget->setColumnWidth(colSize, 125);
ui->tableWidget->setColumnWidth(colDate, 175);
-
+ switchFilter(true);
if (m_test){
- ui->comboBoxBaseDirectory->setCurrentText("/etc");
- ui->comboBoxFilePatterns->setCurrentText("*asu*");
- ui->comboBoxIncludingPattern->setCurrentText("#!");
+ ui->comboBoxBaseDirectory->setCurrentText("/home/mhm/labor");
+ ui->comboBoxFilePatterns->setCurrentText("big*.txt");
+ ui->comboBoxIncludingPattern->setCurrentText("47");
onAdd();
}
}
+/**
+ * Writes the known number of hits into the label.
+ */
+void MainWindow::logHits(){
+ if (m_lastHitPosition->m_hitCount >= 0)
+ ui->labelHits->setText(tr("%1 hit(s)").arg(m_lastHitPosition->m_hitCount));
+ else
+ ui->labelHits->setText(tr(">= %1 hit(s)").arg(m_lastHitPosition->m_maxHitNo));
+}
+
+/**
+ * Handles the change of the search criteria.
+ */
void MainWindow::clearLastHitPosition(const QString&, const QString&)
{
m_lastHitPosition->m_filename.clear();
m_lastHitPosition->m_hitCount = -1;
m_lastHitPosition->m_hitNo = -1;
+ m_lastHitPosition->m_maxHitNo = 0;
}
/**
filter.filter(ui->comboBoxIncludingPattern->currentText(),
ui->comboBoxExcludingPattern->currentText(),
from, to, above, below, false);
+ switchFilter(false);
}
/**
}
}
+/**
+ * Switches the filter state.
+ *
+ * @param first <i>true</i>: a new resultset is expected.
+ */
+void MainWindow::switchFilter(bool first){
+ ui->pushButtonFilter->setEnabled(first);
+ ui->pushButtonPrevious->setEnabled(! first);
+ ui->pushButtonNext->setEnabled(! first);
+ if (first){
+ int start = comboInt(ui->comboBoxFromHit, 1);
+ int pageSize = comboInt(ui->comboBoxToHit, start + 50) - start + 1;
+ ui->comboBoxFromHit->setCurrentText("1");
+ ui->comboBoxToHit->setCurrentText(QString::number(pageSize));
+ ui->labelHits->setText("");
+ } else {
+ logHits();
+ }
+}
+
/**
* Event
* @param oldString
</property>
</spacer>
</item>
+ <item>
+ <widget class="QLabel" name="labelHits">
+ <property name="text">
+ <string>123456 Hits</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ </widget>
+ </item>
<item>
<widget class="QPushButton" name="pushButtonPrevious">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="maximumSize">
<size>
<width>25</width>
</item>
<item>
<widget class="QPushButton" name="pushButtonNext">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="maximumSize">
<size>
<width>25</width>