Formatting
This commit is contained in:
parent
427b9c1ebc
commit
f786a17014
|
@ -56,7 +56,7 @@
|
||||||
template class Analyzer::Base<QWidget>;
|
template class Analyzer::Base<QWidget>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Analyzer::Base::Base(QWidget *parent, uint scopeSize)
|
Analyzer::Base::Base(QWidget *parent, const uint scopeSize)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
timeout_(40),
|
timeout_(40),
|
||||||
fht_(new FHT(scopeSize)),
|
fht_(new FHT(scopeSize)),
|
||||||
|
@ -139,7 +139,7 @@ int Analyzer::Base::resizeExponent(int exp) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Analyzer::Base::resizeForBands(int bands) {
|
int Analyzer::Base::resizeForBands(const int bands) {
|
||||||
|
|
||||||
int exp = 0;
|
int exp = 0;
|
||||||
if (bands <= 8)
|
if (bands <= 8)
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Base : public QWidget {
|
||||||
virtual void framerateChanged() {}
|
virtual void framerateChanged() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit Base(QWidget*, uint scopeSize = 7);
|
explicit Base(QWidget*, const uint scopeSize = 7);
|
||||||
|
|
||||||
void hideEvent(QHideEvent*) override;
|
void hideEvent(QHideEvent*) override;
|
||||||
void showEvent(QShowEvent*) override;
|
void showEvent(QShowEvent*) override;
|
||||||
|
@ -82,10 +82,10 @@ class Base : public QWidget {
|
||||||
void polishEvent();
|
void polishEvent();
|
||||||
|
|
||||||
int resizeExponent(int);
|
int resizeExponent(int);
|
||||||
int resizeForBands(int);
|
int resizeForBands(const int);
|
||||||
virtual void init() {}
|
virtual void init() {}
|
||||||
virtual void transform(Scope&);
|
virtual void transform(Scope&);
|
||||||
virtual void analyze(QPainter& p, const Scope&, bool new_frame) = 0;
|
virtual void analyze(QPainter &p, const Scope&, const bool new_frame) = 0;
|
||||||
virtual void demo(QPainter &p);
|
virtual void demo(QPainter &p);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -65,11 +65,11 @@ BoomAnalyzer::BoomAnalyzer(QWidget* parent)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoomAnalyzer::changeK_barHeight(int newValue) {
|
void BoomAnalyzer::changeK_barHeight(const int newValue) {
|
||||||
K_barHeight_ = static_cast<double>(newValue) / 1000;
|
K_barHeight_ = static_cast<double>(newValue) / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoomAnalyzer::changeF_peakSpeed(int newValue) {
|
void BoomAnalyzer::changeF_peakSpeed(const int newValue) {
|
||||||
F_peakSpeed_ = static_cast<double>(newValue) / 1000;
|
F_peakSpeed_ = static_cast<double>(newValue) / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ void BoomAnalyzer::transform(Scope& s) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoomAnalyzer::analyze(QPainter& p, const Scope& scope, bool new_frame) {
|
void BoomAnalyzer::analyze(QPainter &p, const Scope &scope, const bool new_frame) {
|
||||||
|
|
||||||
if (!new_frame || engine_->state() == Engine::Paused) {
|
if (!new_frame || engine_->state() == Engine::Paused) {
|
||||||
p.drawPixmap(0, 0, canvas_);
|
p.drawPixmap(0, 0, canvas_);
|
||||||
|
|
|
@ -45,7 +45,7 @@ class BoomAnalyzer : public Analyzer::Base {
|
||||||
static const char *kName;
|
static const char *kName;
|
||||||
|
|
||||||
void transform(Analyzer::Scope &s) override;
|
void transform(Analyzer::Scope &s) override;
|
||||||
void analyze(QPainter &p, const Analyzer::Scope&, bool new_frame) override;
|
void analyze(QPainter &p, const Analyzer::Scope&, const bool new_frame) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void changeK_barHeight(int);
|
void changeK_barHeight(int);
|
||||||
|
|
|
@ -78,7 +78,7 @@ SCollection::~SCollection() {
|
||||||
}
|
}
|
||||||
if (watcher_thread_) {
|
if (watcher_thread_) {
|
||||||
watcher_thread_->exit();
|
watcher_thread_->exit();
|
||||||
watcher_thread_->wait(5000 /* five seconds */);
|
watcher_thread_->wait(5000);
|
||||||
}
|
}
|
||||||
backend_->deleteLater();
|
backend_->deleteLater();
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ void MacFSListener::UpdateStreamAsync() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacFSListener::UpdateStream() {
|
void MacFSListener::UpdateStream() {
|
||||||
|
|
||||||
if (stream_) {
|
if (stream_) {
|
||||||
FSEventStreamStop(stream_);
|
FSEventStreamStop(stream_);
|
||||||
FSEventStreamInvalidate(stream_);
|
FSEventStreamInvalidate(stream_);
|
||||||
|
@ -123,5 +124,5 @@ void MacFSListener::UpdateStream() {
|
||||||
|
|
||||||
FSEventStreamScheduleWithRunLoop(stream_, run_loop_, kCFRunLoopDefaultMode);
|
FSEventStreamScheduleWithRunLoop(stream_, run_loop_, kCFRunLoopDefaultMode);
|
||||||
FSEventStreamStart(stream_);
|
FSEventStreamStart(stream_);
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ int DeviceDatabaseBackend::AddDevice(const Device &device) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceDatabaseBackend::RemoveDevice(int id) {
|
void DeviceDatabaseBackend::RemoveDevice(const int id) {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
|
@ -176,7 +176,7 @@ void DeviceDatabaseBackend::RemoveDevice(int id) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceDatabaseBackend::SetDeviceOptions(int id, const QString &friendly_name, const QString &icon_name, MusicStorage::TranscodeMode mode, Song::FileType format) {
|
void DeviceDatabaseBackend::SetDeviceOptions(const int id, const QString &friendly_name, const QString &icon_name, const MusicStorage::TranscodeMode mode, const Song::FileType format) {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
|
@ -198,4 +198,3 @@ void DeviceDatabaseBackend::SetDeviceOptions(int id, const QString &friendly_nam
|
||||||
db_->CheckErrors(q);
|
db_->CheckErrors(q);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,9 +65,9 @@ class DeviceDatabaseBackend : public QObject {
|
||||||
|
|
||||||
DeviceList GetAllDevices();
|
DeviceList GetAllDevices();
|
||||||
int AddDevice(const Device &device);
|
int AddDevice(const Device &device);
|
||||||
void RemoveDevice(int id);
|
void RemoveDevice(const int id);
|
||||||
|
|
||||||
void SetDeviceOptions(int id, const QString &friendly_name, const QString &icon_name, MusicStorage::TranscodeMode mode, Song::FileType format);
|
void SetDeviceOptions(const int id, const QString &friendly_name, const QString &icon_name, const MusicStorage::TranscodeMode mode, const Song::FileType format);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void Exit();
|
void Exit();
|
||||||
|
|
|
@ -107,7 +107,7 @@ void GPodDevice::Close() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPodDevice::LoadFinished(Itdb_iTunesDB *db, bool success) {
|
void GPodDevice::LoadFinished(Itdb_iTunesDB *db, const bool success) {
|
||||||
|
|
||||||
QMutexLocker l(&db_mutex_);
|
QMutexLocker l(&db_mutex_);
|
||||||
db_ = db;
|
db_ = db;
|
||||||
|
|
|
@ -73,7 +73,7 @@ class GPodDevice : public ConnectedDevice, public virtual MusicStorage {
|
||||||
void FinishDelete(bool success) override;
|
void FinishDelete(bool success) override;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void LoadFinished(Itdb_iTunesDB *db, bool success);
|
void LoadFinished(Itdb_iTunesDB *db, const bool success);
|
||||||
void LoaderError(const QString &message);
|
void LoaderError(const QString &message);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -49,7 +49,7 @@ class DeviceManager;
|
||||||
|
|
||||||
bool MtpDevice::sInitializedLibMTP = false;
|
bool MtpDevice::sInitializedLibMTP = false;
|
||||||
|
|
||||||
MtpDevice::MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
|
MtpDevice::MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time)
|
||||||
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
|
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
|
||||||
loader_(nullptr),
|
loader_(nullptr),
|
||||||
loader_thread_(nullptr),
|
loader_thread_(nullptr),
|
||||||
|
@ -112,7 +112,7 @@ void MtpDevice::Close() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MtpDevice::LoadFinished(bool success, MtpConnection *connection) {
|
void MtpDevice::LoadFinished(const bool success, MtpConnection *connection) {
|
||||||
|
|
||||||
connection_.reset(connection);
|
connection_.reset(connection);
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ bool MtpDevice::CopyToStorage(const CopyJob &job) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MtpDevice::FinishCopy(bool success) {
|
void MtpDevice::FinishCopy(const bool success) {
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
if (!songs_to_add_.isEmpty()) backend_->AddOrUpdateSongs(songs_to_add_);
|
if (!songs_to_add_.isEmpty()) backend_->AddOrUpdateSongs(songs_to_add_);
|
||||||
|
@ -234,7 +234,7 @@ bool MtpDevice::DeleteFromStorage(const DeleteJob &job) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MtpDevice::FinishDelete(bool success) { FinishCopy(success); }
|
void MtpDevice::FinishDelete(const bool success) { FinishCopy(success); }
|
||||||
|
|
||||||
bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType> *ret) {
|
bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType> *ret) {
|
||||||
|
|
||||||
|
@ -286,4 +286,3 @@ bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType> *ret, LIBMTP_mtpdevi
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class MtpDevice : public ConnectedDevice {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time);
|
Q_INVOKABLE MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time);
|
||||||
~MtpDevice() override;
|
~MtpDevice() override;
|
||||||
|
|
||||||
static QStringList url_schemes() { return QStringList() << "mtp"; }
|
static QStringList url_schemes() { return QStringList() << "mtp"; }
|
||||||
|
@ -64,11 +64,11 @@ class MtpDevice : public ConnectedDevice {
|
||||||
|
|
||||||
bool StartCopy(QList<Song::FileType> *supported_types) override;
|
bool StartCopy(QList<Song::FileType> *supported_types) override;
|
||||||
bool CopyToStorage(const CopyJob &job) override;
|
bool CopyToStorage(const CopyJob &job) override;
|
||||||
void FinishCopy(bool success) override;
|
void FinishCopy(const bool success) override;
|
||||||
|
|
||||||
void StartDelete() override;
|
void StartDelete() override;
|
||||||
bool DeleteFromStorage(const DeleteJob &job) override;
|
bool DeleteFromStorage(const DeleteJob &job) override;
|
||||||
void FinishDelete(bool success) override;
|
void FinishDelete(const bool success) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void LoadFinished(bool success, MtpConnection *connection);
|
void LoadFinished(bool success, MtpConnection *connection);
|
||||||
|
|
|
@ -168,7 +168,7 @@ void Equalizer::AddPreset(const QString& name, const Params& params) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Equalizer::PresetChanged(int index) {
|
void Equalizer::PresetChanged(const int index) {
|
||||||
|
|
||||||
PresetChanged(ui_->preset->itemData(index).toString());
|
PresetChanged(ui_->preset->itemData(index).toString());
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ void Equalizer::StereoBalancerEnabledChangedSlot(const bool enabled) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Equalizer::StereoBalanceSliderChanged(int) {
|
void Equalizer::StereoBalanceSliderChanged(const int) {
|
||||||
|
|
||||||
emit StereoBalanceChanged(stereo_balance());
|
emit StereoBalanceChanged(stereo_balance());
|
||||||
Save();
|
Save();
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Equalizer : public QDialog {
|
||||||
void EqualizerEnabledChangedSlot(const bool enabled);
|
void EqualizerEnabledChangedSlot(const bool enabled);
|
||||||
void EqualizerParametersChangedSlot();
|
void EqualizerParametersChangedSlot();
|
||||||
void PresetChanged(const QString &name);
|
void PresetChanged(const QString &name);
|
||||||
void PresetChanged(int index);
|
void PresetChanged(const int index);
|
||||||
void SavePreset();
|
void SavePreset();
|
||||||
void DelPreset();
|
void DelPreset();
|
||||||
void Save();
|
void Save();
|
||||||
|
|
|
@ -43,6 +43,7 @@ class MacMonitorWrapper {
|
||||||
};
|
};
|
||||||
|
|
||||||
bool GlobalShortcutGrabber::HandleMacEvent(NSEvent *event) {
|
bool GlobalShortcutGrabber::HandleMacEvent(NSEvent *event) {
|
||||||
|
|
||||||
ret_ = mac::KeySequenceFromNSEvent(event);
|
ret_ = mac::KeySequenceFromNSEvent(event);
|
||||||
UpdateText();
|
UpdateText();
|
||||||
if ([[event charactersIgnoringModifiers] length] != 0) {
|
if ([[event charactersIgnoringModifiers] length] != 0) {
|
||||||
|
@ -50,13 +51,16 @@ bool GlobalShortcutGrabber::HandleMacEvent(NSEvent* event) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ret_ == QKeySequence(Qt::Key_Escape);
|
return ret_ == QKeySequence(Qt::Key_Escape);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalShortcutGrabber::SetupMacEventHandler() {
|
void GlobalShortcutGrabber::SetupMacEventHandler() {
|
||||||
|
|
||||||
id monitor = [NSEvent addLocalMonitorForEventsMatchingMask: NSEventMaskKeyDown handler:^(NSEvent *event) {
|
id monitor = [NSEvent addLocalMonitorForEventsMatchingMask: NSEventMaskKeyDown handler:^(NSEvent *event) {
|
||||||
return HandleMacEvent(event) ? event : nil;
|
return HandleMacEvent(event) ? event : nil;
|
||||||
}];
|
}];
|
||||||
wrapper_ = new MacMonitorWrapper(monitor);
|
wrapper_ = new MacMonitorWrapper(monitor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalShortcutGrabber::TeardownMacEventHandler() { delete wrapper_; }
|
void GlobalShortcutGrabber::TeardownMacEventHandler() { delete wrapper_; }
|
||||||
|
|
|
@ -88,7 +88,8 @@ bool GlobalShortcutsBackendMacOS::DoRegister() {
|
||||||
// Always enable media keys.
|
// Always enable media keys.
|
||||||
mac::SetShortcutHandler(this);
|
mac::SetShortcutHandler(this);
|
||||||
|
|
||||||
for (const GlobalShortcutsManager::Shortcut& shortcut : manager_->shortcuts().values()) {
|
QList<GlobalShortcutsManager::Shortcut> shortcuts = manager_->shortcuts().values();
|
||||||
|
for (const GlobalShortcutsManager::Shortcut &shortcut : shortcuts) {
|
||||||
shortcuts_[shortcut.action->shortcut()] = shortcut.action;
|
shortcuts_[shortcut.action->shortcut()] = shortcut.action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,8 @@ bool GlobalShortcutsBackendSystem::DoRegister() {
|
||||||
|
|
||||||
if (!gshortcut_init_) gshortcut_init_ = new GlobalShortcut(this);
|
if (!gshortcut_init_) gshortcut_init_ = new GlobalShortcut(this);
|
||||||
|
|
||||||
for (const GlobalShortcutsManager::Shortcut &shortcut : manager_->shortcuts().values()) {
|
QList<GlobalShortcutsManager::Shortcut> shortcuts = manager_->shortcuts().values();
|
||||||
|
for (const GlobalShortcutsManager::Shortcut &shortcut : shortcuts) {
|
||||||
AddShortcut(shortcut.action);
|
AddShortcut(shortcut.action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ void AcoustidClient::CancelAll() {
|
||||||
namespace {
|
namespace {
|
||||||
// Struct used when extracting results in RequestFinished
|
// Struct used when extracting results in RequestFinished
|
||||||
struct IdSource {
|
struct IdSource {
|
||||||
IdSource(const QString& id, int source)
|
IdSource(const QString &id, const int source)
|
||||||
: id_(id), nb_sources_(source) {}
|
: id_(id), nb_sources_(source) {}
|
||||||
|
|
||||||
bool operator<(const IdSource &other) const {
|
bool operator<(const IdSource &other) const {
|
||||||
|
|
|
@ -557,17 +557,17 @@ QPoint OSDPretty::current_pos() const {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSDPretty::set_background_color(QRgb color) {
|
void OSDPretty::set_background_color(const QRgb color) {
|
||||||
background_color_ = color;
|
background_color_ = color;
|
||||||
if (isVisible()) update();
|
if (isVisible()) update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSDPretty::set_background_opacity(qreal opacity) {
|
void OSDPretty::set_background_opacity(const qreal opacity) {
|
||||||
background_opacity_ = opacity;
|
background_opacity_ = opacity;
|
||||||
if (isVisible()) update();
|
if (isVisible()) update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSDPretty::set_foreground_color(QRgb color) {
|
void OSDPretty::set_foreground_color(const QRgb color) {
|
||||||
|
|
||||||
foreground_color_ = QColor(color);
|
foreground_color_ = QColor(color);
|
||||||
|
|
||||||
|
@ -579,11 +579,11 @@ void OSDPretty::set_foreground_color(QRgb color) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSDPretty::set_popup_duration(int msec) {
|
void OSDPretty::set_popup_duration(const int msec) {
|
||||||
timeout_->setInterval(msec);
|
timeout_->setInterval(msec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSDPretty::set_font(QFont font) {
|
void OSDPretty::set_font(const QFont font) {
|
||||||
|
|
||||||
font_ = font;
|
font_ = font;
|
||||||
|
|
||||||
|
|
|
@ -77,13 +77,13 @@ class OSDPretty : public QWidget {
|
||||||
void ShowMessage(const QString &summary, const QString &message, const QImage &image);
|
void ShowMessage(const QString &summary, const QString &message, const QImage &image);
|
||||||
|
|
||||||
// Popup duration in seconds. Only used in Mode_Popup.
|
// Popup duration in seconds. Only used in Mode_Popup.
|
||||||
void set_popup_duration(int msec);
|
void set_popup_duration(const int msec);
|
||||||
|
|
||||||
// These will get overwritten when ReloadSettings() is called
|
// These will get overwritten when ReloadSettings() is called
|
||||||
void set_foreground_color(QRgb color);
|
void set_foreground_color(const QRgb color);
|
||||||
void set_background_color(QRgb color);
|
void set_background_color(const QRgb color);
|
||||||
void set_background_opacity(qreal opacity);
|
void set_background_opacity(const qreal opacity);
|
||||||
void set_font(QFont font);
|
void set_font(const QFont font);
|
||||||
|
|
||||||
QRgb foreground_color() const { return foreground_color_.rgb(); }
|
QRgb foreground_color() const { return foreground_color_.rgb(); }
|
||||||
QRgb background_color() const { return background_color_.rgb(); }
|
QRgb background_color() const { return background_color_.rgb(); }
|
||||||
|
@ -104,7 +104,7 @@ class OSDPretty : public QWidget {
|
||||||
void setVisible(bool visible) override;
|
void setVisible(bool visible) override;
|
||||||
|
|
||||||
bool toggle_mode() const { return toggle_mode_; }
|
bool toggle_mode() const { return toggle_mode_; }
|
||||||
void set_toggle_mode(bool toggle_mode) { toggle_mode_ = toggle_mode; }
|
void set_toggle_mode(const bool toggle_mode) { toggle_mode_ = toggle_mode; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void PositionChanged();
|
void PositionChanged();
|
||||||
|
|
|
@ -81,8 +81,8 @@ class PlaylistSequence : public QWidget {
|
||||||
void ShuffleModeChanged(PlaylistSequence::ShuffleMode mode);
|
void ShuffleModeChanged(PlaylistSequence::ShuffleMode mode);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void RepeatActionTriggered(QAction *);
|
void RepeatActionTriggered(QAction *action);
|
||||||
void ShuffleActionTriggered(QAction *);
|
void ShuffleActionTriggered(QAction *action);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Load();
|
void Load();
|
||||||
|
|
|
@ -69,7 +69,8 @@ void FileViewList::contextMenuEvent(QContextMenuEvent *e) {
|
||||||
QList<QUrl> FileViewList::UrlListFromSelection() const {
|
QList<QUrl> FileViewList::UrlListFromSelection() const {
|
||||||
|
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
for (const QModelIndex& index : menu_selection_.indexes()) {
|
const QModelIndexList indexes = menu_selection_.indexes();
|
||||||
|
for (const QModelIndex &index : indexes) {
|
||||||
if (index.column() == 0)
|
if (index.column() == 0)
|
||||||
urls << QUrl::fromLocalFile(qobject_cast<QFileSystemModel*>(model())->fileInfo(index).canonicalFilePath());
|
urls << QUrl::fromLocalFile(qobject_cast<QFileSystemModel*>(model())->fileInfo(index).canonicalFilePath());
|
||||||
}
|
}
|
||||||
|
@ -119,7 +120,8 @@ MimeData *FileViewList::MimeDataFromSelection() const {
|
||||||
QStringList FileViewList::FilenamesFromSelection() const {
|
QStringList FileViewList::FilenamesFromSelection() const {
|
||||||
|
|
||||||
QStringList filenames;
|
QStringList filenames;
|
||||||
for (const QModelIndex& index : menu_selection_.indexes()) {
|
const QModelIndexList indexes = menu_selection_.indexes();
|
||||||
|
for (const QModelIndex &index : indexes) {
|
||||||
if (index.column() == 0)
|
if (index.column() == 0)
|
||||||
filenames << qobject_cast<QFileSystemModel*>(model())->filePath(index);
|
filenames << qobject_cast<QFileSystemModel*>(model())->filePath(index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,6 @@ const QRgb FreeSpaceBar::kColorBar1 = qRgb(250, 148, 76);
|
||||||
const QRgb FreeSpaceBar::kColorBar2 = qRgb(214, 102, 24);
|
const QRgb FreeSpaceBar::kColorBar2 = qRgb(214, 102, 24);
|
||||||
const QRgb FreeSpaceBar::kColorBorder = qRgb(174, 168, 162);
|
const QRgb FreeSpaceBar::kColorBorder = qRgb(174, 168, 162);
|
||||||
|
|
||||||
|
|
||||||
FreeSpaceBar::FreeSpaceBar(QWidget *parent)
|
FreeSpaceBar::FreeSpaceBar(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
free_(100),
|
free_(100),
|
||||||
|
@ -232,17 +231,21 @@ void FreeSpaceBar::DrawText(QPainter* p, const QRect &r) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FreeSpaceBar::TextForSize(const QString &prefix, qint64 size) const {
|
QString FreeSpaceBar::TextForSize(const QString &prefix, const qint64 size) const {
|
||||||
|
|
||||||
QString ret;
|
QString ret;
|
||||||
if (size > 0)
|
if (size > 0) {
|
||||||
ret = Utilities::PrettySize(size);
|
ret = Utilities::PrettySize(size);
|
||||||
else if (size < 0)
|
}
|
||||||
|
else if (size < 0) {
|
||||||
ret = "-" + Utilities::PrettySize(-size);
|
ret = "-" + Utilities::PrettySize(-size);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
ret = "0 MB";
|
ret = "0 MB";
|
||||||
|
}
|
||||||
|
|
||||||
if (!prefix.isEmpty()) ret.prepend(prefix + " ");
|
if (!prefix.isEmpty()) ret.prepend(prefix + " ");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,9 +56,9 @@ class FreeSpaceBar : public QWidget {
|
||||||
static const QRgb kColorBar2;
|
static const QRgb kColorBar2;
|
||||||
static const QRgb kColorBorder;
|
static const QRgb kColorBorder;
|
||||||
|
|
||||||
void set_free_bytes(qint64 bytes) { free_ = bytes; update(); }
|
void set_free_bytes(const qint64 bytes) { free_ = bytes; update(); }
|
||||||
void set_additional_bytes(qint64 bytes) { additional_ = bytes; update(); }
|
void set_additional_bytes(const qint64 bytes) { additional_ = bytes; update(); }
|
||||||
void set_total_bytes(qint64 bytes) { total_ = bytes; update(); }
|
void set_total_bytes(const qint64 bytes) { total_ = bytes; update(); }
|
||||||
|
|
||||||
void set_free_text(const QString &text) { free_text_ = text; update(); }
|
void set_free_text(const QString &text) { free_text_ = text; update(); }
|
||||||
void set_additional_text(const QString &text) { additional_text_ = text; update(); }
|
void set_additional_text(const QString &text) { additional_text_ = text; update(); }
|
||||||
|
@ -77,7 +77,7 @@ class FreeSpaceBar : public QWidget {
|
||||||
QColor color;
|
QColor color;
|
||||||
};
|
};
|
||||||
|
|
||||||
QString TextForSize(const QString &prefix, qint64 size) const;
|
QString TextForSize(const QString &prefix, const qint64 size) const;
|
||||||
|
|
||||||
void DrawBar(QPainter *p, const QRect &r);
|
void DrawBar(QPainter *p, const QRect &r);
|
||||||
void DrawText(QPainter *p, const QRect &r);
|
void DrawText(QPainter *p, const QRect &r);
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#include <QFlags>
|
#include <QFlags>
|
||||||
#include <QtEvents>
|
#include <QtEvents>
|
||||||
|
|
||||||
SliderSlider::SliderSlider(Qt::Orientation orientation, QWidget* parent, uint max)
|
SliderSlider::SliderSlider(const Qt::Orientation orientation, QWidget *parent, const uint max)
|
||||||
: QSlider(orientation, parent),
|
: QSlider(orientation, parent),
|
||||||
sliding_(false),
|
sliding_(false),
|
||||||
outside_(false),
|
outside_(false),
|
||||||
|
|
|
@ -44,7 +44,7 @@ class SliderSlider : public QSlider {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SliderSlider(Qt::Orientation, QWidget*, const uint max = 0);
|
explicit SliderSlider(const Qt::Orientation, QWidget*, const uint max = 0);
|
||||||
|
|
||||||
virtual void setValue(int);
|
virtual void setValue(int);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue