Fix some mac ui and metadata bugs.
This commit is contained in:
parent
5082d81ba4
commit
21415ff230
|
@ -23,6 +23,7 @@ void CheckForUpdates();
|
|||
QString GetBundlePath();
|
||||
QString GetResourcesPath();
|
||||
QString GetApplicationSupportPath();
|
||||
QString GetMusicDirectory();
|
||||
|
||||
bool MigrateLegacyConfigFiles();
|
||||
|
||||
|
|
|
@ -226,6 +226,24 @@ QString GetApplicationSupportPath() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
QString GetMusicDirectory() {
|
||||
NSAutoreleasePool* pool = [NSAutoreleasePool alloc];
|
||||
[pool init];
|
||||
NSArray* paths = NSSearchPathForDirectoriesInDomains(
|
||||
NSMusicDirectory,
|
||||
NSUserDomainMask,
|
||||
YES);
|
||||
QString ret;
|
||||
if ([paths count] > 0) {
|
||||
NSString* user_path = [paths objectAtIndex:0];
|
||||
ret = QString::fromUtf8([user_path UTF8String]);
|
||||
} else {
|
||||
ret = "~/Music";
|
||||
}
|
||||
[pool drain];
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool MigrateLegacyConfigFiles() {
|
||||
QString old_config_dir = QString("%1/.config/%2").arg(
|
||||
QDir::homePath(), QCoreApplication::organizationName());
|
||||
|
|
|
@ -220,6 +220,13 @@ QString GetConfigPath(ConfigPath config) {
|
|||
return GetConfigPath(Path_Root) +
|
||||
QString("/gst-registry-%1-bin").arg(QCoreApplication::applicationVersion());
|
||||
|
||||
case Path_DefaultMusicLibrary:
|
||||
#ifdef Q_OS_DARWIN
|
||||
return mac::GetMusicDirectory();
|
||||
#else
|
||||
return QDir::homePath();
|
||||
#endif
|
||||
|
||||
default:
|
||||
qFatal("%s", Q_FUNC_INFO);
|
||||
return QString::null;
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace Utilities {
|
|||
Path_AlbumCovers,
|
||||
Path_NetworkCache,
|
||||
Path_GstreamerRegistry,
|
||||
Path_DefaultMusicLibrary,
|
||||
};
|
||||
QString GetConfigPath(ConfigPath config);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "ui_libraryconfig.h"
|
||||
#include "playlist/playlistdelegates.h"
|
||||
#include "ui/iconloader.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QSettings>
|
||||
|
@ -68,7 +69,8 @@ void LibraryConfig::Add() {
|
|||
QSettings settings;
|
||||
settings.beginGroup(kSettingsGroup);
|
||||
|
||||
QString path(settings.value("last_path", QDir::homePath()).toString());
|
||||
QString path(settings.value("last_path",
|
||||
Utilities::GetConfigPath(Utilities::Path_DefaultMusicLibrary)).toString());
|
||||
path = QFileDialog::getExistingDirectory(this, tr("Add directory..."), path);
|
||||
|
||||
if (!path.isNull()) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "library/librarybackend.h"
|
||||
#include "library/libraryquery.h"
|
||||
#include "library/sqlrow.h"
|
||||
#include "widgets/maclineedit.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QPainter>
|
||||
|
@ -142,6 +143,19 @@ void AlbumCoverManager::Init() {
|
|||
connect(ui_->action_load, SIGNAL(triggered()), SLOT(LoadSelectedToPlaylist()));
|
||||
connect(ui_->action_search_manual, SIGNAL(triggered()), SLOT(SearchManual()));
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
MacLineEdit* lineedit = new MacLineEdit(ui_->filter->parentWidget());
|
||||
lineedit->SetHint(ui_->filter->GetHint());
|
||||
delete ui_->filter;
|
||||
ui_->horizontalLayout->insertWidget(0, lineedit);
|
||||
filter_ = lineedit;
|
||||
delete ui_->clear;
|
||||
connect(lineedit, SIGNAL(textChanged(QString)), SLOT(UpdateFilter()));
|
||||
lineedit->show();
|
||||
#else
|
||||
filter_ = ui_->filter;
|
||||
#endif
|
||||
|
||||
// Restore settings
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
@ -285,7 +299,7 @@ void AlbumCoverManager::CoverImageLoaded(quint64 id, const QImage &image) {
|
|||
}
|
||||
|
||||
void AlbumCoverManager::UpdateFilter() {
|
||||
const QString filter = ui_->filter->text().toLower();
|
||||
const QString filter = filter_->text().toLower();
|
||||
const bool hide_with_covers = filter_without_covers_->isChecked();
|
||||
const bool hide_without_covers = filter_with_covers_->isChecked();
|
||||
|
||||
|
|
|
@ -28,9 +28,10 @@
|
|||
#include "core/backgroundthread.h"
|
||||
#include "core/song.h"
|
||||
|
||||
class LibraryBackend;
|
||||
class AlbumCoverFetcher;
|
||||
class AlbumCoverSearcher;
|
||||
class LibraryBackend;
|
||||
class LineEditInterface;
|
||||
class Ui_CoverManager;
|
||||
|
||||
class QListWidgetItem;
|
||||
|
@ -146,6 +147,8 @@ class AlbumCoverManager : public QMainWindow {
|
|||
int got_covers_;
|
||||
int missing_covers_;
|
||||
|
||||
LineEditInterface* filter_;
|
||||
|
||||
FRIEND_TEST(AlbumCoverManagerTest, HidesItemsWithCover);
|
||||
FRIEND_TEST(AlbumCoverManagerTest, HidesItemsWithoutCover);
|
||||
FRIEND_TEST(AlbumCoverManagerTest, HidesItemsWithFilter);
|
||||
|
|
Loading…
Reference in New Issue