From 7b00d47fe0be0e23d1267699a8491c1dc577f76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 2 Aug 2019 23:52:19 +0200 Subject: [PATCH] NOISSUE tweak UI geometry and remove old language selection --- application/InstanceWindow.cpp | 1 + application/MainWindow.cpp | 1 - application/pagedialog/PageDialog.cpp | 1 + .../pages/global/CustomCommandsPage.cpp | 1 + application/pages/global/MultiMCPage.cpp | 24 ------------------- application/pages/global/MultiMCPage.h | 2 -- application/pages/global/MultiMCPage.ui | 15 +----------- .../widgets/LanguageSelectionWidget.cpp | 1 + application/widgets/PageContainer.cpp | 11 ++++----- 9 files changed, 10 insertions(+), 47 deletions(-) diff --git a/application/InstanceWindow.cpp b/application/InstanceWindow.cpp index 75b17f36..02c1bb23 100644 --- a/application/InstanceWindow.cpp +++ b/application/InstanceWindow.cpp @@ -50,6 +50,7 @@ InstanceWindow::InstanceWindow(InstancePtr instance, QWidget *parent) m_container = new PageContainer(provider.get(), "console", this); m_container->setParentContainer(this); setCentralWidget(m_container); + setContentsMargins(0, 0, 0, 0); } // Add custom buttons to the page container layout. diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index 90c7ca97..00893b17 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -585,7 +585,6 @@ public: centralWidget->setObjectName(QStringLiteral("centralWidget")); horizontalLayout = new QHBoxLayout(centralWidget); horizontalLayout->setSpacing(0); - horizontalLayout->setContentsMargins(11, 11, 11, 11); horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); horizontalLayout->setSizeConstraint(QLayout::SetDefaultConstraint); horizontalLayout->setContentsMargins(0, 0, 0, 0); diff --git a/application/pagedialog/PageDialog.cpp b/application/pagedialog/PageDialog.cpp index 9f93ab6d..a1a78d78 100644 --- a/application/pagedialog/PageDialog.cpp +++ b/application/pagedialog/PageDialog.cpp @@ -39,6 +39,7 @@ PageDialog::PageDialog(BasePageProvider *pageProvider, QString defaultId, QWidge QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Close); buttons->button(QDialogButtonBox::Close)->setDefault(true); + buttons->setContentsMargins(6, 0, 6, 0); m_container->addButtons(buttons); connect(buttons->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(close())); diff --git a/application/pages/global/CustomCommandsPage.cpp b/application/pages/global/CustomCommandsPage.cpp index f2c3b185..3b182319 100644 --- a/application/pages/global/CustomCommandsPage.cpp +++ b/application/pages/global/CustomCommandsPage.cpp @@ -13,6 +13,7 @@ CustomCommandsPage::CustomCommandsPage(QWidget* parent): QWidget(parent) auto tabWidget = new QTabWidget(this); tabWidget->setObjectName(QStringLiteral("tabWidget")); commands = new CustomCommands(this); + commands->setContentsMargins(6, 6, 6, 6); tabWidget->addTab(commands, "Foo"); tabWidget->tabBar()->hide(); verticalLayout->addWidget(tabWidget); diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCPage.cpp index 9baaa55b..541af287 100644 --- a/application/pages/global/MultiMCPage.cpp +++ b/application/pages/global/MultiMCPage.cpp @@ -78,7 +78,6 @@ MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCP } connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview())); connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview())); - connect(ui->languageBox, SIGNAL(currentIndexChanged(int)), SLOT(languageIndexChanged(int))); } MultiMCPage::~MultiMCPage() @@ -147,19 +146,6 @@ void MultiMCPage::on_modsDirBrowseBtn_clicked() } } -void MultiMCPage::languageIndexChanged(int index) -{ - auto languageCode = ui->languageBox->itemData(ui->languageBox->currentIndex()).toString(); - if(languageCode.isEmpty()) - { - qWarning() << "Unknown language at index" << index; - return; - } - auto translations = MMC->translations(); - translations->selectLanguage(languageCode); - translations->updateLanguage(languageCode); -} - void MultiMCPage::refreshUpdateChannelList() { // Stop listening for selection changes. It's going to change a lot while we update it and @@ -236,10 +222,6 @@ void MultiMCPage::applySettings() { auto s = MMC->settings(); - // Language - auto langCode = ui->languageBox->itemData(ui->languageBox->currentIndex()).toString(); - s->set("Language", langCode.isEmpty() ? "en" : langCode); - if (ui->resetNotificationsBtn->isChecked()) { s->set("ShownNotifications", QString()); @@ -332,12 +314,6 @@ void MultiMCPage::applySettings() void MultiMCPage::loadSettings() { auto s = MMC->settings(); - // Language - { - ui->languageBox->setModel(m_languageModel.get()); - ui->languageBox->setCurrentIndex(ui->languageBox->findData(s->get("Language").toString())); - } - // Updates ui->autoUpdateCheckBox->setChecked(s->get("AutoUpdate").toBool()); m_currentUpdateChannel = s->get("UpdateChannel").toString(); diff --git a/application/pages/global/MultiMCPage.h b/application/pages/global/MultiMCPage.h index 7e7f655d..27a801be 100644 --- a/application/pages/global/MultiMCPage.h +++ b/application/pages/global/MultiMCPage.h @@ -68,8 +68,6 @@ slots: void on_modsDirBrowseBtn_clicked(); void on_iconsDirBrowseBtn_clicked(); - void languageIndexChanged(int index); - /*! * Updates the list of update channels in the combo box. */ diff --git a/application/pages/global/MultiMCPage.ui b/application/pages/global/MultiMCPage.ui index 124401c3..ea034919 100644 --- a/application/pages/global/MultiMCPage.ui +++ b/application/pages/global/MultiMCPage.ui @@ -6,7 +6,7 @@ 0 0 - 467 + 514 629 @@ -228,18 +228,6 @@ - - - - Language: - - - - - - - - @@ -570,7 +558,6 @@ resetNotificationsBtn sortLastLaunchedBtn sortByNameBtn - languageBox themeComboBox themeComboBoxColors showConsoleCheck diff --git a/application/widgets/LanguageSelectionWidget.cpp b/application/widgets/LanguageSelectionWidget.cpp index dae8113d..80e26b39 100644 --- a/application/widgets/LanguageSelectionWidget.cpp +++ b/application/widgets/LanguageSelectionWidget.cpp @@ -36,6 +36,7 @@ LanguageSelectionWidget::LanguageSelectionWidget(QWidget *parent) : languageView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); languageView->header()->setSectionResizeMode(0, QHeaderView::Stretch); connect(languageView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LanguageSelectionWidget::languageRowChanged); + verticalLayout->setContentsMargins(0,0,0,0); } QString LanguageSelectionWidget::getSelectedLanguageKey() const diff --git a/application/widgets/PageContainer.cpp b/application/widgets/PageContainer.cpp index a3d3e257..376e119b 100644 --- a/application/widgets/PageContainer.cpp +++ b/application/widgets/PageContainer.cpp @@ -140,15 +140,13 @@ void PageContainer::createUI() QHBoxLayout *headerHLayout = new QHBoxLayout; const int leftMargin = MMC->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); - headerHLayout->addSpacerItem( - new QSpacerItem(leftMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored)); + headerHLayout->addSpacerItem(new QSpacerItem(leftMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored)); headerHLayout->addWidget(m_header); - headerHLayout->addSpacerItem( - new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored)); + headerHLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored)); headerHLayout->addWidget(m_iconHeader); const int rightMargin = MMC->style()->pixelMetric(QStyle::PM_LayoutRightMargin); - headerHLayout->addSpacerItem( - new QSpacerItem(rightMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored)); + headerHLayout->addSpacerItem(new QSpacerItem(rightMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored)); + headerHLayout->setContentsMargins(0, 6, 0, 0); m_pageStack->setMargin(0); m_pageStack->addWidget(new QWidget(this)); @@ -158,6 +156,7 @@ void PageContainer::createUI() m_layout->addWidget(m_pageList, 0, 0, 2, 1); m_layout->addLayout(m_pageStack, 1, 1, 1, 1); m_layout->setColumnStretch(1, 4); + m_layout->setContentsMargins(0,0,0,6); setLayout(m_layout); }