]> gitweb.hamatoma.de Git - reqt/commitdiff
Temp commit
authorhama <hama@siduction.net>
Wed, 28 Oct 2015 23:00:39 +0000 (00:00 +0100)
committerhama <hama@siduction.net>
Wed, 28 Oct 2015 23:00:39 +0000 (00:00 +0100)
appl/reidos/FileCommander.cpp
appl/reidos/FileCommander.hpp
appl/reidos/idosmain.cpp
appl/reidos/idosmain.hpp
appl/reidos/main.cpp
base/ReLogger.cpp

index a1bb7044c9f9c263dab834dd26469430712c82d4..9132c6c61086835e672561786e83644762de6e09 100644 (file)
@@ -18,10 +18,43 @@ FileCommander::FileCommander(IDosMain* main) :
        m_bottomFS(NULL),
        m_activeFS(NULL),
        m_inactiveFS(NULL),
-       m_logger(new ReMemoryLogger)
+       m_logger(new ReMemoryLogger()),
+       m_topIsActive(true)
 {
 }
 
+/**
+ * Sets the active directory.
+ *
+ * @param path the path to set
+ * @return             <code>true</code>: directory has changed
+ */
+bool FileCommander::changeDirectory(const QString& path){
+       bool rc = false;
+       QString current = m_activeFS->directory();
+       if (m_activeFS->setDirectory(path) == ReFileSystem::EC_SUCCESS){
+               rc = current != m_activeFS->directory();
+       }
+       return rc;
+}
+
+/**
+ * Fills the table with the file data of the active filesystem.
+ *
+ * @param table        OUT: table to fill
+ */
+void FileCommander::fillTable(QTableWidget* table)
+{
+       ReFileMetaDataList list;
+       ReFileSystem* fs = m_topIsActive ? m_topFS : m_bottomFS;
+       fs->listInfos(m_topIsActive ? m_topMatcher : m_bottomMatcher, list);
+       ReFileMetaDataList::const_iterator it;
+       table->setCount(list.length());
+       for (it = list.cbegin(); it != list.cend(); ++list){
+               table->
+       }
+}
+
 /**
  * Sets a filesystem to a filesystem given by its url.
  *
index 5df917b799f147e6f487a49ffc96ba9aca83ac67..87c949e787e1bd3ec041b6f6c74623fc8965aa51 100644 (file)
@@ -14,17 +14,22 @@ class IDosMain;
 
 class FileCommander
 {
+       enum TableColumns {
+          TC_EXT, TC_SIZE, TC_MODIFIED, TC_NODE,
+       };
 public:
        FileCommander(IDosMain* m_main);
 public:
        void buildFs(const QString& url, ReFileSystem& filesystem);
+       bool changeDirectory(const QString& path);
+       void fillTable(QTableWidget* table);
 protected:
        IDosMain* m_main;
        ReFileSystem* m_topFS;
        ReFileSystem* m_bottomFS;
-       ReFileSystem* m_activeFS;
-       ReFileSystem* m_inactiveFS;
+       ReIncludeExcludeMatcher m_topMatcher;
        ReLogger* m_logger;
+       bool m_topIsActive;
 };
 
 #endif // FILECOMMANDER_HPP
index e76926fd0ebc70626a7e916613c6996bff6d0236..a487c71c7d2fa44fdd38b9eff30229771db72090 100644 (file)
@@ -17,23 +17,31 @@ IDosMain::IDosMain(const QString& startDir, const QString& homeDir,
        ui(new Ui::IDosMain),
        m_statusMessage(NULL),
        m_homeDir(homeDir)
-       //m_storageFile(),
+  //m_storageFile(),
 {
        ui->setupUi(this);
        initializeHome();
        m_statusMessage = new QLabel(tr("Welcome at reidos"));
+       if (!startDir.isEmpty())
+          ui->comboBoxPathTop->setCurrentText(startDir);
+       connect(ui->comboBoxPathTop, SIGNAL(keyPress(QKeyEvent*)), SLOT(keyPressEvent(QKeyEvent*)));
+       connect(ui->comboBoxPathBottom, SIGNAL(keyPress(QKeyEvent*)), SLOT(keyPressEvent(QKeyEvent*)));
+       ui->tableWidgetTop->setColumnWidth(TC_EXT, 40);
+       ui->tableWidgetTop->setColumnWidth(TC_SIZE, 125);
+       ui->tableWidgetTop->setColumnWidth(TC_MODIFIED, 175);
+       ui->tableWidgetBottom->setColumnWidth(TC_EXT, 40);
+       ui->tableWidgetBottom->setColumnWidth(TC_SIZE, 125);
+       ui->tableWidgetBottom->setColumnWidth(TC_MODIFIED, 175);
 }
 
+/**
+ * Destructor.
+ */
 IDosMain::~IDosMain()
 {
        delete ui;
 }
 
-void IDosMain::error(const QString& message)
-{
-       m_statusMessage->setText("+++ " + message);
-}
-
 /**
  * initializeHomeializes the program home directory.
  */
@@ -55,6 +63,22 @@ void IDosMain::initializeHome(){
    restoreState();
 }
 
+/**
+ * Handles the key press event.
+ *
+ * @param event
+ */
+void IDosMain::keyPress(QKeyEvent* event){
+       if (event->key() == Qt::Key_Return){
+               QComboBox* box = m_topIsActive ? ui->comboBoxPathTop : ui->comboBoxPatternBottom;
+               if (changeDirectory(box->currentText())){
+                       comboText(box);
+                       fillTable(m_topIsActive ? ui->tableWidgetTop : ui->tableWidgetBottom);
+               }
+       }
+
+}
+
 /**
  * Writes a text to the status line.
  *
index 7aa86126c3606aa4064527885efff631204c6e86..feb34262d7e64afc90c44be0a813dfa80fe61642 100644 (file)
@@ -32,12 +32,15 @@ protected:
        void initializeHome();
        void restoreState();
        void saveState();
+protected:
+signals:
+       void keyPress(QKeyEvent* event);
+
 private:
        Ui::IDosMain *ui;
        QLabel* m_statusMessage;
        QString m_homeDir;
        QString m_storageFile;
-       ReLogger* m_logger;
 };
 
 #endif // IDOSMAIN_HPP
index 4010211f794f33a1e531e63111f6ce66de02f1a3..055ec2ee03caea27b34057e92cdd6863a4e05db6 100644 (file)
@@ -13,8 +13,9 @@
 int main(int argc, char *argv[])
 {
        QApplication a(argc, argv);
-       QString startDir;
-       QString homeDir;
+       QString startDir = argc > 1 ? argv[1] : "";
+       QString homeDir = argc > 2 ? argv[2] : "";
+
        IDosMain w(startDir, homeDir);
        w.show();
 
index 955963ff1dabb061b94837f659e1dd5d545fe29e..234bc6563ce292b14b7769691bf1583ccd817977 100644 (file)
@@ -62,8 +62,9 @@ void ReLogger::destroyGlobalLogger() {
  */
 ReAppender::ReAppender(const QByteArray& name) :
                m_name(name),
-               m_level(LOG_INFO) {
-
+               m_level(LOG_INFO),
+               m_autoDelete(false)
+{
 }
 /**
  * @brief Destructor.