Skip to content

Commit

Permalink
3rdParty: allow configuration dialog to become smaller in GLideN64
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Feb 25, 2025
1 parent 88a6685 commit b5b81f8
Show file tree
Hide file tree
Showing 3 changed files with 3,504 additions and 3,425 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#include <QRegularExpression>
#include <QInputDialog>
#include <QDirIterator>
#include <qnamespace.h>
#include <QVBoxLayout>
#include <QScrollBar>

#include "../Config.h"
#include "../DebugDump.h"
Expand Down Expand Up @@ -484,6 +485,39 @@ void ConfigDialog::_init(bool reInit, bool blockCustomSettings)
m_blockReInit = false;
}

void ConfigDialog::_setSize(void)
{
// this is a hack to set the initial window
// size without having the scroll bars from the
// scrollArea visible
int width = 0;
int height = 0;

// retrieve layout margins
int layoutWidthMargin = 0;
int layoutHeightMargin = 0;
ui->verticalLayout_3->getContentsMargins(&layoutWidthMargin, &layoutHeightMargin, nullptr, nullptr);

// we'll use the tab with the biggest width
// as a base, then add the scrollbar width
// and the margin padding
width = ui->texturesTab->width();
width += ui->scrollArea->verticalScrollBar()->width();
width += layoutWidthMargin;

// we'll use the tab with the biggest height
// as a base, then add the scrollbar height,
// profiles frame height, buttonbox height
// and then the margin padding
height = ui->tabWidget->height();
height += ui->scrollArea->horizontalScrollBar()->height();
height += ui->profilesFrame->height();
height += ui->buttonBox->height();
height += (layoutHeightMargin * 2);

this->resize(width, height);
}

void ConfigDialog::_getTranslations(QStringList & _translationFiles) const
{
QDir pluginFolder(m_strSharedIniPath);
Expand Down Expand Up @@ -549,6 +583,7 @@ m_maxAnisotropy(_maxAnisotropy)
{
ui->setupUi(this);
_init();
_setSize();
}

ConfigDialog::~ConfigDialog()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ private slots:

private:
void _init(bool reInit = false, bool blockCustomSettings = false);
void _setSize(void);
void _getTranslations(QStringList & _translationFiles) const;
void _switchDest(bool isGame);
QString _hotkeyDescription(quint32 _idx) const;
Expand Down
Loading

0 comments on commit b5b81f8

Please sign in to comment.