Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
psycha0s committed Apr 13, 2015
2 parents 22adfb8 + 282add2 commit b6d8498
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 44 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ set(CMAKE_MODULE_PATH
)

# Configure the VST SDK path
set(VSTSDK_PATH ${PROJECT_SOURCE_DIR}/vstsdk2.4 CACHE PATH
"Path to the Steinberg VST 2.4 SDK")
set(VSTSDK_PATH ${PROJECT_SOURCE_DIR}/VST3\ SDK CACHE PATH
"Path to the Steinberg VST Audio Plugins SDK")

message(STATUS "VSTSDK_PATH is set to " ${VSTSDK_PATH})

Expand All @@ -63,7 +63,7 @@ find_path(VSTSDK_INCLUDE_DIR NAMES aeffect.h aeffectx.h

if(NOT VSTSDK_INCLUDE_DIR)
message(FATAL_ERROR "VST SDK is not found. You should set the VSTSDK_PATH variable "
"to te location where your copy the VST SDK ")
"to the directory, where your copy of the VST SDK is located.")
endif()

message(STATUS "VST SDK headers are found in ${VSTSDK_INCLUDE_DIR}")
Expand Down
11 changes: 8 additions & 3 deletions src/manager/forms/linkdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ void LinkDialog::setItem(LinkItem* item)
item_ = item;

if(item) {
nameEdit_->setText(item->name());
locationEdit_->setText(item->location());
targetEdit_->setText(item->target());

int index = prefixCombo_->findText(item->prefix());
prefixCombo_->setCurrentIndex(index);
Expand All @@ -48,6 +46,9 @@ void LinkDialog::setItem(LinkItem* item)

index = static_cast<int>(item->logLevel()) + 1;
logLevelCombo_->setCurrentIndex(index);

nameEdit_->setText(item->name());
targetEdit_->setText(item->target());
}
else {
nameEdit_->clear();
Expand Down Expand Up @@ -178,7 +179,11 @@ void LinkDialog::browsePlugin()
}

