]> gitweb.hamatoma.de Git - reqt/commitdiff
win32 corrections
authorHamatoma <git.tortouse@hm.f-r-e-i.de>
Sun, 12 Apr 2015 22:24:31 +0000 (00:24 +0200)
committerHamatoma <git.tortouse@hm.f-r-e-i.de>
Sun, 12 Apr 2015 22:24:31 +0000 (00:24 +0200)
appl/refind/filefinder.cpp
appl/refind/main.cpp
appl/refind/mainwindow.cpp
appl/refind/mainwindow.hpp
appl/refind/mainwindow.ui
appl/refind/refind.pro
base/ReLogger.cpp
base/rebase.hpp

index 996ee801d7c8fabd2edb3a4e29ade9e9a78fc112..c4262210a73a6bad501673e4615ee6807c7bcd05 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include <QDir>
+#include "base/rebase.hpp"
 #include "mainwindow.hpp"
 #include "filefinder.hpp"
 
index ef96fdf3eff7678d5a3ba29e12fc2a855797746d..c4d1af3ebc9a08d90ceae3dd9d2c80699f206c86 100644 (file)
  */
 
 #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();
index ddbf672433b7a994f01a20d2e45f3d05a50adcba..e2f4529c91f703a18a5d8ac0caeb778d1c0a5c63 100644 (file)
@@ -21,7 +21,7 @@
  *
  * @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),
@@ -29,7 +29,7 @@ MainWindow::MainWindow(QWidget *parent) :
             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()));
@@ -265,11 +265,14 @@ void MainWindow::setStatusMessage(bool error, const QString& message){
  * @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);
+        }
    }
 }
index f742f6919f8059dcae6c445645450db9b5518299..04b0c7b9cdeb4eb3d1ca844a69b8b7f2c42c555c 100644 (file)
 
 #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;
@@ -28,13 +31,14 @@ class MainWindow: public QMainWindow {
    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();
index 213f712486efb32cc5bfaf3d94fd7bfe96042810..252bdec0da368db36a24db37254f3b1f49f3418d 100644 (file)
           <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">
index e1776c0a2d8f7d0370550f97ed45dfb1da614e23..e4ca5205b6c8ffe0da8d8a37bee8ebffed974672 100644 (file)
@@ -1,30 +1,30 @@
-#-------------------------------------------------
-#
-# 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
index 777b0aa5d2aaaed98973e55143e2ee05c196d0ac..62eb4b4a186839370a6b12c304875755718ee79f 100644 (file)
@@ -421,11 +421,11 @@ void ReLogger::buildStandardAppender(ReConfig* config, const char* prefix,
    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);
 }
index cede8e38e3a0f3026e2f5d1ad6cb4f902340268d..2c7ab8596e855988dcb6f16d45dc437925600b15 100644 (file)
 #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;
@@ -40,6 +47,11 @@ typedef qreal real_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"