m_statistics(),
m_announcer(NULL),
m_observer(NULL){
- m_youngerThan.setMSecsSinceEpoch(0);
- m_olderThan.setMSecsSinceEpoch(0);
+ m_youngerThan.setMSecsSinceEpoch(0);
+ m_olderThan.setMSecsSinceEpoch(0);
}
FileFinder::~FileFinder(){
m_table->setItem(m_lines, TC_MODIFIED,
new QTableWidgetItem(
it->lastModified().toString("yyyy.MM.dd/hh:mm:ss")));
- m_lines++;
- clock_t now = clock();
- if (now > nextUpdate){
- m_table->setRowCount(m_lines);
- nextUpdate = now + CLOCKS_PER_SEC;
- }
- }
+ }
+ clock_t now = clock();
+ if (now > nextUpdate){
+ m_table->setRowCount(m_lines);
+ if (m_announcer != NULL)
+ m_announcer->say(LOG_INFO, path);
+ nextUpdate = now + CLOCKS_PER_SEC;
+ }
}
for (it2 = antiPatterns.begin(); it2 != antiPatterns.end(); ++it2){
delete *it2;
if (strcmp(message, "ready") == 0){
ui->pushButtonSearch->setEnabled(true);
ui->pushButtonSearch2->setEnabled(true);
+ m_statistics = m_finder->statistics();
}
return ReObserver::SUCCESS;
}
msgBox.exec();
}
+inline QString addEsc(const QString& text){
+ QString rc = text;
+#if defined WIN32
+ rc.replace("\\", "\\\\");
+#endif
+ return rc;
+}
+
/**
* Builds the hash with the global placeholders with their current values.
*
*/
void MainWindow::buildGlobalPlaceholders(QMap <QString, QString>& hash){
-hash.insert("filepatterns", ui->comboBoxFilePatterns->currentText());
+hash.insert("filepatterns", addEsc(ui->comboBoxFilePatterns->currentText()));
hash.insert("base", m_lastBaseDir.absolutePath());
-hash.insert("textpattern", ui->comboBoxTextPattern->currentText());
+hash.insert("textpattern", addEsc(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));
*/
void MainWindow::populateFinder(FileFinder& finder){
finder.setObserver(this);
+ finder.setAnnouncer(this);
finder.setBaseDir(comboText(ui->comboBoxDirectory));
finder.setTable(ui->tableWidget);
m_lastBaseDir.cd(comboText(ui->comboBoxDirectory));
if (info.isDir()) {
if (!deleteTree(full, false, logger))
rc = false;
- else if (rmdir(I18N::s2b(full)) != 0) {
+ else if (_rmdir(I18N::s2b(full)) != 0) {
rc = false;
if (logger != NULL)
logger->logv(LOG_ERROR, LOC_DELETE_TREE_1,
if ((cc = filename[ix - 1]) != '/' && cc != '\\')
rc.append(filename + ix);
break;
- } else if (cc == '\\' or cc == '/')
+ } else if (cc == '\\' || cc == '/')
break;
ix--;
}
* @param value the value to round
*/
inline int roundInt(double value) {
- return (int) round(value);
+ return (int) value < 0.0 ? ceil(value - 0.5) : floor(value + 0.5);
}
/** An observer can be informed about state changes.
* Pure abstract class.