From 64bd753b474c998ba29cbd6e7cbecb748d219975 Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Thu, 15 Aug 2019 17:28:04 +0200 Subject: Initial import --- QRema.pro | 40 ++++ QRema.pro.user | 596 +++++++++++++++++++++++++++++++++++++++++++++++++++ data/ui/qremamain.ui | 123 +++++++++++ main.cpp | 11 + src/qremamain.cpp | 78 +++++++ src/qremamain.h | 35 +++ 6 files changed, 883 insertions(+) create mode 100644 QRema.pro create mode 100644 QRema.pro.user create mode 100644 data/ui/qremamain.ui create mode 100644 main.cpp create mode 100644 src/qremamain.cpp create mode 100644 src/qremamain.h diff --git a/QRema.pro b/QRema.pro new file mode 100644 index 0000000..74d40e1 --- /dev/null +++ b/QRema.pro @@ -0,0 +1,40 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2019-08-14T17:41:42 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = QRema +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +CONFIG += c++11 + +SOURCES += \ + main.cpp \ + src/qremamain.cpp + +HEADERS += \ + src/qremamain.h + +FORMS += \ + data/ui/qremamain.ui + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/QRema.pro.user b/QRema.pro.user new file mode 100644 index 0000000..7873cf0 --- /dev/null +++ b/QRema.pro.user @@ -0,0 +1,596 @@ + + + + + + EnvironmentId + {991fd638-a2a0-40a9-bb61-8a7c613784d4} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.12.4 GCC 64bit + Desktop Qt 5.12.4 GCC 64bit + qt.qt5.5124.gcc_64_kit + 0 + 0 + 0 + + /home/antenore/remmina_devel/build-QRema-Desktop_Qt_5_12_4_GCC_64bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/antenore/remmina_devel/build-QRema-Desktop_Qt_5_12_4_GCC_64bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/antenore/remmina_devel/build-QRema-Desktop_Qt_5_12_4_GCC_64bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy Configuration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + QRema + + Qt4ProjectManager.Qt4RunConfiguration:/home/antenore/remmina_devel/QRema/QRema.pro + + 3768 + false + true + true + false + false + true + + /home/antenore/remmina_devel/build-QRema-Desktop_Qt_5_12_4_GCC_64bit-Debug + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop Qt 5.13.0 GCC 64bit + Desktop Qt 5.13.0 GCC 64bit + qt.qt5.5130.gcc_64_kit + 0 + 0 + 0 + + /home/antenore/remmina_devel/build-QRema-Desktop_Qt_5_13_0_GCC_64bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/antenore/remmina_devel/build-QRema-Desktop_Qt_5_13_0_GCC_64bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/antenore/remmina_devel/build-QRema-Desktop_Qt_5_13_0_GCC_64bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy Configuration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + + Custom Executable + + ProjectExplorer.CustomExecutableRunConfiguration + + 3768 + false + true + false + false + true + + + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 21 + + + Version + 21 + + diff --git a/data/ui/qremamain.ui b/data/ui/qremamain.ui new file mode 100644 index 0000000..5dd7218 --- /dev/null +++ b/data/ui/qremamain.ui @@ -0,0 +1,123 @@ + + + QRemaMain + + + + 0 + 0 + 800 + 400 + + + + + 800 + 400 + + + + QRemaMain + + + + + + + Qt::Horizontal + + + + + + + true + + + + + + + + + + + + + + + 0 + 0 + + + + true + + + + + + + + + + + + + + + + 0 + 0 + 800 + 21 + + + + + + TopToolBarArea + + + false + + + + + + + + + treeView + clicked(QModelIndex) + listView + update(QModelIndex) + + + 171 + 163 + + + 486 + 192 + + + + + listView + doubleClicked(QModelIndex) + listView + setCurrentIndex(QModelIndex) + + + 565 + 311 + + + 689 + 301 + + + + + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..eaca329 --- /dev/null +++ b/main.cpp @@ -0,0 +1,11 @@ +#include "qremamain.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QRemaMain w; + w.show(); + + return a.exec(); +} diff --git a/src/qremamain.cpp b/src/qremamain.cpp new file mode 100644 index 0000000..76b4dd3 --- /dev/null +++ b/src/qremamain.cpp @@ -0,0 +1,78 @@ +#include "qremamain.h" +#include "ui_qremamain.h" + + +QRemaMain::QRemaMain(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::QRemaMain) +{ + ui->setupUi(this); + QString mPath = "/home/antenore/remmina/profiles"; + dirModel = new QFileSystemModel(this); + + // Set filter + dirModel->setFilter(QDir::NoDotAndDotDot | + QDir::AllDirs); + + // QFileSystemModel requires root path + dirModel->setRootPath(mPath); + + // Attach the model to the view + ui->treeView->setModel(dirModel); + ui->treeView->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); + ui->treeView->setHeaderHidden(true); + ui->treeView->setColumnHidden(1, true); + ui->treeView->setColumnHidden(2, true); + ui->treeView->setColumnHidden(3, true); + + ui->treeView->setRootIndex(dirModel->index(mPath)); + + + // FILES + + fileModel = new QFileSystemModel(this); + + // Set filter + fileModel->setFilter(QDir::Files | QDir::NoDotAndDotDot); + + // QFileSystemModel requires root path + fileModel->setRootPath(mPath); + + // Only remmina files + fileModel->setNameFilters(QStringList()<<"*.remmina"); + + + // Attach the model to the view + ui->listView->setModel(fileModel); + ui->listView->setWordWrap( true ); + ui->listView->setViewMode(QListView::IconMode); + ui->listView->setIconSize(QSize(64, 64)); + ui->listView->setResizeMode(QListView::Adjust); + + ui->listView->setRootIndex(fileModel->index(mPath)); + + +} + +QRemaMain::~QRemaMain() +{ + delete ui; +} + +void QRemaMain::on_treeView_clicked(const QModelIndex &index) +{ + // TreeView clicked + // 1. We need to extract path + // 2. Set that path into our ListView + + // Get the full path of the item that's user clicked on + QString mPath = dirModel->fileInfo(index).absoluteFilePath(); + ui->listView->setRootIndex(fileModel->setRootPath(mPath)); + +} + +void QRemaMain::on_listView_doubleClicked(const QModelIndex &index) +{ + QString sPath = fileModel->fileInfo(index).absoluteFilePath(); + QDesktopServices::openUrl(QUrl::fromLocalFile(sPath)); +} diff --git a/src/qremamain.h b/src/qremamain.h new file mode 100644 index 0000000..c20c0a7 --- /dev/null +++ b/src/qremamain.h @@ -0,0 +1,35 @@ +#ifndef QREMAMAIN_H +#define QREMAMAIN_H + +#include +#include +#include +#include + + + +namespace Ui { +class QRemaMain; +} + +class QRemaMain : public QMainWindow +{ + Q_OBJECT + +public: + explicit QRemaMain(QWidget *parent = nullptr); + ~QRemaMain(); + +private slots: + void on_treeView_clicked(const QModelIndex &index); + void on_listView_doubleClicked(const QModelIndex &index); + +private: + Ui::QRemaMain *ui; + // Make two models instead of one + // to filter them separately + QFileSystemModel *dirModel; + QFileSystemModel *fileModel; +}; + +#endif // QREMAMAIN_H -- cgit v1.2.3