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:
commit
455723cede
21
JustAudio.pro
Normal file
21
JustAudio.pro
Normal 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
6
gui/file_item.cpp
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include "file_item.h"
|
||||
|
||||
FileItem::FileItem(QWidget *parent) : QLabel(parent)
|
||||
{
|
||||
|
||||
}
|
17
gui/file_item.h
Normal file
17
gui/file_item.h
Normal 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
54
gui/ui.cpp
Normal 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
40
gui/ui.h
Normal 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
|
Loading…
Reference in New Issue
Block a user