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.
This commit is contained in:
Maurice O'Neal 2016-10-03 00:47:02 -04:00
commit 455723cede
6 changed files with 152 additions and 0 deletions

21
JustAudio.pro Normal file
View File

@ -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

6
gui/file_item.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "file_item.h"
FileItem::FileItem(QWidget *parent) : QLabel(parent)
{
}

17
gui/file_item.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef FILE_ITEM_H
#define FILE_ITEM_H
#include <QWidget>
#include <QLabel>
#include <QHBoxLayout>
class FileItem : public QLabel
{
Q_OBJECT
public:
FileItem(QWidget *parent = 0);
};
#endif // FILE_ITEM_H

54
gui/ui.cpp Normal file
View File

@ -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]);
}
}

40
gui/ui.h Normal file
View File

@ -0,0 +1,40 @@
#ifndef UI_H
#define UI_H
#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QScrollArea>
#include <QSlider>
#include <QLabel>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QLineEdit>
#include <QFileInfoList>
#include <QList>
#include "file_item.h"
class Ui : public QWidget
{
Q_OBJECT
private:
QSlider *slider;
QLineEdit *search;
QVBoxLayout *listLayout;
QList<FileItem*> fileList;
public:
Ui(const QStringList &args, QWidget *parent = 0);
public slots:
void setActiveFile(const QString &name);
void setActiveDir(const QString &path);
};
#endif // UI_H

14
main.cpp Normal file
View File

@ -0,0 +1,14 @@
#include <QApplication>
#include <QStringList>
#include "gui/ui.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Ui win(app.arguments());
win.show();
return app.exec();
}