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);
- QString dir(ui->comboBoxPathTop->currentText());
+ ui->fileTableTop->comboBoxPath->setCurrentText(startDir);
+ ui->fileTableTop->fileSystem = new ReLocalFileSystem("/", m_logger);
+ ui->fileTableTop->fillTable();
+ ui->fileTableBottom->fileSystem = new ReLocalFileSystem("/", m_logger);
+ ui->fileTableBottom->fillTable();
+ QString dir(ui->fileTableTop->comboBoxPath->currentText());
if (dir.isEmpty())
dir = startDir;
if (dir.isEmpty())
dir = QDir::homePath();
changeDirectory(dir);
- fillTable(ui->tableWidgetTop);
}
/**
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.
void IDosMain::restoreState(){
ReStateStorage storage(m_storageFile, m_logger);
storage.setForm("main");
- storage.restore(ui->comboBoxPathTop, "comboBoxPathTop", true);
- storage.restore(ui->comboBoxPatternTop, "comboBoxPatternTop", false);
- storage.restore(ui->comboBoxPathBottom, "comboBoxPathBottom", true);
- storage.restore(ui->comboBoxPatternBottom, "comboBoxPatternBottom", false);
-
+ storage.restore(ui->fileTableTop->comboBoxPath, "comboBoxPathTop", true);
+ storage.restore(ui->fileTableTop->comboBoxPatterns, "comboBoxPatternTop", false);
+ storage.restore(ui->fileTableBottom->comboBoxPath, "comboBoxPathBottom", true);
+ storage.restore(ui->fileTableBottom->comboBoxPatterns, "comboBoxPatternBottom", false);
storage.close();
}
void IDosMain::saveState(){
ReStateStorage storage(m_storageFile, m_logger);
storage.setForm("main");
- storage.store(ui->comboBoxPathTop, "comboBoxPathTop");
- storage.store(ui->comboBoxPatternTop, "comboBoxPatternTop");
- storage.store(ui->comboBoxPathBottom, "comboBoxPathBottom");
- storage.store(ui->comboBoxPatternBottom, "comboBoxPatternBottom");
+ storage.store(ui->fileTableTop->comboBoxPath, "comboBoxPathTop");
+ storage.store(ui->fileTableTop->comboBoxPatterns, "comboBoxPatternTop");
+ storage.store(ui->fileTableBottom->comboBoxPath, "comboBoxPathBottom");
+ storage.store(ui->fileTableBottom->comboBoxPatterns, "comboBoxPatternBottom");
storage.close();
}
void restoreState();
void saveState();
protected slots:
- void keyPress(QKeyEvent* event);
private:
Ui::IDosMain *ui;
<string>IDosMain</string>
</property>
<widget class="QWidget" name="centralWidget">
- <layout class="QVBoxLayout" name="verticalLayout_3">
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <widget class="QWidget" name="layoutWidget">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QPushButton" name="pushButtonDevice">
- <property name="maximumSize">
- <size>
- <width>25</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Select the device of the upper region</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="comboBoxPathBottom">
- <property name="toolTip">
- <string>The path of the lower region</string>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButtonUpBottom">
- <property name="maximumSize">
- <size>
- <width>25</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Change to the parent directory of the lower region</string>
- </property>
- <property name="text">
- <string>^</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="comboBoxPatternBottom">
- <property name="maximumSize">
- <size>
- <width>150</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>A pattern list for visible file types, e.g. "*.png,*.jpg,-test*", for the lower region</string>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButtonRootBottom">
- <property name="maximumSize">
- <size>
- <width>25</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Change to the root directory of the lower region</string>
- </property>
- <property name="text">
- <string>/</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QTableWidget" name="tableWidgetBottom">
- <property name="toolTip">
- <string>Display the files of the lower region (filtered by the pattern)</string>
- </property>
- <attribute name="horizontalHeaderStretchLastSection">
- <bool>true</bool>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>true</bool>
- </attribute>
- <column>
- <property name="text">
- <string>Modified</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Size</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Type</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">
- <property name="spacing">
- <number>0</number>
- </property>
- <item>
- <widget class="QPushButton" name="pushButtonDeviceTop">
- <property name="maximumSize">
- <size>
- <width>25</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Select the device of the lower region</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="comboBoxPathTop">
- <property name="toolTip">
- <string>The path of the upper region</string>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButtonUpTop">
- <property name="maximumSize">
- <size>
- <width>25</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Change to the parent directory of the upper region</string>
- </property>
- <property name="text">
- <string>^</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="comboBoxPatternTop">
- <property name="maximumSize">
- <size>
- <width>150</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>A pattern list for visible file types, e.g. "*.png,*.jpg,-test*", for the upper region"</string>
- </property>
- <property name="editable">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="pushButtonRootTop">
- <property name="maximumSize">
- <size>
- <width>25</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="toolTip">
- <string>Change to the root directory of the upper region</string>
- </property>
- <property name="text">
- <string>/</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QTableWidget" name="tableWidgetTop">
- <property name="toolTip">
- <string>Display the files of the upper region (filtered by the pattern)</string>
- </property>
- <attribute name="horizontalHeaderStretchLastSection">
- <bool>true</bool>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>true</bool>
- </attribute>
- <column>
- <property name="text">
- <string>Modified</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Size</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Type</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Name</string>
- </property>
- </column>
- </widget>
- </item>
- </layout>
- </widget>
+ <widget class="ReFileTable" name="fileTableTop" native="true"/>
+ <widget class="ReFileTable" name="fileTableBottom" native="true"/>
</widget>
</item>
</layout>
<x>0</x>
<y>0</y>
<width>787</width>
- <height>20</height>
+ <height>35</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
- <string>File</string>
+ <string>Fi&le</string>
</property>
<addaction name="actionSave_Configuration"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
- <string>Edit</string>
+ <string>Edi&t</string>
</property>
<addaction name="actionCreate_file"/>
<addaction name="actionCreate_directory"/>
</widget>
<widget class="QMenu" name="menuPlaces">
<property name="title">
- <string>Places</string>
+ <string>&Places</string>
</property>
<addaction name="actionHome"/>
<addaction name="actionTemp"/>
</widget>
<widget class="QMenu" name="menuBookmarks">
<property name="title">
- <string>Bookmarks</string>
+ <string>Book&marks</string>
</property>
<addaction name="separator"/>
<addaction name="actionAdd_bookmark_2"/>
</widget>
<widget class="QMenu" name="menuProgramms">
<property name="title">
- <string>Programms</string>
+ <string>P&rogramms</string>
</property>
<addaction name="actionConfigure_programs"/>
<addaction name="actionEdit_programs"/>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionSave_Configuration">
<property name="text">
- <string>Save configuration</string>
+ <string>&Save configuration</string>
</property>
</action>
<action name="actionExit">
<property name="text">
- <string>Exit</string>
+ <string>&Exit</string>
</property>
</action>
<action name="actionSelect_Different_Files">
<property name="text">
- <string>Select different files</string>
+ <string>&Select different files</string>
</property>
</action>
<action name="actionSelect_equal_files">
<property name="text">
- <string>Select equal files</string>
+ <string>Select &equal files</string>
</property>
</action>
<action name="actionAdd_bookmark">
</action>
<action name="actionEdit_bookmark">
<property name="text">
- <string>Edit bookmark</string>
+ <string>&Edit bookmark</string>
</property>
</action>
<action name="actionAdd_bookmark_2">
<property name="text">
- <string>Add bookmark</string>
+ <string>&Add bookmark</string>
</property>
</action>
<action name="actionConfigure_programs">
<property name="text">
- <string>Configure programs</string>
+ <string>&Configure programs</string>
</property>
</action>
<action name="actionEdit_programs">
<property name="text">
- <string>Edit programs</string>
+ <string>&Edit programs</string>
</property>
</action>
<action name="actionAbout">
<property name="text">
- <string>About</string>
+ <string>&About</string>
</property>
</action>
<action name="actionOptions">
<property name="text">
- <string>Options</string>
+ <string>&Options</string>
</property>
</action>
<action name="actionHome">
<property name="text">
- <string>Home</string>
+ <string>&Home</string>
</property>
</action>
<action name="actionTemp">
<property name="text">
- <string>Temp</string>
+ <string>&Temp</string>
</property>
</action>
<action name="actionCreate_file">
<property name="text">
- <string>Create file</string>
+ <string>&Create file</string>
</property>
</action>
<action name="actionCreate_directory">
<property name="text">
- <string>Create directory</string>
+ <string>C&reate directory</string>
</property>
</action>
<action name="actionDelete">
<property name="text">
- <string>Delete</string>
+ <string>&Delete</string>
</property>
</action>
<action name="actionCopy">
<property name="text">
- <string>Copy</string>
+ <string>Co&py</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>ReFileTable</class>
+ <extends>QWidget</extends>
+ <header location="global">guiwidget/reguiwidget.hpp</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections/>
</ui>
../../base/ReException.cpp \
idosmain.cpp \
main.cpp \
- FileCommander.cpp
+ FileCommander.cpp \
+ ../../guiwidget/ReFileTable.cpp
HEADERS += ../../base/rebase.hpp \
../../gui/regui.hpp \
../../os/reos.hpp \
idosmain.hpp \
FileCommander.hpp \
- reidos.hpp
+ reidos.hpp \
+ ../../guiwidget/ReFileTable.hpp \
+ ../../guiwidget/reguiwidget.hpp
FORMS += idosmain.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 "guiwidget/reguiwidget.hpp"
+
+ReFileTable::ReFileTable(QWidget *parent) :
+ QWidget(parent),
+ mainLayout(new QVBoxLayout(this)),
+ horizontalLayout(new QHBoxLayout(this)),
+ comboBoxPath(new QComboBox(this)),
+ comboBoxPatterns(new QComboBox(this)),
+ pushButtonDevice(new QPushButton("...", this)),
+ pushButtonUp(new QPushButton("^", this)),
+ pushButtonRoot(new QPushButton("/", this)),
+ tableWidget(new QTableWidget(this)),
+ fileSystem(NULL),
+ matcher("*"),
+ m_dateFormat("yyyy.MM.dd hh:mm:ss")
+{
+ setLayout(mainLayout);
+ mainLayout->setSpacing(0);
+ mainLayout->addLayout(horizontalLayout);
+ horizontalLayout->addWidget(pushButtonDevice);
+ pushButtonDevice->setMaximumWidth(25);
+ horizontalLayout->addWidget(comboBoxPath);
+ comboBoxPath->setEditable(true);
+ horizontalLayout->addWidget(pushButtonUp);
+ pushButtonUp->setMaximumWidth(25);
+ horizontalLayout->addWidget(comboBoxPatterns);
+ horizontalLayout->setSpacing(0);
+ comboBoxPatterns->setEditable(true);
+ comboBoxPatterns->setMaximumWidth(150);
+ horizontalLayout->addWidget(pushButtonRoot);
+ pushButtonRoot->setMaximumWidth(25);
+ mainLayout->addWidget(tableWidget);
+ QStringList labels;
+ labels.append(tr("Type"));
+ labels.append(tr("Modified"));
+ labels.append(tr("Size"));
+ labels.append(tr("Name"));
+ tableWidget->setColumnCount(COL_COUNT);
+ tableWidget->setColumnWidth(TYPE, 60);
+ tableWidget->setColumnWidth(SIZE, 125);
+ tableWidget->setColumnWidth(MODIFIED, 175);
+ connect(this, SIGNAL(keyPress(QKeyEvent*)), SLOT(keyPressEvent(QKeyEvent*)));
+
+ tableWidget->setHorizontalHeaderLabels(labels);
+ tableWidget->horizontalHeader()->setStretchLastSection(true);
+}
+
+/**
+ * Destructor.
+ */
+ReFileTable::~ReFileTable()
+{
+
+}
+
+/**
+ * Fills the table with the file data of the filesystem.
+ *
+ * @param table OUT: table to fill
+ */
+void ReFileTable::fillTable()
+{
+ if (fileSystem != NULL){
+ ReFileMetaDataList list;
+ fileSystem->listInfos(matcher, list);
+ ReFileMetaDataList::const_iterator it;
+ tableWidget->setRowCount(list.length());
+ int row = 0;
+ for (it = list.cbegin(); it != list.cend(); ++it){
+ // TC_EXT, TC_SIZE, TC_MODIFIED, TC_NODE
+ QString modified = it->m_modified.toString(m_dateFormat);
+ QString size = QString::number(it->m_size);
+ QString ext = ReFileUtils::extensionOf(it->m_node);
+ if (tableWidget->item(row, 0) == NULL){
+ tableWidget->setItem(row, NAME, new QTableWidgetItem(it->m_node));
+ tableWidget->setItem(row, MODIFIED, new QTableWidgetItem(modified));
+ tableWidget->setItem(row, TYPE, new QTableWidgetItem(ext));
+ QTableWidgetItem* item = new QTableWidgetItem(size);
+ item->setTextAlignment(Qt::AlignRight);
+ tableWidget->setItem(row, SIZE, item);
+ } else {
+ tableWidget->item(row, NAME)->setText(it->m_node);
+ tableWidget->item(row, MODIFIED)->setText(modified);
+ tableWidget->item(row, TYPE)->setText(ext);
+ tableWidget->item(row, SIZE)->setText(size);
+ }
+ row++;
+ }
+ }
+}
+
+/**
+ * Handles the key press event.
+ *
+ * @param event
+ */
+void ReFileTable::keyPress(QKeyEvent* event){
+ if (event->key() == Qt::Key_Return){
+ /*
+ if (changeDirectory(box->currentText())){
+ comboText(box);
+ fillTable(m_topIsActive ? ui->tableWidgetTop : ui->tableWidgetTop);
+ }
+ */
+ }
+
+}
+
+
--- /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 REFILETABLE_HPP
+#define REFILETABLE_HPP
+#ifndef REGUIWIDGET_HPP
+// needed for moc_ReFileTable.cpp
+#include "guiwidget/reguiwidget.hpp"
+#endif
+class ReFileTable : public QWidget
+{
+public:
+ enum { TYPE, MODIFIED, SIZE, NAME, COL_COUNT };
+ Q_OBJECT
+public:
+ explicit ReFileTable(QWidget *parent = 0);
+ ~ReFileTable();
+signals:
+
+public slots:
+
+public:
+ void fillTable();
+ void keyPress(QKeyEvent* event);
+
+protected:
+ QVBoxLayout* mainLayout;
+ QHBoxLayout* horizontalLayout;
+ QString m_dateFormat;
+public:
+ QComboBox* comboBoxPath;
+ QComboBox* comboBoxPatterns;
+ QPushButton* pushButtonDevice;
+ QPushButton* pushButtonUp;
+ QPushButton* pushButtonRoot;
+ QTableWidget* tableWidget;
+ ReFileSystem* fileSystem;
+ ReIncludeExcludeMatcher matcher;
+};
+
+#endif // REFILETABLE_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.
+*/
+
+
+#ifndef REGUIWIDGET_HPP
+#define REGUIWIDGET_HPP
+#ifndef REBASE_HPP
+#include "base/rebase.hpp"
+#endif
+#ifndef REGUI_HPP
+#include "gui/regui.hpp"
+#endif
+#ifndef OS_REOS_HPP_
+#include "os/reos.hpp"
+#endif
+#include "QWidget"
+#include "QComboBox"
+#include "QPushButton"
+#include "QHBoxLayout"
+#include "QVBoxLayout"
+#include "QTableWidget"
+#include "QHeaderView"
+#include "QKeyEvent"
+#include "guiwidget/ReFileTable.hpp"
+#endif // REGUIWIDGET_HPP
+