*/
#include <QDir>
+#include "base/rebase.hpp"
#include "mainwindow.hpp"
#include "filefinder.hpp"
*/
#include <QApplication>
-#include <QDir>
+#include "base/rebase.hpp"
#include "mainwindow.hpp"
int main(int argc, char *argv[]){
QApplication a(argc, argv);
- MainWindow w;
+ MainWindow w(argc > 1 ? argv[1] : "");
w.show();
return a.exec();
*
* @param parent NULL or the parent widget
*/
-MainWindow::MainWindow(QWidget *parent) :
+MainWindow::MainWindow(const QString& startDir, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_statusMessage(NULL),
m_errors(0){
ui->setupUi(this);
m_statusMessage = new QLabel(tr("Willkommen bei refind"));
- ui->comboBoxDirectory->setCurrentText(QDir::currentPath());
+ ui->comboBoxDirectory->setCurrentText(startDir.isEmpty() ? QDir::currentPath() : startDir);
statusBar()->addWidget(m_statusMessage);
connect(ui->pushButtonSearch, SIGNAL(clicked()), this, SLOT(search()));
connect(ui->pushButtonSearch2, SIGNAL(clicked()), this, SLOT(search()));
* @brief Handles the "up" button: go to the parent directory.
*/
void MainWindow::up(){
- QString path = ui->comboBoxDirectory->currentText();
- int ix = path.lastIndexOf(QDir::separator());
- if (ix >= 0){
- path = path.mid(0, ix);
- ui->comboBoxDirectory->setEditText(path);
- setInHistory(ui->comboBoxDirectory, path);
+ QString path = ui->comboBoxDirectory->currentText();
+ QDir dir(path);
+ if (dir.exists()){
+ dir.cdUp();
+ if (dir.exists()){
+ path = dir.absolutePath();
+ ui->comboBoxDirectory->setEditText(path);
+ setInHistory(ui->comboBoxDirectory, path);
+ }
}
}
#ifndef MAINWINDOW_HPP
#define MAINWINDOW_HPP
-
+#ifndef REBASE_HPP
+#include "base/rebase.hpp"
+#endif
#include <QMainWindow>
#include <QComboBox>
#include <QLabel>
+#include <QDir>
namespace Ui {
class MainWindow;
Q_OBJECT
public:
- explicit MainWindow(QWidget *parent = 0);
+ explicit MainWindow(const QString& startDir, QWidget *parent = 0);
~MainWindow();
+
private slots:
- void search();
- void up();
- void selectDirectory();
+ void search();
+ void up();
+ void selectDirectory();
private:
QDir::Filters buildFileTypes();
<string>Size (MByte)</string>
</property>
<property name="textAlignment">
- <set>AlignRight|AlignBottom</set>
+ <set>AlignRight|AlignVCenter</set>
</property>
</column>
<column>
<x>0</x>
<y>0</y>
<width>1030</width>
- <height>23</height>
+ <height>26</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
-#-------------------------------------------------
-#
-# Project created by QtCreator 2015-04-02T23:48:19
-#
-#-------------------------------------------------
-
-QT += core gui
-
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-
-TARGET = refind
-TEMPLATE = app
-
-INCLUDEPATH = ../.. /usr/include/c++/4.9
-
-SOURCES += main.cpp\
- mainwindow.cpp \
- ../../base/ReException.cpp \
- ../../base/ReQStringUtil.cpp \
- ../../base/ReLogger.cpp \
- filefinder.cpp
-
-
-HEADERS += mainwindow.hpp \
- ../../base/rebase.hpp \
- filefinder.hpp \
- ../../base/ReQStringUtil.hpp
-
-
-FORMS += mainwindow.ui
+#-------------------------------------------------\r
+#\r
+# Project created by QtCreator 2015-04-02T23:48:19\r
+#\r
+#-------------------------------------------------\r
+\r
+QT += core gui\r
+\r
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets\r
+\r
+TARGET = refind\r
+TEMPLATE = app\r
+\r
+INCLUDEPATH = ../.. /usr/include/c++/4.9\r
+\r
+SOURCES += main.cpp\\r
+ mainwindow.cpp \\r
+ ../../base/ReException.cpp \\r
+ ../../base/ReQStringUtil.cpp \\r
+ ../../base/ReLogger.cpp \\r
+ filefinder.cpp\r
+\r
+\r
+HEADERS += mainwindow.hpp \\r
+ ../../base/rebase.hpp \\r
+ filefinder.hpp \\r
+ ../../base/ReQStringUtil.hpp\r
+\r
+\r
+FORMS += mainwindow.ui\r
buildStandardAppender(logFilePrefix, maxSize, maxCount);
QByteArray sLevel = config->asString(sPrefix + "level", "info");
ReLoggerLevel level = LOG_INFO;
- if (strcasecmp(sLevel.constData(), "error") == 0)
+ if (_strcasecmp(sLevel.constData(), "error") == 0)
level = LOG_ERROR;
- else if (strcasecmp(sLevel, "warning") == 0)
+ else if (_strcasecmp(sLevel, "warning") == 0)
level = LOG_WARNING;
- else if (strcasecmp(sLevel, "debug") == 0)
+ else if (_strcasecmp(sLevel, "debug") == 0)
level = LOG_DEBUG;
setLevel(level);
}
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
#include <errno.h>
#include <assert.h>
+#include <time.h>
+#ifdef __linux__
+#include <unistd.h>
+#else
+#endif
#include <QThread>
#include <QIODevice>
#include <QTextStream>
#include <QtCore/qmath.h>
#include <QTranslator>
#include <QDateTime>
+#include <QDir>
typedef unsigned char uint8_t;
-//typedef qint64 int64_t;
+#if !defined __linux__
+typedef qint64 int64_t;
+#endif
typedef quint64 uint64_t;
typedef qint32 int32_t;
typedef quint32 uint32_t;
typedef QString ReString;
#define RE_UNUSED(x) (void)(x)
+#ifdef __linux__
+#define _strcasecmp strcasecmp
+#else
+#define _strcasecmp _stricmp
+#endif
#include "remodules.hpp"
#include "base/ReByteStorage.hpp"
#include "base/ReCharPtrMap.hpp"