if(dialog.exec()) {
int length = prefixInfo.absoluteFilePath().length() + 1; // Take '/' into account
QString prefixPath = prefixInfo.absoluteFilePath();
int length = prefixPath.length();
if(!prefixPath.endsWith('/'))
length++;

targetEdit_->setText(dialog.selectedPath().mid(length));

QString name = dialog.selectedName();
Expand Down
17 changes: 15 additions & 2 deletions src/manager/forms/loaderdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QGridLayout>
#include <QIcon>
#include <QLabel>
#include <QMessageBox>
#include "core/application.h"
#include "forms/filedialog.h"
#include "models/loadersmodel.h"
Expand Down Expand Up @@ -99,16 +100,28 @@ void LoaderDialog::setItem(LoaderItem* item)

void LoaderDialog::accept()
{
QString name = nameEdit_->text();
QString message = QString("The loader with name '%1' is already exist.").arg(name);

if(!item_) {
if(!qApp->loaders()->createLoader(nameEdit_->text(), pathEdit_->text())) {
// TODO messagebox
QMessageBox::critical(this, "Error", message);
return;
}
}
else {
else if(name != item_->name()) {
Storage::Loader loader = qApp->storage()->loader(name.toStdString());
if(!loader.isNull()) {
QMessageBox::critical(this, "Error", message);
return;
}

item_->setName(nameEdit_->text());
item_->setPath(pathEdit_->text());
}
else {
item_->setPath(pathEdit_->text());
}

QDialog::accept();
}
55 changes: 36 additions & 19 deletions src/manager/forms/prefixdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
#include <QGridLayout>
#include <QIcon>
#include <QLabel>
#include <QMessageBox>
#include "core/application.h"
#include "forms/filedialog.h"
#include "models/prefixesmodel.h"
#include "widgets/lineedit.h"


PrefixDialog::PrefixDialog(QWidget* parent) :
QDialog(parent)
QDialog(parent),
item_(nullptr)
{
setupUi();
}
Expand Down Expand Up @@ -77,35 +79,50 @@ void PrefixDialog::browseForWinePrefix()
}


QString PrefixDialog::name() const
PrefixItem* PrefixDialog::item() const
{
return nameEdit_->text();
return item_;
}


void PrefixDialog::setName(const QString& name)
void PrefixDialog::setItem(PrefixItem* item)
{
nameEdit_->setText(name);
}

item_ = item;

QString PrefixDialog::path() const
{
return pathEdit_->text();
}


void PrefixDialog::setPath(const QString& path)
{
pathEdit_->setText(path);
if(item_) {
nameEdit_->setText(item->name());
pathEdit_->setText(item->path());
}
else {
nameEdit_->clear();
pathEdit_->clear();
}
}


void PrefixDialog::accept()
{
if(!qApp->prefixes()->createPrefix(nameEdit_->text(), pathEdit_->text())) {
// TODO messagebox
return;
QString name = nameEdit_->text();
QString message = QString("The prefix with name '%1' is already exist.").arg(name);

if(!item_) {
if(!qApp->prefixes()->createPrefix(nameEdit_->text(), pathEdit_->text())) {
QMessageBox::critical(this, "Error", message);
return;
}
}
else if(name != item_->name()) {
Storage::Prefix prefix = qApp->storage()->prefix(name.toStdString());
if(!prefix.isNull()) {
QMessageBox::critical(this, "Error", message);
return;
}

item_->setName(nameEdit_->text());
item_->setPath(pathEdit_->text());
}
else {
item_->setPath(pathEdit_->text());
}

QDialog::accept();
Expand Down
10 changes: 4 additions & 6 deletions src/manager/forms/prefixdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@

class QDialogButtonBox;
class LineEdit;
class PrefixItem;


class PrefixDialog : public QDialog {
Q_OBJECT
public:
PrefixDialog(QWidget* parent = nullptr);

QString name() const;
void setName(const QString& name);

QString path() const;
void setPath(const QString& path);

PrefixItem* item() const;
void setItem(PrefixItem* item);

private:
LineEdit* nameEdit_;
LineEdit* pathEdit_;
QDialogButtonBox* buttons_;
PrefixItem* item_;

void setupUi();

Expand Down
9 changes: 2 additions & 7 deletions src/manager/forms/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,8 @@ void SettingsDialog::editPrefix()
}

PrefixDialog dialog;
dialog.setName(item->name());
dialog.setPath(item->path());

if(dialog.exec()) {
item->setName(dialog.name());
item->setPath(dialog.path());
}
dialog.setItem(item);
dialog.exec();
}


Expand Down
39 changes: 35 additions & 4 deletions src/manager/models/directorymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@


DirectoryItem::DirectoryItem(const QFileInfo& info) :
info_(info)
info_(info),
type_(getType())
{
}

Expand Down Expand Up @@ -56,6 +57,34 @@ QString DirectoryItem::humanReadableSize() const
}


QString DirectoryItem::type() const
{
return type_;
}


QString DirectoryItem::getType() const
{
if(info_.isRoot())
return "Drive";

if(info_.isFile()) {
if(!info_.suffix().isEmpty())
return QString("%1 File").arg(info_.suffix());

return "File";
}

if(info_.isDir())
return "Folder";

if(info_.isSymLink())
return "Shortcut";

return "Unknown";
}


DirectoryModel::DirectoryModel(QObject* parent) :
GenericTreeModel<DirectoryItem>(new DirectoryItem(), parent),
filters_(QDir::AllEntries),
Expand Down Expand Up @@ -85,12 +114,14 @@ QVariant DirectoryModel::data(const QModelIndex& index, int role) const
return item->name();
}
else if(column == 1) {
if(!item->isDirectory())
if(!item->isDirectory()) {
return item->humanReadableSize();
}

return "<DIR>";
}
else if(column == 2) {
}
else if(column == 3) {
return item->type();
}
}
else if(role == Qt::DecorationRole && index.column() == 0) {
Expand Down
4 changes: 4 additions & 0 deletions src/manager/models/directorymodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ class DirectoryItem : public GenericTreeItem<DirectoryItem> {
i64 size() const;

QString humanReadableSize() const;
QString type() const;

private:
QFileInfo info_;
QString type_;

QString getType() const;
};


Expand Down

0 comments on commit b6d8498

Please sign in to comment.