m_logger(logger),
m_perspectives(this),
m_timerRuns(false),
- m_timer(this){
+ m_timer(this),
+ m_delayedStorage(NULL){
setLayout(new QVBoxLayout);
if (workspace == NULL)
workspace = QDir::homePath().toUtf8();
m_perspectives.addPerspective(mainPerspective);
m_perspectives.change(mainPerspective->name());
m_perspectives.addPerspective(new ProjectPerspective(proj, this));
+ m_delayedStorage = new ReDelayedStorage(m_workspace->historyFile())
}
/**
*/
void MainWindow::geometryChanged(int value){
ReUseParameter(value);
- if (! m_timer.isActive()){
- m_timer.start(5000);
- }
+ m_delayedStorage->storeWindow(this);
}
void MainWindow::timeout(){
- ReSettings
}
/**
public slots:
void open();
void geometryChanged(int value);
+protected slots:
+ void timeout();
private:
Workspace* m_workspace;
ReLogger* m_logger;
PerspectiveList m_perspectives;
bool m_timerRuns;
QTimer m_timer;
+ ReDelayedStorage* m_delayedStorage;
};
#endif // MAINWINDOW_HPP
TARGET = ReEditor
TEMPLATE = app
-
+PRECOMPILED_HEADER = base/rebase.hpp
INCLUDEPATH += ../..
SOURCES += \
../../base/rebase.hpp \
../../gui/regui.hpp \
../../gui/ReEdit.hpp \
+ ../../gui/ReStateStorage.hpp \
+ ../../gui/ReSettings.hpp \
../../base/ReStringUtils.hpp \
../../base/ReQStringUtils.hpp \
../../base/ReException.hpp \
--- /dev/null
+/*
+ * Licence:
+ * You can use and modify this file without any restriction.
+ * There is no warranty.
+ * You also can use the licence from http://www.wtfpl.net/.
+ * The original sources can be found on https://github.com/republib.
+*/
+
+
+#include "idosmain.hpp"
+#include "ui_idosmain.h"
+
+IDosMain::IDosMain(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::IDosMain)
+{
+ ui->setupUi(this);
+}
+
+IDosMain::~IDosMain()
+{
+ delete ui;
+}
--- /dev/null
+/*
+ * Licence:
+ * You can use and modify this file without any restriction.
+ * There is no warranty.
+ * You also can use the licence from http://www.wtfpl.net/.
+ * The original sources can be found on https://github.com/republib.
+*/
+
+
+#ifndef IDOSMAIN_HPP
+#define IDOSMAIN_HPP
+
+#include <QMainWindow>
+
+namespace Ui {
+class IDosMain;
+}
+
+class IDosMain : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit IDosMain(QWidget *parent = 0);
+ ~IDosMain();
+
+private:
+ Ui::IDosMain *ui;
+};
+
+#endif // IDOSMAIN_HPP
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>IDosMain</class>
+ <widget class="QMainWindow" name="IDosMain">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>787</width>
+ <height>590</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>IDosMain</string>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QWidget" name="">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QComboBox" name="comboBoxPathTop">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="toolButtonHistoryTop">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="toolButtonUpTop">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="toolButtonRootTop">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTableWidget" name="tableWidgetTop">
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Size</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Modified</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Attributes</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="layoutWidget">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QComboBox" name="comboBoxPathBottom">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="toolButtonHistoryBottom">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="toolButtonUpBottom">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="toolButtonRootBottom">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTableWidget" name="tableWidgetTop_2">
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Size</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Modified</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Attributes</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>787</width>
+ <height>35</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QToolBar" name="mainToolBar">
+ <attribute name="toolBarArea">
+ <enum>TopToolBarArea</enum>
+ </attribute>
+ <attribute name="toolBarBreak">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ <widget class="QStatusBar" name="statusBar"/>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+/*
+ * Licence:
+ * You can use and modify this file without any restriction.
+ * There is no warranty.
+ * You also can use the licence from http://www.wtfpl.net/.
+ * The original sources can be found on https://github.com/republib.
+*/
+
+
+#include "idosmain.hpp"
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ IDosMain w;
+ w.show();
+
+ return a.exec();
+}
--- /dev/null
+#-------------------------------------------------
+#
+# Project created by QtCreator 2015-09-14T18:00:57
+#
+#-------------------------------------------------
+
+QT += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = reidos
+TEMPLATE = app
+
+INCLUDEPATH += . ../..
+
+SOURCES += main.cpp\
+ ../../gui/ReEdit.cpp \
+ ../../gui/ReStateStorage.cpp \
+ ../../gui/ReSettings.cpp \
+ ../../gui/ReFileTree.cpp \
+ ../../base/ReFile.cpp \
+ ../../os/ReFileSystem.cpp \
+ ../../base/ReLogger.cpp \
+ ../../base/ReQStringUtils.cpp \
+ ../../base/ReFileUtils.cpp \
+ ../../base/ReException.cpp \
+ idosmain.cpp \
+ main.cpp
+
+HEADERS += ../../base/rebase.hpp \
+ ../../gui/regui.hpp \
+ ../../gui/ReEdit.hpp \
+ ../../gui/ReStateStorage.hpp \
+ ../../gui/ReSettings.hpp \
+ ../../base/ReStringUtils.hpp \
+ ../../base/ReQStringUtils.hpp \
+ ../../base/ReException.hpp \
+ ../../os/reos.hpp \
+ idosmain.hpp
+
+FORMS += idosmain.ui
#include <QTranslator>
#include <QDateTime>
#include <QDir>
+#include <QTimer>
+#include <QWidget>
+#include <QMainWindow>
+#include <QComboBox>
+#include <QComboBox>
+
typedef unsigned char uint8_t;
#if !defined __linux__
typedef qint64 int64_t;
property->m_value = value;
}
+/**
+ * Returns the name of the history file.
+ * @return the full name of the history file
+ */
+const QString& ReSettings::fileHistory() const
+{
+ return m_fileHistory;
+}
+
/**
* Returns a history item as a list.
*
*
* @param delay time between first change of setting and storage in seconds
*/
-ReDelayedStorage::ReDelayedStorage(const QString& file, int delay) :
+ReDelayedStorage::ReDelayedStorage(const QString& file, ReLogger* logger,
+ int delay) :
m_timer(NULL),
m_list(),
m_delay(delay),
- m_file(file){
+ m_file(file),
+ m_logger(logger){
m_timer.setSingleShot(true);
- QObject::connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
+ connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
}
/**
- * Tests whether a given widget is in the internal list.
- *
- * @param widget the widget to search
- * @return <code>true</code>: the widget is in the list
+ * Destructor.
*/
-bool ReDelayedStorage::contains(const QWidget* widget){
- QList<ObjInfo*>::const_iterator;
- bool rc = false;
- for (it = m_list.cbegin(); ! rc && it != m_list.cend(); ++it){
- ObjInfo* info = *it;
- if (info->m_widget == widget)
- rc = true;
- }
- return rc;
+ReDelayedStorage::~ReDelayedStorage()
+{
+
}
/**
* @return -1: not found<br>
* otherwise: the index in <code>m_list</code>
*/
-QWidget*ReDelayedStorage::indexOf(const QWidget* widget)
+int ReDelayedStorage::indexOf(const QWidget* widget) const
{
int rc = -1;
for (int ix = 0; rc < 0 && ix < m_list.size(); ix++)
*
* @param window the window to store
*/
-void ReDelayedStorage::storeWindow(QMainWindow* window)
+void ReDelayedStorage::storeWindow(const QMainWindow* window)
{
int ix = indexOf(window);
if (ix < 0){
ObjInfo* info = new ObjInfo;
info->m_type = OT_WINDOW;
- info->m_widget = widget;
+ info->m_widget = window;
m_list.append(info);
if (! m_timer.isActive()){
- timer.start(m_delay*1000);
+ m_timer.start(m_delay*1000);
}
}
}
*/
void ReDelayedStorage::timeout()
{
- ReStateStorage storage(m_file);
+ ReStateStorage storage(m_file, m_logger);
storage.initForRead();
for (int ix = 0; ix < m_list.size(); ix++){
ObjInfo* info = m_list.at(ix);
#ifndef STORAGE_HPP
#define STORAGE_HPP
-#include <QTimer>
+#ifndef REBASE_HPP
+#include "base/rebase.hpp"
+#endif
+
enum RePropertyType {
PT_UNDEF,
PT_INT,
RePropertyType m_type;
const char* m_limits;
};
-
-class ReDelayedStorage{
+class ReLogger;
+class QMainWindow;
+class ReDelayedStorage : protected QObject{
Q_OBJECT
enum ObjType {
OT_UNDEF,
const QWidget* m_widget;
} ObjInfo;
public:
- ReDelayedStorage(const QString& file, int delay = 5);
+ ReDelayedStorage(const QString& file, ReLogger* m_logger, int delay = 5);
+ virtual ~ReDelayedStorage();
public:
void storeWindow(const QMainWindow* window);
public:
void timeout();
private:
- int indexOf(const QWidget* widget);
+ int indexOf(const QWidget* widget) const;
private:
QTimer m_timer;
QList<ObjInfo*> m_list;
int m_delay;
QString m_file;
+ ReLogger* m_logger;
};
class ReSettings {
int maxEntries);
bool boolValue(const char* name);
void changeValue(const char* name, const QString& value);
+ const QString& fileHistory() const;
QStringList& historyAsList(const char* key, QStringList& list,
const char* form = NULL);
void insertProperty(ReProperty* property);
QString topOfHistory(const char* key, const QString& defaultValue = "");
void writeSettings();
+
protected:
QString m_prefix;
QString m_path;
--- /dev/null
+/*
+ * ReTraverser.cpp
+ *
+ * License: Public Domain
+ * You can use and modify this file without any restriction.
+ * Do what you want.
+ * No warranties and disclaimer of any damages.
+ * You also can use this license: http://www.wtfpl.net
+ * The latest sources: https://github.com/republib
+ */
+
+#include "base/rebase.hpp"
+#include "os/reos.hpp"
+
+
+/**
+ * Constructor.
+ *
+ * @param name the name of the filesystem
+ */
+ReFileSystem::ReFileSystem(const QString& name) :
+ m_name(name), m_writeable(false)
+{
+
+}
+
+/**
+ * Destructor.
+ */
+ReFileSystem::~ReFileSystem()
+{
+
+}
+
+bool ReFileSystem::getWriteable() const
+{
+ return m_writeable;
+}
+
+void ReFileSystem::setWriteable(bool writeable)
+{
+ m_writeable = writeable;
+}
+
+/**
+ * Constructor.
+ */
+ReLinuxFS::ReLinuxFS(const QString& basePath) :
+ m_path(basePath),
+ m_currentPath(basePath),
+ m_dir(basePath)
+{
+
+}
+
+/**
+ * Changes the current directory of the filesystem.
+ *
+ * @param path the new current directory
+ * @return 0: success<br>
+ * EC_PATH_NOT_FOUND directory does not exist<br>
+ * EC_NOT_ACCESSIBLE parent not readable
+ */
+ReFileSystem::ErrorCode ReLinuxFS::setDirectory(const QString& path)
+{
+ ErrorCode rc = m_dir.setCurrent(path) ? EC_SUCCESS : EC_PATH_NOT_FOUND;
+ m_currentPath = m_dir.absolutePath();
+ return rc;
+}
+
+/**
+ * Returns the name of the current directory.
+ *
+ * @return the name of the current directory
+ */
+const QString&ReLinuxFS::directory() const
+{
+ return m_currentDir;
+}
+
+/**
+ * Returns a list of the file infos of the current directory.
+ *
+ * @param patterns only files matching these patterns will be in the result.
+ * Can contain wildcard '*' (for any string)
+ * @return a list of the files matching the patterns
+ */
+QList<ReFileMetaData*> ReLinuxFS::listInfos(const QString& pattern)
+{
+ QList<ReFileMetaData*> rc;
+ m_dir.setNameFilters(patterns);
+ QFileInfoList list = m_dir.entryInfoList();
+ QFileInfoList::const_iterator it;
+ for (it = list.cbegin(); it != list.cend(); it++){
+ const QFileInfo& info = *it;
+ ReFileMetaData* meta = new ReFileMetaData(info.fileName());
+
+ }
+}
+
--- /dev/null
+/*
+ * ReFileSystem.hpp
+ *
+ * License: Public Domain
+ * You can use and modify this file without any restriction.
+ * Do what you want.
+ * No warranties and disclaimer of any damages.
+ * You also can use this license: http://www.wtfpl.net
+ * The latest sources: https://github.com/republib
+ */
+
+#ifndef OS_REFILESYSTEM_HPP_
+#define OS_REFILESYSTEM_HPP_
+
+class ReFileMetaData {
+public:
+ FileMetaData(const QString& node);
+ virtual ~FileMetaData();
+public:
+ QString m_node;
+ QDateTime m_modified;
+ QDateTime m_created;
+ int16_t m_owner;
+ int16_t m_group;
+ mode_t m_mode;
+};
+
+class ReFileSystem {
+ enum ErrorCode {
+ EC_SUCCESS,
+ EC_PATH_NOT_FOUND,
+ EC_NOT_ACCESSIBLE,
+ };
+
+public:
+ ReFileSystem(const QString& name);
+ virtual ~ReFileSystem();
+public:
+ /** Changes the current directory of the filesystem.
+ * @param path the new current directory
+ * @return 0: success<br>
+ * EC_PATH_NOT_FOUND directory does not exist<br>
+ * EC_NOT_ACCESSIBLE parent not readable
+ */
+ virtual ErrorCode setDirectory(const QString& path) = 0;
+ /** Returns the name of the current directory.
+ * @return the name of the current directory
+ */
+ virtual const QString& directory() const = 0;
+ /** Returns a list of the file infos of the current directory.
+ * @param patterns only files matching these patterns will be in the result
+ * Can contain wildcard '*' (for any string)
+ * @return a list of the files matching the patterns
+ */
+ virtual QList<ReFileMetaData*> listInfos(const QStringList& patterns) = 0;
+public:
+ bool getWriteable() const;
+ void setWriteable(bool writeable);
+
+protected:
+ QString m_name;
+ QString m_directory;
+ bool m_writeable;
+};
+
+class ReLinuxFS : public ReFileSystem {
+public:
+ ReLinuxFS(const QString& basePath);
+ virtual ~ReLinuxFS();
+ // ReFileSystem interface
+public:
+ ErrorCode setDirectory(const QString& path);
+ const QString& directory() const;
+ QList<ReFileMetaData*> listInfos(const QStringList& patterns);
+protected:
+ QString m_basePath;
+ QString m_currentPath;
+ QDir m_dir;
+};
+
+#endif /* OS_REFILESYSTEM_HPP_ */
#include "os/ReDirTools.hpp"
#include "net/renet.hpp"
#include "os/ReRemoteDir.hpp"
+#include "os/ReFileSystem.hpp"
#endif /* OS_REOS_HPP_ */