commit 455723ceded3916f32ed77dd7368cb1b7cc1c410 Author: Maurice O'Neal Date: Mon Oct 3 00:47:02 2016 -0400 1st commit for this project. current work in progress is to get the basic skelton for all classes setup and then i will fill in all code later, it's not compilable at this time. diff --git a/JustAudio.pro b/JustAudio.pro new file mode 100644 index 0000000..4002db3 --- /dev/null +++ b/JustAudio.pro @@ -0,0 +1,21 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2016-10-01T14:15:33 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = JustAudio +TEMPLATE = app + + +SOURCES += main.cpp\ + gui/ui.cpp \ + gui/file_item.cpp + +HEADERS += \ + gui/ui.h \ + gui/file_item.h diff --git a/gui/file_item.cpp b/gui/file_item.cpp new file mode 100644 index 0000000..4bcfd9f --- /dev/null +++ b/gui/file_item.cpp @@ -0,0 +1,6 @@ +#include "file_item.h" + +FileItem::FileItem(QWidget *parent) : QLabel(parent) +{ + +} diff --git a/gui/file_item.h b/gui/file_item.h new file mode 100644 index 0000000..130f0bd --- /dev/null +++ b/gui/file_item.h @@ -0,0 +1,17 @@ +#ifndef FILE_ITEM_H +#define FILE_ITEM_H + +#include +#include +#include + +class FileItem : public QLabel +{ + Q_OBJECT + +public: + + FileItem(QWidget *parent = 0); +}; + +#endif // FILE_ITEM_H diff --git a/gui/ui.cpp b/gui/ui.cpp new file mode 100644 index 0000000..53c9ce8 --- /dev/null +++ b/gui/ui.cpp @@ -0,0 +1,54 @@ +#include "ui.h" + +Ui::Ui(const QStringList &args, QWidget *parent) : QWidget(parent) +{ + QWidget *listWid = new QWidget(this); + QScrollArea *mid = new QScrollArea(this); + QVBoxLayout *mainLayout = new QVBoxLayout(this); + + slider = new QSlider(this); + listLayout = new QVBoxLayout(listWid); + search = new QLineEdit(this); + + slider->setOrientation(Qt::Horizontal); + mid->setWidget(listWid); + mid->setWidgetResizable(true); + mainLayout->addWidget(search); + mainLayout->addWidget(mid); + mainLayout->addWidget(slider); + mainLayout->setSpacing(0); + mainLayout->setContentsMargins(0, 0, 0, 0); + + if (args.size() > 1) + { + QFileInfo info(args[1]); + + info.makeAbsolute(); + + if (info.isFile()) + { + setActiveDir(info.path()); + setActiveFile(info.filePath()); + } + else if (info.isDir()) + { + setActiveDir(info.path()); + } + else + { + setActiveDir(QDir::homePath()); + } + } + else + { + setActiveDir(QDir::homePath()); + } +} + +void Ui::setActiveDir(const QString &path) +{ + for (int i = 0; i < fileList.size(); ++i) + { + listLayout->removeWidget(fileList[i]); + } +} diff --git a/gui/ui.h b/gui/ui.h new file mode 100644 index 0000000..4c5a93a --- /dev/null +++ b/gui/ui.h @@ -0,0 +1,40 @@ +#ifndef UI_H +#define UI_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "file_item.h" + +class Ui : public QWidget +{ + Q_OBJECT + +private: + + QSlider *slider; + QLineEdit *search; + QVBoxLayout *listLayout; + QList fileList; + +public: + + Ui(const QStringList &args, QWidget *parent = 0); + +public slots: + + void setActiveFile(const QString &name); + void setActiveDir(const QString &path); +}; + +#endif // UI_H diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..a8df9ea --- /dev/null +++ b/main.cpp @@ -0,0 +1,14 @@ +#include +#include + +#include "gui/ui.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + Ui win(app.arguments()); + + win.show(); + + return app.exec(); +}