Allow change of thumbnail size without restart
This commit is contained in:
parent
151f521688
commit
e1bed8e1cb
@ -76,6 +76,11 @@ int Image::number() const
|
||||
return m_number;
|
||||
}
|
||||
|
||||
void Image::clearThumbnail()
|
||||
{
|
||||
m_thumbnail.reset();
|
||||
}
|
||||
|
||||
void Image::imageLoaded(void *rawImage, ImageInfoData info)
|
||||
{
|
||||
m_loading = false;
|
||||
@ -284,6 +289,12 @@ void ImageRingList::updateMark()
|
||||
}
|
||||
}
|
||||
|
||||
void ImageRingList::clearThumbnails()
|
||||
{
|
||||
for(auto &img : m_images)
|
||||
img->clearThumbnail();
|
||||
}
|
||||
|
||||
QModelIndex ImageRingList::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
return createIndex(row, column, m_images.at(row).get());
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
ImageInfoData info() const;
|
||||
bool isCurrent() const;
|
||||
int number() const;
|
||||
void clearThumbnail();
|
||||
signals:
|
||||
void pixmapLoaded(Image *ptr);
|
||||
void thumbnailLoaded(Image *ptr);
|
||||
@ -80,6 +81,7 @@ public:
|
||||
int imageCount() const;
|
||||
QStringList imageNames() const;
|
||||
void updateMark();
|
||||
void clearThumbnails();
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex parent(const QModelIndex &child) const override;
|
||||
|
@ -155,6 +155,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
||||
viewMenu->addAction(tr("100%"), m_imageGL, SLOT(oneToOne()));
|
||||
viewMenu->addAction(tr("Fullscreen"), this, SLOT(toggleFullScreen()), Qt::CTRL + Qt::Key_F11);
|
||||
QAction *thumbnailsAction = viewMenu->addAction(tr("Thumbnails"), [this](bool checked){
|
||||
if(SettingsDialog::loadThumbsizes())m_ringList->clearThumbnails();
|
||||
m_imageGL->imageWidget()->allocateThumbnails(m_ringList->imageNames());
|
||||
m_imageGL->imageWidget()->showThumbnail(checked);
|
||||
m_imageGL->setThumbnails(checked ? m_ringList->imageCount() : 0);
|
||||
|
@ -75,6 +75,16 @@ void SettingsDialog::loadSettings()
|
||||
QApplication::setAttribute(Qt::AA_DontUseNativeDialogs, settings.value("settings/dontusenativedialogs", false).toBool());
|
||||
}
|
||||
|
||||
bool SettingsDialog::loadThumbsizes()
|
||||
{
|
||||
QSettings settings;
|
||||
int OLD_THUMB_SIZE = THUMB_SIZE;
|
||||
THUMB_SIZE = settings.value("settings/thumbnailsize", THUMB_SIZE).toInt();
|
||||
THUMB_SIZE_BORDER = THUMB_SIZE + 10;
|
||||
THUMB_SIZE_BORDER_Y = THUMB_SIZE + 30;
|
||||
return OLD_THUMB_SIZE != THUMB_SIZE;
|
||||
}
|
||||
|
||||
void SettingsDialog::saveSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
@ -11,6 +11,7 @@ class SettingsDialog : public QDialog
|
||||
public:
|
||||
explicit SettingsDialog(QWidget *parent = nullptr);
|
||||
static void loadSettings();
|
||||
static bool loadThumbsizes();
|
||||
private:
|
||||
void saveSettings();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user