Skip to content

Commit b6d8498

Browse files
committed
Merge branch 'develop'
2 parents 22adfb8 + 282add2 commit b6d8498

8 files changed

+107
-44
lines changed

CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ set(CMAKE_MODULE_PATH
5353
)
5454

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

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

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

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

6969
message(STATUS "VST SDK headers are found in ${VSTSDK_INCLUDE_DIR}")

src/manager/forms/linkdialog.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ void LinkDialog::setItem(LinkItem* item)
3636
item_ = item;
3737

3838
if(item) {
39-
nameEdit_->setText(item->name());
4039
locationEdit_->setText(item->location());
41-
targetEdit_->setText(item->target());
4240

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

4947
index = static_cast<int>(item->logLevel()) + 1;
5048
logLevelCombo_->setCurrentIndex(index);
49+
50+
nameEdit_->setText(item->name());
51+
targetEdit_->setText(item->target());
5152
}
5253
else {
5354
nameEdit_->clear();
@@ -178,7 +179,11 @@ void LinkDialog::browsePlugin()
178179
}
179180

180181
if(dialog.exec()) {
181-
int length = prefixInfo.absoluteFilePath().length() + 1; // Take '/' into account
182+
QString prefixPath = prefixInfo.absoluteFilePath();
183+
int length = prefixPath.length();
184+
if(!prefixPath.endsWith('/'))
185+
length++;
186+
182187
targetEdit_->setText(dialog.selectedPath().mid(length));
183188

184189
QString name = dialog.selectedName();

src/manager/forms/loaderdialog.cpp

+15-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <QGridLayout>
55
#include <QIcon>
66
#include <QLabel>
7+
#include <QMessageBox>
78
#include "core/application.h"
89
#include "forms/filedialog.h"
910
#include "models/loadersmodel.h"
@@ -99,16 +100,28 @@ void LoaderDialog::setItem(LoaderItem* item)
99100

100101
void LoaderDialog::accept()
101102
{
103+
QString name = nameEdit_->text();
104+
QString message = QString("The loader with name '%1' is already exist.").arg(name);
105+
102106
if(!item_) {
103107
if(!qApp->loaders()->createLoader(nameEdit_->text(), pathEdit_->text())) {
104-
// TODO messagebox
108+
QMessageBox::critical(this, "Error", message);
105109
return;
106110
}
107111
}
108-
else {
112+
else if(name != item_->name()) {
113+
Storage::Loader loader = qApp->storage()->loader(name.toStdString());
114+
if(!loader.isNull()) {
115+
QMessageBox::critical(this, "Error", message);
116+
return;
117+
}
118+
109119
item_->setName(nameEdit_->text());
110120
item_->setPath(pathEdit_->text());
111121
}
122+
else {
123+
item_->setPath(pathEdit_->text());
124+
}
112125

113126
QDialog::accept();
114127
}

src/manager/forms/prefixdialog.cpp

+36-19
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
#include <QGridLayout>
55
#include <QIcon>
66
#include <QLabel>
7+
#include <QMessageBox>
78
#include "core/application.h"
89
#include "forms/filedialog.h"
910
#include "models/prefixesmodel.h"
1011
#include "widgets/lineedit.h"
1112

1213

1314
PrefixDialog::PrefixDialog(QWidget* parent) :
14-
QDialog(parent)
15+
QDialog(parent),
16+
item_(nullptr)
1517
{
1618
setupUi();
1719
}
@@ -77,35 +79,50 @@ void PrefixDialog::browseForWinePrefix()
7779
}
7880

7981

80-
QString PrefixDialog::name() const
82+
PrefixItem* PrefixDialog::item() const
8183
{
82-
return nameEdit_->text();
84+
return item_;
8385
}
8486

8587

86-
void PrefixDialog::setName(const QString& name)
88+
void PrefixDialog::setItem(PrefixItem* item)
8789
{
88-
nameEdit_->setText(name);
89-
}
90-
90+
item_ = item;
9191

92-
QString PrefixDialog::path() const
93-
{
94-
return pathEdit_->text();
95-
}
96-
97-
98-
void PrefixDialog::setPath(const QString& path)
99-
{
100-
pathEdit_->setText(path);
92+
if(item_) {
93+
nameEdit_->setText(item->name());
94+
pathEdit_->setText(item->path());
95+
}
96+
else {
97+
nameEdit_->clear();
98+
pathEdit_->clear();
99+
}
101100
}
102101

103102

104103
void PrefixDialog::accept()
105104
{
106-
if(!qApp->prefixes()->createPrefix(nameEdit_->text(), pathEdit_->text())) {
107-
// TODO messagebox
108-
return;
105+
QString name = nameEdit_->text();
106+
QString message = QString("The prefix with name '%1' is already exist.").arg(name);
107+
108+
if(!item_) {
109+
if(!qApp->prefixes()->createPrefix(nameEdit_->text(), pathEdit_->text())) {
110+
QMessageBox::critical(this, "Error", message);
111+
return;
112+
}
113+
}
114+
else if(name != item_->name()) {
115+
Storage::Prefix prefix = qApp->storage()->prefix(name.toStdString());
116+
if(!prefix.isNull()) {
117+
QMessageBox::critical(this, "Error", message);
118+
return;
119+
}
120+
121+
item_->setName(nameEdit_->text());
122+
item_->setPath(pathEdit_->text());
123+
}
124+
else {
125+
item_->setPath(pathEdit_->text());
109126
}
110127

111128
QDialog::accept();

src/manager/forms/prefixdialog.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,22 @@
66

77
class QDialogButtonBox;
88
class LineEdit;
9+
class PrefixItem;
910

1011

1112
class PrefixDialog : public QDialog {
1213
Q_OBJECT
1314
public:
1415
PrefixDialog(QWidget* parent = nullptr);
1516

16-
QString name() const;
17-
void setName(const QString& name);
18-
19-
QString path() const;
20-
void setPath(const QString& path);
21-
17+
PrefixItem* item() const;
18+
void setItem(PrefixItem* item);
2219

2320
private:
2421
LineEdit* nameEdit_;
2522
LineEdit* pathEdit_;
2623
QDialogButtonBox* buttons_;
24+
PrefixItem* item_;
2725

2826
void setupUi();
2927

src/manager/forms/settingsdialog.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,8 @@ void SettingsDialog::editPrefix()
247247
}
248248

249249
PrefixDialog dialog;
250-
dialog.setName(item->name());
251-
dialog.setPath(item->path());
252-
253-
if(dialog.exec()) {
254-
item->setName(dialog.name());
255-
item->setPath(dialog.path());
256-
}
250+
dialog.setItem(item);
251+
dialog.exec();
257252
}
258253

259254

src/manager/models/directorymodel.cpp

+35-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77

88
DirectoryItem::DirectoryItem(const QFileInfo& info) :
9-
info_(info)
9+
info_(info),
10+
type_(getType())
1011
{
1112
}
1213

@@ -56,6 +57,34 @@ QString DirectoryItem::humanReadableSize() const
5657
}
5758

5859

60+
QString DirectoryItem::type() const
61+
{
62+
return type_;
63+
}
64+
65+
66+
QString DirectoryItem::getType() const
67+
{
68+
if(info_.isRoot())
69+
return "Drive";
70+
71+
if(info_.isFile()) {
72+
if(!info_.suffix().isEmpty())
73+
return QString("%1 File").arg(info_.suffix());
74+
75+
return "File";
76+
}
77+
78+
if(info_.isDir())
79+
return "Folder";
80+
81+
if(info_.isSymLink())
82+
return "Shortcut";
83+
84+
return "Unknown";
85+
}
86+
87+
5988
DirectoryModel::DirectoryModel(QObject* parent) :
6089
GenericTreeModel<DirectoryItem>(new DirectoryItem(), parent),
6190
filters_(QDir::AllEntries),
@@ -85,12 +114,14 @@ QVariant DirectoryModel::data(const QModelIndex& index, int role) const
85114
return item->name();
86115
}
87116
else if(column == 1) {
88-
if(!item->isDirectory())
117+
if(!item->isDirectory()) {
89118
return item->humanReadableSize();
119+
}
120+
121+
return "<DIR>";
90122
}
91123
else if(column == 2) {
92-
}
93-
else if(column == 3) {
124+
return item->type();
94125
}
95126
}
96127
else if(role == Qt::DecorationRole && index.column() == 0) {

src/manager/models/directorymodel.h

+4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ class DirectoryItem : public GenericTreeItem<DirectoryItem> {
1919
i64 size() const;
2020

2121
QString humanReadableSize() const;
22+
QString type() const;
2223

2324
private:
2425
QFileInfo info_;
26+
QString type_;
27+
28+
QString getType() const;
2529
};
2630

2731

0 commit comments

Comments
 (0)