Skip to content

Commit

Permalink
Unenable the main menu when the preferences dialog are activated
Browse files Browse the repository at this point in the history
  • Loading branch information
Bollos00 committed Dec 22, 2020
1 parent a9d2dea commit 78aa332
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#############################################################################

message(STATUS "Using CMake version ${CMAKE_VERSION}")
cmake_minimum_required(VERSION 3.1...${CMAKE_VERSION})
cmake_minimum_required(VERSION 3.1.0)
project(libremines)

if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
The following dependencies are required for building and running LibreMines:
* [Qt5 Core](https://doc.qt.io/qt-5/qtcore-index.html) >= 5.12
* [Qt5 Widgets](https://doc.qt.io/qt-5/qtwidgets-index.html) >= 5.12
* [CMake](https://cmake.org/)
* [CMake](https://cmake.org/) >= 3.1


On Arch Linux and derivatives systems the dependencies can be installed with pacman:
Expand Down
3 changes: 3 additions & 0 deletions src/libreminesgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ LibreMinesGui::LibreMinesGui(QWidget *parent, const int thatWidth, const int tha
connect(preferences, &LibreMinesPreferencesDialog::SIGNAL_optionChanged,
this, &LibreMinesGui::SLOT_optionChanged);

connect(preferences, &LibreMinesPreferencesDialog::SIGNAL_visibilityChanged,
[this](const bool visible){ this->centralWidget()->setEnabled(!visible); });

vConfigureInterface(thatWidth, thatHeight);

qApp->installEventFilter(this);
Expand Down
33 changes: 32 additions & 1 deletion src/libreminespreferencesdialog.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*****************************************************************************
* LibreMines *
* Copyright (C) 2020 Bruno Bollos Correa *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************
*/


#include "libreminespreferencesdialog.h"
#include "ui_libreminespreferencesdialog.h"

Expand Down Expand Up @@ -69,7 +89,18 @@ void LibreMinesPreferencesDialog::setOptionUsername(const QString &username)
void LibreMinesPreferencesDialog::closeEvent(QCloseEvent *e)
{
Q_UNUSED(e);

this->hide();
}

void LibreMinesPreferencesDialog::hideEvent(QHideEvent *e)
{
Q_UNUSED(e);
emit SIGNAL_visibilityChanged(false);
}

void LibreMinesPreferencesDialog::showEvent(QShowEvent *e)
{
Q_UNUSED(e);
emit SIGNAL_visibilityChanged(true);
}

23 changes: 23 additions & 0 deletions src/libreminespreferencesdialog.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*****************************************************************************
* LibreMines *
* Copyright (C) 2020 Bruno Bollos Correa *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************
*/


#ifndef LIBREMINESPREFERENCESDIALOG_H
#define LIBREMINESPREFERENCESDIALOG_H

Expand Down Expand Up @@ -27,12 +47,15 @@ class LibreMinesPreferencesDialog : public QDialog

protected:
void closeEvent(QCloseEvent* e);
void hideEvent(QHideEvent* e);
void showEvent(QShowEvent* e);

private:
Ui::LibreMinesPreferencesDialog *ui;

Q_SIGNALS:
void SIGNAL_optionChanged(const QString& name, const QString& value);
void SIGNAL_visibilityChanged(const bool visible);
};

#endif // LIBREMINESPREFERENCESDIALOG_H
20 changes: 20 additions & 0 deletions src/qlabel_adapted.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*****************************************************************************
* LibreMines *
* Copyright (C) 2020 Bruno Bollos Correa *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************
*/


#include "qlabel_adapted.h"

QLabel_adapted::QLabel_adapted(QWidget *parent):
Expand Down
20 changes: 20 additions & 0 deletions src/qlabel_adapted.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*****************************************************************************
* LibreMines *
* Copyright (C) 2020 Bruno Bollos Correa *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************
*/


#ifndef QLABEL_ADAPTED_H
#define QLABEL_ADAPTED_H

Expand Down

0 comments on commit 78aa332

Please sign in to comment.