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.
*
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
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.
*/
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 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
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();
*/
ReAppender::ReAppender(const QByteArray& name) :
m_name(name),
- m_level(LOG_INFO) {
-
+ m_level(LOG_INFO),
+ m_autoDelete(false)
+{
}
/**
* @brief Destructor.