Remove portable, we dont use it
This commit is contained in:
@@ -53,13 +53,7 @@ CollectionDirectoryModel::~CollectionDirectoryModel() {}
|
|||||||
|
|
||||||
void CollectionDirectoryModel::DirectoryDiscovered(const Directory &dir) {
|
void CollectionDirectoryModel::DirectoryDiscovered(const Directory &dir) {
|
||||||
|
|
||||||
QStandardItem *item;
|
QStandardItem *item = new QStandardItem(dir.path);
|
||||||
if (Application::kIsPortable && Utilities::UrlOnSameDriveAsStrawberry(QUrl::fromLocalFile(dir.path))) {
|
|
||||||
item = new QStandardItem(Utilities::GetRelativePathToStrawberryBin(QUrl::fromLocalFile(dir.path)).toLocalFile());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
item = new QStandardItem(dir.path);
|
|
||||||
}
|
|
||||||
item->setData(dir.id, kIdRole);
|
item->setData(dir.id, kIdRole);
|
||||||
item->setIcon(dir_icon_);
|
item->setIcon(dir_icon_);
|
||||||
storage_ << std::shared_ptr<MusicStorage>(new FilesystemMusicStorage(dir.path));
|
storage_ << std::shared_ptr<MusicStorage>(new FilesystemMusicStorage(dir.path));
|
||||||
|
|||||||
@@ -86,8 +86,6 @@
|
|||||||
# include "moodbar/moodbarloader.h"
|
# include "moodbar/moodbarloader.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool Application::kIsPortable = false;
|
|
||||||
|
|
||||||
class ApplicationImpl {
|
class ApplicationImpl {
|
||||||
public:
|
public:
|
||||||
explicit ApplicationImpl(Application *app) :
|
explicit ApplicationImpl(Application *app) :
|
||||||
|
|||||||
@@ -68,8 +68,6 @@ class Application : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool kIsPortable;
|
|
||||||
|
|
||||||
explicit Application(QObject *parent = nullptr);
|
explicit Application(QObject *parent = nullptr);
|
||||||
~Application();
|
~Application();
|
||||||
|
|
||||||
|
|||||||
@@ -427,15 +427,7 @@ void Song::set_bitdepth(int v) { d->bitdepth_ = v; }
|
|||||||
|
|
||||||
void Song::set_source(Source v) { d->source_ = v; }
|
void Song::set_source(Source v) { d->source_ = v; }
|
||||||
void Song::set_directory_id(int v) { d->directory_id_ = v; }
|
void Song::set_directory_id(int v) { d->directory_id_ = v; }
|
||||||
void Song::set_url(const QUrl &v) {
|
void Song::set_url(const QUrl &v) { d->url_ = v; }
|
||||||
if (Application::kIsPortable) {
|
|
||||||
QUrl base = QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + "/");
|
|
||||||
d->url_ = base.resolved(v);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
d->url_ = v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Song::set_basefilename(const QString &v) { d->basefilename_ = v; }
|
void Song::set_basefilename(const QString &v) { d->basefilename_ = v; }
|
||||||
void Song::set_filetype(FileType v) { d->filetype_ = v; }
|
void Song::set_filetype(FileType v) { d->filetype_ = v; }
|
||||||
void Song::set_filesize(int v) { d->filesize_ = v; }
|
void Song::set_filesize(int v) { d->filesize_ = v; }
|
||||||
@@ -1288,18 +1280,7 @@ void Song::BindToQuery(QSqlQuery *query) const {
|
|||||||
|
|
||||||
query->bindValue(":source", d->source_);
|
query->bindValue(":source", d->source_);
|
||||||
query->bindValue(":directory_id", notnullintval(d->directory_id_));
|
query->bindValue(":directory_id", notnullintval(d->directory_id_));
|
||||||
|
query->bindValue(":url", d->url_.toString(QUrl::FullyEncoded));
|
||||||
QString url;
|
|
||||||
if (d->url_.isValid()) {
|
|
||||||
if (Application::kIsPortable && Utilities::UrlOnSameDriveAsStrawberry(d->url_)) {
|
|
||||||
url = Utilities::GetRelativePathToStrawberryBin(d->url_).toEncoded();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
url = d->url_.toEncoded();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
query->bindValue(":url", url);
|
|
||||||
|
|
||||||
query->bindValue(":filetype", d->filetype_);
|
query->bindValue(":filetype", d->filetype_);
|
||||||
query->bindValue(":filesize", notnullintval(d->filesize_));
|
query->bindValue(":filesize", notnullintval(d->filesize_));
|
||||||
query->bindValue(":mtime", notnullintval(d->mtime_));
|
query->bindValue(":mtime", notnullintval(d->mtime_));
|
||||||
|
|||||||
@@ -736,19 +736,6 @@ void IncreaseFDLimit() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckPortable() {
|
|
||||||
|
|
||||||
QFile f(QApplication::applicationDirPath() + QDir::separator() + "data");
|
|
||||||
if (f.exists()) {
|
|
||||||
// We are portable. Set the bool and change the qsettings path
|
|
||||||
Application::kIsPortable = true;
|
|
||||||
|
|
||||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
|
||||||
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, f.fileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QString GetRandomStringWithChars(const int len) {
|
QString GetRandomStringWithChars(const int len) {
|
||||||
const QString UseCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
|
const QString UseCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
|
||||||
return GetRandomString(len, UseCharacters);
|
return GetRandomString(len, UseCharacters);
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ QString FiddleFileExtension(const QString &filename, const QString &new_extensio
|
|||||||
QString GetEnv(const QString &key);
|
QString GetEnv(const QString &key);
|
||||||
void SetEnv(const char *key, const QString &value);
|
void SetEnv(const char *key, const QString &value);
|
||||||
void IncreaseFDLimit();
|
void IncreaseFDLimit();
|
||||||
void CheckPortable();
|
|
||||||
|
|
||||||
// Borrowed from schedutils
|
// Borrowed from schedutils
|
||||||
enum IoPriority {
|
enum IoPriority {
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ int main(int argc, char* argv[]) {
|
|||||||
// Only start a core application now so we can check if there's another instance without requiring an X server.
|
// Only start a core application now so we can check if there's another instance without requiring an X server.
|
||||||
// This MUST be done before parsing the commandline options so QTextCodec gets the right system locale for filenames.
|
// This MUST be done before parsing the commandline options so QTextCodec gets the right system locale for filenames.
|
||||||
SingleCoreApplication core_app(argc, argv, true, SingleCoreApplication::Mode::User | SingleCoreApplication::Mode::ExcludeAppVersion | SingleCoreApplication::Mode::ExcludeAppPath);
|
SingleCoreApplication core_app(argc, argv, true, SingleCoreApplication::Mode::User | SingleCoreApplication::Mode::ExcludeAppVersion | SingleCoreApplication::Mode::ExcludeAppPath);
|
||||||
Utilities::CheckPortable();
|
|
||||||
// Parse commandline options - need to do this before starting the full QApplication so it works without an X server
|
// Parse commandline options - need to do this before starting the full QApplication so it works without an X server
|
||||||
if (!options.Parse()) return 1;
|
if (!options.Parse()) return 1;
|
||||||
logging::SetLevels(options.log_levels());
|
logging::SetLevels(options.log_levels());
|
||||||
|
|||||||
Reference in New Issue
Block a user