@@ -18,6 +18,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QUndoStack>
|
||||
#include <QDir>
|
||||
@@ -34,6 +36,7 @@
|
||||
#include <QToolButton>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/deletefiles.h"
|
||||
#include "core/filesystemmusicstorage.h"
|
||||
#include "core/iconloader.h"
|
||||
@@ -45,6 +48,8 @@
|
||||
#include "organize/organizeerrordialog.h"
|
||||
#include "settings/appearancesettingspage.h"
|
||||
|
||||
using std::make_unique;
|
||||
|
||||
const char *FileView::kFileFilter =
|
||||
"*.wav *.flac *.wv *.ogg *.oga *.opus *.spx *.ape *.mpc "
|
||||
"*.mp2 *.mp3 *.m4a *.mp4 *.aac *.asf *.asx *.wma "
|
||||
@@ -124,7 +129,7 @@ void FileView::SetPath(const QString &path) {
|
||||
|
||||
}
|
||||
|
||||
void FileView::SetTaskManager(TaskManager *task_manager) {
|
||||
void FileView::SetTaskManager(SharedPtr<TaskManager> task_manager) {
|
||||
task_manager_ = task_manager;
|
||||
}
|
||||
|
||||
@@ -268,8 +273,8 @@ void FileView::showEvent(QShowEvent *e) {
|
||||
|
||||
model_ = new QFileSystemModel(this);
|
||||
if (!model_->iconProvider() || model_->iconProvider()->icon(QFileIconProvider::Folder).isNull()) {
|
||||
file_icon_provider_ = std::make_unique<QFileIconProvider>();
|
||||
model_->setIconProvider(file_icon_provider_.get());
|
||||
file_icon_provider_ = make_unique<QFileIconProvider>();
|
||||
model_->setIconProvider(&*file_icon_provider_);
|
||||
}
|
||||
|
||||
model_->setNameFilters(filter_list_);
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#ifndef FILEVIEW_H
|
||||
#define FILEVIEW_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QAbstractItemModel>
|
||||
@@ -32,6 +30,8 @@
|
||||
#include <QUrl>
|
||||
#include <QUndoCommand>
|
||||
|
||||
#include "core/scoped_ptr.h"
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/song.h"
|
||||
|
||||
class QMimeData;
|
||||
@@ -57,7 +57,7 @@ class FileView : public QWidget {
|
||||
void ReloadSettings();
|
||||
|
||||
void SetPath(const QString &path);
|
||||
void SetTaskManager(TaskManager *task_manager);
|
||||
void SetTaskManager(SharedPtr<TaskManager> task_manager);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent*) override;
|
||||
@@ -114,14 +114,14 @@ class FileView : public QWidget {
|
||||
QFileSystemModel *model_;
|
||||
QUndoStack *undo_stack_;
|
||||
|
||||
TaskManager *task_manager_;
|
||||
std::shared_ptr<MusicStorage> storage_;
|
||||
SharedPtr<TaskManager> task_manager_;
|
||||
SharedPtr<MusicStorage> storage_;
|
||||
|
||||
QString lazy_set_path_;
|
||||
|
||||
QStringList filter_list_;
|
||||
|
||||
std::unique_ptr<QFileIconProvider> file_icon_provider_;
|
||||
ScopedPtr<QFileIconProvider> file_icon_provider_;
|
||||
};
|
||||
|
||||
#endif // FILEVIEW_H
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QSizePolicy>
|
||||
#include <QPaintEvent>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/taskmanager.h"
|
||||
#include "multiloadingindicator.h"
|
||||
#include "widgets/busyindicator.h"
|
||||
@@ -56,10 +57,10 @@ QSize MultiLoadingIndicator::sizeHint() const {
|
||||
|
||||
}
|
||||
|
||||
void MultiLoadingIndicator::SetTaskManager(TaskManager *task_manager) {
|
||||
void MultiLoadingIndicator::SetTaskManager(SharedPtr<TaskManager> task_manager) {
|
||||
|
||||
task_manager_ = task_manager;
|
||||
QObject::connect(task_manager_, &TaskManager::TasksChanged, this, &MultiLoadingIndicator::UpdateText);
|
||||
QObject::connect(&*task_manager_, &TaskManager::TasksChanged, this, &MultiLoadingIndicator::UpdateText);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
|
||||
#include "core/shared_ptr.h"
|
||||
|
||||
class QPaintEvent;
|
||||
|
||||
class BusyIndicator;
|
||||
@@ -41,7 +43,7 @@ class MultiLoadingIndicator : public QWidget {
|
||||
static const int kHorizontalPadding;
|
||||
static const int kSpacing;
|
||||
|
||||
void SetTaskManager(TaskManager *task_manager);
|
||||
void SetTaskManager(SharedPtr<TaskManager> task_manager);
|
||||
|
||||
QSize sizeHint() const override;
|
||||
|
||||
@@ -55,7 +57,7 @@ class MultiLoadingIndicator : public QWidget {
|
||||
void UpdateText();
|
||||
|
||||
private:
|
||||
TaskManager *task_manager_;
|
||||
SharedPtr<TaskManager> task_manager_;
|
||||
|
||||
BusyIndicator *spinner_;
|
||||
QString text_;
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
#include "covermanager/albumcoverchoicecontroller.h"
|
||||
#include "playingwidget.h"
|
||||
|
||||
using std::make_unique;
|
||||
|
||||
const char *PlayingWidget::kSettingsGroup = "PlayingWidget";
|
||||
|
||||
// Space between the cover and the details in small mode
|
||||
@@ -545,8 +547,8 @@ void PlayingWidget::SearchCoverInProgress() {
|
||||
downloading_covers_ = true;
|
||||
|
||||
// Show a spinner animation
|
||||
spinner_animation_ = std::make_unique<QMovie>(":/pictures/spinner.gif", QByteArray(), this);
|
||||
QObject::connect(spinner_animation_.get(), &QMovie::updated, this, &PlayingWidget::Update);
|
||||
spinner_animation_ = make_unique<QMovie>(":/pictures/spinner.gif", QByteArray(), this);
|
||||
QObject::connect(&*spinner_animation_, &QMovie::updated, this, &PlayingWidget::Update);
|
||||
spinner_animation_->start();
|
||||
update();
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#ifndef PLAYINGWIDGET_H
|
||||
#define PLAYINGWIDGET_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
@@ -34,6 +32,7 @@
|
||||
#include <QAction>
|
||||
#include <QMovie>
|
||||
|
||||
#include "core/scoped_ptr.h"
|
||||
#include "core/song.h"
|
||||
|
||||
class QTimeLine;
|
||||
@@ -137,7 +136,7 @@ class PlayingWidget : public QWidget {
|
||||
QImage image_original_;
|
||||
QPixmap pixmap_cover_;
|
||||
QPixmap pixmap_previous_track_;
|
||||
std::unique_ptr<QMovie> spinner_animation_;
|
||||
ScopedPtr<QMovie> spinner_animation_;
|
||||
|
||||
void SetVisible(const bool visible);
|
||||
void CreateModeAction(const Mode mode, const QString &text, QActionGroup *group);
|
||||
|
||||
Reference in New Issue
Block a user