JustAudio/gui/ui.cpp
Maurice O'Neal 455723cede 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.
2016-10-03 00:47:02 -04:00

55 lines
1.2 KiB
C++

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