Make icon sizes configurable, increase default sizes for icons
Fixes #250
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
#include "playlistparsers/playlistparser.h"
|
||||
#include "ui_playlistcontainer.h"
|
||||
#include "widgets/qsearchfield.h"
|
||||
#include "settings/appearancesettingspage.h"
|
||||
|
||||
const char *PlaylistContainer::kSettingsGroup = "Playlist";
|
||||
const int PlaylistContainer::kFilterDelayMs = 100;
|
||||
@@ -231,6 +232,18 @@ void PlaylistContainer::SetViewModel(Playlist *playlist) {
|
||||
|
||||
void PlaylistContainer::ReloadSettings() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
|
||||
int iconsize_playlist_buttons = s.value(AppearanceSettingsPage::kIconSizePlaylistButtons, 20).toInt();
|
||||
s.endGroup();
|
||||
|
||||
ui_->create_new->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
ui_->load->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
ui_->save->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
ui_->clear->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
ui_->undo->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
ui_->redo->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
|
||||
bool playlist_clear = settings_.value("playlist_clear", true).toBool();
|
||||
if (playlist_clear) {
|
||||
ui_->clear->show();
|
||||
|
||||
@@ -61,8 +61,8 @@
|
||||
<widget class="QToolButton" name="create_new">
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
@@ -74,8 +74,8 @@
|
||||
<widget class="QToolButton" name="load">
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
@@ -87,8 +87,8 @@
|
||||
<widget class="QToolButton" name="save">
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
@@ -100,8 +100,8 @@
|
||||
<widget class="QToolButton" name="clear">
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
@@ -113,8 +113,8 @@
|
||||
<widget class="QToolButton" name="undo">
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
@@ -126,8 +126,8 @@
|
||||
<widget class="QToolButton" name="redo">
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <QSize>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QToolButton>
|
||||
@@ -53,6 +54,7 @@
|
||||
#include "playlistmanager.h"
|
||||
#include "ui_playlistlistcontainer.h"
|
||||
#include "organise/organisedialog.h"
|
||||
#include "settings/appearancesettingspage.h"
|
||||
#ifndef Q_OS_WIN
|
||||
# include "device/devicemanager.h"
|
||||
# include "device/devicestatefiltermodel.h"
|
||||
@@ -118,10 +120,52 @@ PlaylistListContainer::PlaylistListContainer(QWidget *parent)
|
||||
|
||||
model_->invisibleRootItem()->setData(PlaylistListModel::Type_Folder, PlaylistListModel::Role_Type);
|
||||
|
||||
ReloadSettings();
|
||||
|
||||
}
|
||||
|
||||
PlaylistListContainer::~PlaylistListContainer() { delete ui_; }
|
||||
|
||||
void PlaylistListContainer::SetApplication(Application *app) {
|
||||
|
||||
app_ = app;
|
||||
PlaylistManager *manager = app_->playlist_manager();
|
||||
Player *player = app_->player();
|
||||
|
||||
connect(manager, SIGNAL(PlaylistAdded(int, QString, bool)), SLOT(AddPlaylist(int, QString, bool)));
|
||||
connect(manager, SIGNAL(PlaylistFavorited(int, bool)), SLOT(PlaylistFavoriteStateChanged(int, bool)));
|
||||
connect(manager, SIGNAL(PlaylistRenamed(int, QString)), SLOT(PlaylistRenamed(int, QString)));
|
||||
connect(manager, SIGNAL(CurrentChanged(Playlist*)), SLOT(CurrentChanged(Playlist*)));
|
||||
connect(manager, SIGNAL(ActiveChanged(Playlist*)), SLOT(ActiveChanged(Playlist*)));
|
||||
|
||||
connect(model_, SIGNAL(PlaylistRenamed(int, QString)), manager, SLOT(Rename(int, QString)));
|
||||
|
||||
connect(player, SIGNAL(Paused()), SLOT(ActivePaused()));
|
||||
connect(player, SIGNAL(Playing()), SLOT(ActivePlaying()));
|
||||
connect(player, SIGNAL(Stopped()), SLOT(ActiveStopped()));
|
||||
|
||||
// Get all playlists, even ones that are hidden in the UI.
|
||||
for (const PlaylistBackend::Playlist &p : app->playlist_backend()->GetAllFavoritePlaylists()) {
|
||||
QStandardItem *playlist_item = model_->NewPlaylist(p.name, p.id);
|
||||
QStandardItem *parent_folder = model_->FolderByPath(p.ui_path);
|
||||
parent_folder->appendRow(playlist_item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PlaylistListContainer::ReloadSettings() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
|
||||
int iconsize = s.value(AppearanceSettingsPage::kIconSizeLeftPanelButtons, 22).toInt();
|
||||
s.endGroup();
|
||||
|
||||
ui_->new_folder->setIconSize(QSize(iconsize, iconsize));
|
||||
ui_->remove->setIconSize(QSize(iconsize, iconsize));
|
||||
ui_->save_playlist->setIconSize(QSize(iconsize, iconsize));
|
||||
|
||||
}
|
||||
|
||||
void PlaylistListContainer::showEvent(QShowEvent *e) {
|
||||
|
||||
// Loading icons is expensive so only do it when the view is first opened
|
||||
@@ -163,33 +207,6 @@ void PlaylistListContainer::RecursivelySetIcons(QStandardItem *parent) const {
|
||||
|
||||
}
|
||||
|
||||
void PlaylistListContainer::SetApplication(Application *app) {
|
||||
|
||||
app_ = app;
|
||||
PlaylistManager *manager = app_->playlist_manager();
|
||||
Player *player = app_->player();
|
||||
|
||||
connect(manager, SIGNAL(PlaylistAdded(int, QString, bool)), SLOT(AddPlaylist(int, QString, bool)));
|
||||
connect(manager, SIGNAL(PlaylistFavorited(int, bool)), SLOT(PlaylistFavoriteStateChanged(int, bool)));
|
||||
connect(manager, SIGNAL(PlaylistRenamed(int, QString)), SLOT(PlaylistRenamed(int, QString)));
|
||||
connect(manager, SIGNAL(CurrentChanged(Playlist*)), SLOT(CurrentChanged(Playlist*)));
|
||||
connect(manager, SIGNAL(ActiveChanged(Playlist*)), SLOT(ActiveChanged(Playlist*)));
|
||||
|
||||
connect(model_, SIGNAL(PlaylistRenamed(int, QString)), manager, SLOT(Rename(int, QString)));
|
||||
|
||||
connect(player, SIGNAL(Paused()), SLOT(ActivePaused()));
|
||||
connect(player, SIGNAL(Playing()), SLOT(ActivePlaying()));
|
||||
connect(player, SIGNAL(Stopped()), SLOT(ActiveStopped()));
|
||||
|
||||
// Get all playlists, even ones that are hidden in the UI.
|
||||
for (const PlaylistBackend::Playlist &p : app->playlist_backend()->GetAllFavoritePlaylists()) {
|
||||
QStandardItem *playlist_item = model_->NewPlaylist(p.name, p.id);
|
||||
QStandardItem *parent_folder = model_->FolderByPath(p.ui_path);
|
||||
parent_folder->appendRow(playlist_item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PlaylistListContainer::NewFolderClicked() {
|
||||
|
||||
QString name = QInputDialog::getText(this, tr("New folder"), tr("Enter the name of the folder"));
|
||||
|
||||
@@ -52,6 +52,7 @@ class PlaylistListContainer : public QWidget {
|
||||
~PlaylistListContainer() override;
|
||||
|
||||
void SetApplication(Application *app);
|
||||
void ReloadSettings();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *e) override;
|
||||
|
||||
@@ -64,6 +64,12 @@
|
||||
<property name="toolTip">
|
||||
<string>New folder</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -71,6 +77,12 @@
|
||||
<property name="toolTip">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -81,7 +93,14 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="save_playlist"/>
|
||||
<widget class="QToolButton" name="save_playlist">
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
|
||||
Reference in New Issue
Block a user