mudlet/src/dlgMapLabel.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

271 lines
11 KiB
C++
Raw Permalink Normal View History

/***************************************************************************
* Copyright (C) 2022 by Piotr Wilczynski - delwing@gmail.com *
2022-12-09 13:53:13 +00:00
* Copyright (C) 2022 by Stephen Lyons - slysven@virginmedia.com *
* *
* 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 2 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, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
2022-12-09 13:53:13 +00:00
#include "dlgMapLabel.h"
#include "mudlet.h"
2022-12-09 13:53:13 +00:00
#include "utils.h"
#include <QColorDialog>
#include <QFileDialog>
#include <QFontDialog>
#include <QSettings>
2022-12-09 13:53:13 +00:00
static QString BUTTON_STYLESHEET = qsl("QPushButton { background-color: rgba(%1, %2, %3, %4); }");
dlgMapLabel::dlgMapLabel(QWidget* pParentWidget)
: QDialog(pParentWidget)
{
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
//: Create label dialog title
setWindowTitle(tr("Create label"));
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
connect(comboBox_type, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &dlgMapLabel::slot_updateControlsVisibility);
connect(comboBox_type, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &dlgMapLabel::updated);
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
connect(toolButton_imagePick, &QToolButton::released, this, &dlgMapLabel::slot_pickFile);
Fix reduce c++20warnings (#7638) #### Brief overview of PR changes/additions 1. Adds explicit ‘this’ or ‘*this’ capture to lambdas where required (not in static ones). 2. Rephrases some combinations of Qt `enum`s that whilst acceptable for C++17 upset the later one. For the non-key related ones which are provided a `int`s arguments to a method this is sufficient; For Qt 6 there are some additional methods that overcome the "incompatibility" of combining such different `enum`s but those have not been back ported to the Qt 5.15.8 I have - despite what https://bugreports.qt.io/browse/QTBUG-99948 says - so fixes for combining QKey and QKeyModifier have been left out of this PR. 3. Removes a couple of unused variables. 4. Adds our `qsl(...)` wrapper about some raw C-string literals used in a loop. 5. Rewrite part of the qmake project file so the logic and choices are correct. #### Motivation for adding to Mudlet 1. To eliminate the following type of warning when building with a C++20 compiler: "warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]" 2. To eliminate the following type of warning when building with a C++20 compiler: * warning: bitwise operation between different enumeration types ‘QFont::Weight’ and ‘QFont::StyleHint’ is deprecated [-Wdeprecated-enum-enum-conversion] * warning: bitwise operation between different enumeration types ‘Qt::TextFlag’ and ‘Qt::AlignmentFlag’ is deprecated [-Wdeprecated-enum-enum-conversion] 3. To eliminate the following type of warning when building with a C++20 compiler: "warning: unused variable ‘pHost’ [-Wunused-variable]" 4. To eliminate the following type of warning when building with a C++20 compiler: "warning: loop variable ‘file’ of type ‘const QString&’ binds to a temporary constructed from type ‘const char* const’ [-Wrange-loop-construct]" 5. The previous logic was (incorrect) IF Qt Major version is less than 5 OR (if Qt Major version is less than 6 AND if Qt Minor version is less than 12)) THEN add `-std=c++20` to `QMAKE_CXXFLAGS` ELSE add `c++2a` to `CONFIG` This is borked because we have already rejected Qt versions less than 5.14 so the logic will **always** end up in the **ELSE** case, and whilst Qt 5.15 is documented as accepting `CONFIG += c++2a` (and `c++2b`) the earliest Qt 6.x version describes `c++2a` as an obsolete alias for `c++20` (in https://doc.qt.io/qt-6.2/qmake-variable-reference.html). #### Other info (issues closed, discussion etc) 3. The code in the `QFont` cases contains errors that have been copied from bogus QFont creation code going back to the very first (well second) commit in the git history. This contained calls of the form `QFont font("Courier New", 10, QFont::Courier)` however even the Qt 4.8 documentation does not list a constructor of that form but instead has: `QFont(const QString & family, int pointSize = -1, int weight = -1, bool italic = false)` the third argument could possibly be `QFont::Normal` (50) or `QFont::Bold` (75) however the value of `QFont::Courier` is `2` but it is for a completely different purpose, that of the font matching strategy ("the font matcher prefers fixed pitch fonts.") but that is not something that can be set as an argument to the font constructor! As it happens the combination of `QFont::Bold | QFont::Serif | QFont::PreferMatch | QFont::PreferAntialias` that was being used numerically equals 75 + 2 + 32 + 128 = 227 - and the scale that Qt actually uses only goes from 0 to 99! 5. This change makes the code match the comments! Overall all the changes in this PR means that https://github.com/Mudlet/Mudlet/pull/7613 is not required after all - at least for Mudlet's own code - though there are still some warnings from the edbee-lib sub-module. --------- Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2025-02-10 11:59:45 +00:00
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(checkBox_stretchImage, &QCheckBox::checkStateChanged, this, &dlgMapLabel::updated);
#else
connect(checkBox_stretchImage, &QCheckBox::stateChanged, this, &dlgMapLabel::updated);
Fix reduce c++20warnings (#7638) #### Brief overview of PR changes/additions 1. Adds explicit ‘this’ or ‘*this’ capture to lambdas where required (not in static ones). 2. Rephrases some combinations of Qt `enum`s that whilst acceptable for C++17 upset the later one. For the non-key related ones which are provided a `int`s arguments to a method this is sufficient; For Qt 6 there are some additional methods that overcome the "incompatibility" of combining such different `enum`s but those have not been back ported to the Qt 5.15.8 I have - despite what https://bugreports.qt.io/browse/QTBUG-99948 says - so fixes for combining QKey and QKeyModifier have been left out of this PR. 3. Removes a couple of unused variables. 4. Adds our `qsl(...)` wrapper about some raw C-string literals used in a loop. 5. Rewrite part of the qmake project file so the logic and choices are correct. #### Motivation for adding to Mudlet 1. To eliminate the following type of warning when building with a C++20 compiler: "warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]" 2. To eliminate the following type of warning when building with a C++20 compiler: * warning: bitwise operation between different enumeration types ‘QFont::Weight’ and ‘QFont::StyleHint’ is deprecated [-Wdeprecated-enum-enum-conversion] * warning: bitwise operation between different enumeration types ‘Qt::TextFlag’ and ‘Qt::AlignmentFlag’ is deprecated [-Wdeprecated-enum-enum-conversion] 3. To eliminate the following type of warning when building with a C++20 compiler: "warning: unused variable ‘pHost’ [-Wunused-variable]" 4. To eliminate the following type of warning when building with a C++20 compiler: "warning: loop variable ‘file’ of type ‘const QString&’ binds to a temporary constructed from type ‘const char* const’ [-Wrange-loop-construct]" 5. The previous logic was (incorrect) IF Qt Major version is less than 5 OR (if Qt Major version is less than 6 AND if Qt Minor version is less than 12)) THEN add `-std=c++20` to `QMAKE_CXXFLAGS` ELSE add `c++2a` to `CONFIG` This is borked because we have already rejected Qt versions less than 5.14 so the logic will **always** end up in the **ELSE** case, and whilst Qt 5.15 is documented as accepting `CONFIG += c++2a` (and `c++2b`) the earliest Qt 6.x version describes `c++2a` as an obsolete alias for `c++20` (in https://doc.qt.io/qt-6.2/qmake-variable-reference.html). #### Other info (issues closed, discussion etc) 3. The code in the `QFont` cases contains errors that have been copied from bogus QFont creation code going back to the very first (well second) commit in the git history. This contained calls of the form `QFont font("Courier New", 10, QFont::Courier)` however even the Qt 4.8 documentation does not list a constructor of that form but instead has: `QFont(const QString & family, int pointSize = -1, int weight = -1, bool italic = false)` the third argument could possibly be `QFont::Normal` (50) or `QFont::Bold` (75) however the value of `QFont::Courier` is `2` but it is for a completely different purpose, that of the font matching strategy ("the font matcher prefers fixed pitch fonts.") but that is not something that can be set as an argument to the font constructor! As it happens the combination of `QFont::Bold | QFont::Serif | QFont::PreferMatch | QFont::PreferAntialias` that was being used numerically equals 75 + 2 + 32 + 128 = 227 - and the scale that Qt actually uses only goes from 0 to 99! 5. This change makes the code match the comments! Overall all the changes in this PR means that https://github.com/Mudlet/Mudlet/pull/7613 is not required after all - at least for Mudlet's own code - though there are still some warnings from the edbee-lib sub-module. --------- Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2025-02-10 11:59:45 +00:00
#endif
Improve: make map label input box handle more than one line. (#7674) #### Brief overview of PR changes/additions Changes the text entry widget for the text content for that type of "Map Label" from a `QLineEdit` to a `QPlainTextEdit`. #### Motivation for adding to Mudlet To make it possible to enter multi-line texts into text Map Labels. The existing widget does not show/enable the native entry of line-feeds and the only way to get them into such texts is to prepare them in an external location and paste them in - and after doing so they look just like spaces. #### Other info (issues closed, discussion etc) This the first (I hope) of some improvements I want to make to the map label user-experience. I found out that this was needed whilst MUDding on After the Plague MUD where, when map making I wanted to label area exits with some extra details and to include textual information about locations within the map. I also discovered the `(bool) tabChangesFocus` property which several text entry widgets possess which if set (and it is normally `false`) allows the `<Tab>` key to be used to move the focus out of that widget; when it is `false` it is used to enter *tabs* into the text itself. For this widget I have set it to `true` - but I do wonder if there are other widgets in the Mudlet application where this needs to be reviewed because it does impact on the user experience particularly for visually-impaired persons. --------- Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2025-01-21 21:14:02 +00:00
connect(plainTextEdit_labelText, &QPlainTextEdit::textChanged, this, [&]() {
text = plainTextEdit_labelText->toPlainText();
emit updated();
});
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
connect(pushButton_bgColor, &QPushButton::released, this, &dlgMapLabel::slot_pickBgColor);
connect(pushButton_fgColor, &QPushButton::released, this, &dlgMapLabel::slot_pickFgColor);
connect(pushButton_outlineColor, &QPushButton::released, this, &dlgMapLabel::slot_pickOutlineColor);
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
connect(toolButton_fontPick, &QToolButton::released, this, &dlgMapLabel::slot_pickFont);
connect(pushButton_save, &QPushButton::released, this, &dlgMapLabel::slot_save);
connect(pushButton_cancel, &QPushButton::released, this, &dlgMapLabel::close);
Fix reduce c++20warnings (#7638) #### Brief overview of PR changes/additions 1. Adds explicit ‘this’ or ‘*this’ capture to lambdas where required (not in static ones). 2. Rephrases some combinations of Qt `enum`s that whilst acceptable for C++17 upset the later one. For the non-key related ones which are provided a `int`s arguments to a method this is sufficient; For Qt 6 there are some additional methods that overcome the "incompatibility" of combining such different `enum`s but those have not been back ported to the Qt 5.15.8 I have - despite what https://bugreports.qt.io/browse/QTBUG-99948 says - so fixes for combining QKey and QKeyModifier have been left out of this PR. 3. Removes a couple of unused variables. 4. Adds our `qsl(...)` wrapper about some raw C-string literals used in a loop. 5. Rewrite part of the qmake project file so the logic and choices are correct. #### Motivation for adding to Mudlet 1. To eliminate the following type of warning when building with a C++20 compiler: "warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]" 2. To eliminate the following type of warning when building with a C++20 compiler: * warning: bitwise operation between different enumeration types ‘QFont::Weight’ and ‘QFont::StyleHint’ is deprecated [-Wdeprecated-enum-enum-conversion] * warning: bitwise operation between different enumeration types ‘Qt::TextFlag’ and ‘Qt::AlignmentFlag’ is deprecated [-Wdeprecated-enum-enum-conversion] 3. To eliminate the following type of warning when building with a C++20 compiler: "warning: unused variable ‘pHost’ [-Wunused-variable]" 4. To eliminate the following type of warning when building with a C++20 compiler: "warning: loop variable ‘file’ of type ‘const QString&’ binds to a temporary constructed from type ‘const char* const’ [-Wrange-loop-construct]" 5. The previous logic was (incorrect) IF Qt Major version is less than 5 OR (if Qt Major version is less than 6 AND if Qt Minor version is less than 12)) THEN add `-std=c++20` to `QMAKE_CXXFLAGS` ELSE add `c++2a` to `CONFIG` This is borked because we have already rejected Qt versions less than 5.14 so the logic will **always** end up in the **ELSE** case, and whilst Qt 5.15 is documented as accepting `CONFIG += c++2a` (and `c++2b`) the earliest Qt 6.x version describes `c++2a` as an obsolete alias for `c++20` (in https://doc.qt.io/qt-6.2/qmake-variable-reference.html). #### Other info (issues closed, discussion etc) 3. The code in the `QFont` cases contains errors that have been copied from bogus QFont creation code going back to the very first (well second) commit in the git history. This contained calls of the form `QFont font("Courier New", 10, QFont::Courier)` however even the Qt 4.8 documentation does not list a constructor of that form but instead has: `QFont(const QString & family, int pointSize = -1, int weight = -1, bool italic = false)` the third argument could possibly be `QFont::Normal` (50) or `QFont::Bold` (75) however the value of `QFont::Courier` is `2` but it is for a completely different purpose, that of the font matching strategy ("the font matcher prefers fixed pitch fonts.") but that is not something that can be set as an argument to the font constructor! As it happens the combination of `QFont::Bold | QFont::Serif | QFont::PreferMatch | QFont::PreferAntialias` that was being used numerically equals 75 + 2 + 32 + 128 = 227 - and the scale that Qt actually uses only goes from 0 to 99! 5. This change makes the code match the comments! Overall all the changes in this PR means that https://github.com/Mudlet/Mudlet/pull/7613 is not required after all - at least for Mudlet's own code - though there are still some warnings from the edbee-lib sub-module. --------- Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2025-02-10 11:59:45 +00:00
connect(comboBox_position, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &dlgMapLabel::updated);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(checkBox_scaling, &QCheckBox::checkStateChanged, this, &dlgMapLabel::updated);
#else
connect(checkBox_scaling, &QCheckBox::stateChanged, this, &dlgMapLabel::updated);
#endif
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
connect(this, &dlgMapLabel::updated, this, &dlgMapLabel::slot_updateControls);
font = QApplication::font();
font.setStyle(QFont::StyleNormal);
Improve: make map label input box handle more than one line. (#7674) #### Brief overview of PR changes/additions Changes the text entry widget for the text content for that type of "Map Label" from a `QLineEdit` to a `QPlainTextEdit`. #### Motivation for adding to Mudlet To make it possible to enter multi-line texts into text Map Labels. The existing widget does not show/enable the native entry of line-feeds and the only way to get them into such texts is to prepare them in an external location and paste them in - and after doing so they look just like spaces. #### Other info (issues closed, discussion etc) This the first (I hope) of some improvements I want to make to the map label user-experience. I found out that this was needed whilst MUDding on After the Plague MUD where, when map making I wanted to label area exits with some extra details and to include textual information about locations within the map. I also discovered the `(bool) tabChangesFocus` property which several text entry widgets possess which if set (and it is normally `false`) allows the `<Tab>` key to be used to move the focus out of that widget; when it is `false` it is used to enter *tabs* into the text itself. For this widget I have set it to `true` - but I do wonder if there are other widgets in the Mudlet application where this needs to be reviewed because it does impact on the user experience particularly for visually-impaired persons. --------- Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2025-01-21 21:14:02 +00:00
text = plainTextEdit_labelText->placeholderText();
//: Tooltip for font display in map label dialog
lineEdit_font->setToolTip(tr("Font size is automatically calculated to fit the label"));
QSettings& settings = *mudlet::getQSettings();
fgColor = settings.value("fgColorDialogMapLabel", fgColor).value<QColor>();
bgColor = settings.value("bgColorDialogMapLabel", bgColor).value<QColor>();
outlineColor = settings.value("outlineColorDialogMapLabel", outlineColor).value<QColor>();
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
slot_updateControls();
slot_updateControlsVisibility();
}
bool dlgMapLabel::isTextLabel()
{
return comboBox_type->currentIndex() == 0;
}
QString dlgMapLabel::getImagePath()
{
return imagePath;
}
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
void dlgMapLabel::slot_pickFgColor()
{
QSettings& settings = *mudlet::getQSettings();
fgColorDialog = new QColorDialog(this);
fgColorDialog->setCurrentColor(settings.value("fgColorDialogMapLabel", fgColor).value<QColor>());
fgColorDialog->setAttribute(Qt::WA_DeleteOnClose);
//: 2D mapper create label color dialog title
fgColorDialog->setWindowTitle(tr("Foreground color"));
fgColorDialog->setOption(QColorDialog::ShowAlphaChannel);
connect(fgColorDialog, &QColorDialog::currentColorChanged, this, [&](const QColor& color) {
fgColor = color;
settings.setValue("fgColorDialogMapLabel", fgColor);
emit updated();
});
auto originalColor = QColor(fgColor);
connect(fgColorDialog, &QColorDialog::rejected, this, [this, originalColor]() {
fgColor = originalColor;
emit updated();
});
fgColorDialog->show();
fgColorDialog->raise();
}
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
void dlgMapLabel::slot_pickBgColor()
{
QSettings& settings = *mudlet::getQSettings();
bgColorDialog = new QColorDialog(this);
bgColorDialog->setCurrentColor(settings.value("bgColorDialogMapLabel", bgColor).value<QColor>());
bgColorDialog->setAttribute(Qt::WA_DeleteOnClose);
//: 2D mapper create label color dialog title
bgColorDialog->setWindowTitle(tr("Background color"));
bgColorDialog->setOption(QColorDialog::ShowAlphaChannel);
connect(bgColorDialog, &QColorDialog::currentColorChanged, this, [&](const QColor& color) {
bgColor = color;
settings.setValue("bgColorDialogMapLabel", bgColor);
emit updated();
});
auto originalColor = QColor(bgColor);
connect(bgColorDialog, &QColorDialog::rejected, this, [this, originalColor]() {
bgColor = originalColor;
emit updated();
});
bgColorDialog->show();
bgColorDialog->raise();
}
void dlgMapLabel::slot_pickOutlineColor()
{
QSettings& settings = *mudlet::getQSettings();
outlineColorDialog = new QColorDialog(this);
outlineColorDialog->setCurrentColor(settings.value("outlineColorDialogMapLabel", outlineColor).value<QColor>());
outlineColorDialog->setAttribute(Qt::WA_DeleteOnClose);
//: 2D mapper create label color dialog title
outlineColorDialog->setWindowTitle(tr("Text outline color"));
outlineColorDialog->setOption(QColorDialog::ShowAlphaChannel);
connect(outlineColorDialog, &QColorDialog::currentColorChanged, this, [&](const QColor& color) {
outlineColor = color;
settings.setValue("outlineColorDialogMapLabel", outlineColor);
emit updated();
});
auto originalColor = QColor(outlineColor);
connect(outlineColorDialog, &QColorDialog::rejected, this, [this, originalColor]() {
outlineColor = originalColor;
emit updated();
});
outlineColorDialog->show();
outlineColorDialog->raise();
}
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
void dlgMapLabel::slot_pickFont()
{
auto originalFont = QFont(font);
fontDialog = new QFontDialog(font, this);
fontDialog->setAttribute(Qt::WA_DeleteOnClose);
//: 2D mapper create label font dialog title
fontDialog->setWindowTitle(tr("Label font"));
connect(fontDialog, &QFontDialog::currentFontChanged, this, [&](const QFont& pFont) {
font = pFont;
emit updated();
});
connect(fontDialog, &QFontDialog::rejected, this, [this, originalFont]() {
font = originalFont;
emit updated();
});
fontDialog->setCurrentFont(font);
fontDialog->show();
fontDialog->raise();
}
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
void dlgMapLabel::slot_pickFile()
{
//: 2D Mapper create label file dialog title
QSettings& settings = *mudlet::getQSettings();
QString lastDir = settings.value("lastFileDialogLocation", QDir::homePath()).toString();
imagePath = QFileDialog::getOpenFileName(nullptr, tr("Select image"), lastDir);
if (imagePath.isEmpty()) {
return;
}
emit updated();
lastDir = QFileInfo(imagePath).absolutePath();
settings.setValue("lastFileDialogLocation", lastDir);
}
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
void dlgMapLabel::slot_save()
{
accept();
}
QString dlgMapLabel::getText()
{
return text;
}
QColor& dlgMapLabel::getBgColor()
{
return bgColor;
}
QColor& dlgMapLabel::getFgColor()
{
return fgColor;
}
QColor& dlgMapLabel::getOutlineColor()
{
return outlineColor;
}
QFont& dlgMapLabel::getFont()
{
return font;
}
bool dlgMapLabel::isOnTop()
{
return comboBox_position->currentIndex() == 1;
}
bool dlgMapLabel::noScale()
{
return !checkBox_scaling->isChecked();
}
bool dlgMapLabel::stretchImage()
{
return checkBox_stretchImage->isChecked();
}
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
void dlgMapLabel::slot_updateControls()
{
//: Font display format in map label dialog. %1 is font family name, %2 is style (e.g. "Bold", "Italic"). Size excluded since it auto-scales.
lineEdit_font->setText(tr("%1 %2").arg(font.family(), font.styleName()));
pushButton_fgColor->setStyleSheet(BUTTON_STYLESHEET.arg(QString::number(fgColor.red()), QString::number(fgColor.green()), QString::number(fgColor.blue()), QString::number(fgColor.alpha())));
pushButton_bgColor->setStyleSheet(BUTTON_STYLESHEET.arg(QString::number(bgColor.red()), QString::number(bgColor.green()), QString::number(bgColor.blue()), QString::number(bgColor.alpha())));
pushButton_outlineColor->setStyleSheet(
BUTTON_STYLESHEET.arg(QString::number(outlineColor.red()), QString::number(outlineColor.green()), QString::number(outlineColor.blue()), QString::number(outlineColor.alpha())));
lineEdit_image->setText(imagePath);
}
Infrastructure: tidy up naming of SLOT methods and their usage - Part 2 (#6255) When Qt's slot/signal system is used to invoke a method there is some overhead - so it makes sense to ensure developers can spot all such methods (functions). We have tried to do this with a `slot_` prefix to the methods we create but it has not been applied uniformly. This PR (and one or more to follow) is intended to help with this by more rigorously doing so - the names changed herein should all follow a `slot_`*camelCaseMethodName* style. In addition some methods were detected that are not currently used or which are not actually used via the signal/slot system, these have been commented out or have had the prefix removed and the declaration in the relevant header file moved as appropriate. For reference the changes made are: * `TLuaInterpreter::slotDeleteSender(...)` ==> `TLuaInterpreter::slot_deleteSender(...)` * `TLuaInterpreter::slotPurge()` ==> `TLuaInterpreter::slot_purge()` * `cTelnet::handle_socket_signal_connected()` ==> `cTelnet::slot_socketConnected()` * `cTelnet::handle_socket_signal_disconnected()` ==> `cTelnet::slot_socketDisconnected()` * `cTelnet::handle_socket_signal_hostFound(...)` ==> `cTelnet::slot_socketHostFound(...)` * `cTelnet::handle_socket_signal_readyRead()` ==> `cTelnet::slot_socketReadyToBeRead()` * `cTelnet::handle_socket_signal_sslError(...)` ==> `cTelnet::slot_socketSslError(...)` * `cTelnet::setDownloadProgress(...)` ==> `cTelnet::slot_setDownloadProgress(...)` * `dlgComposer::cancel()` ==> `dlgComposer::slot_cancel()` * `dlgComposer::save()` ==> `dlgComposer::slot_save()` * `dlgConnectionProfiles::slot_item_clicked(...)` ==> `dlgConnectionProfiles::slot_itemClicked(...)` * `dlgConnectionProfiles::slot_save_name()` ==> `dlgConnectionProfiles::slot_saveName()` * `dlgConnectionProfiles::slot_update_login(...)` ==> `dlgConnectionProfiles::slot_updateLogin(...)` * `dlgConnectionProfiles::slot_update_name(...)` ==> `dlgConnectionProfiles::slot_updateName(...)` * `dlgConnectionProfiles::slot_update_pass(...)` ==> `dlgConnectionProfiles::slot_updatePassword(...)` * `dlgConnectionProfiles::slot_update_port(...)` ==> `dlgConnectionProfiles::slot_updatePort(...)` * `dlgConnectionProfiles::slot_update_SSL_TSL_port(...)` ==> `dlgConnectionProfiles::slot_updateSslTslPort(...)` * `dlgConnectionProfiles::slot_update_url(...)` ==> `dlgConnectionProfiles::slot_updateUrl(...)` * `dlgMapLabel::pickBgColor()` ==> `dlgMapLabel::slot_pickBgColor()` * `dlgMapLabel::pickFgColor()` ==> `dlgMapLabel::slot_pickFgColor()` * `dlgMapLabel::pickFile()` ==> `dlgMapLabel::slot_pickFile()` * `dlgMapLabel::pickFont()` ==> `dlgMapLabel::slot_pickFont()` * `dlgMapLabel::save()` ==> `dlgMapLabel::slot_save()` * `dlgMapLabel::updateControls()` ==> `dlgMapLabel::slot_updateControls()` * `dlgMapLabel::updateControlsVisibility()` ==> `dlgMapLabel::slot_updateControlsVisibility()` Commented out as not being used: * `cTelnet::handle_socket_signal_error()` ==> `cTelnet::slot_socketError()` * `dlgConnectionProfiles::slot_update_website(...) ==> `dlgConnectionProfiles::slot_updateWebsite(const QString& url)` I have my doubts about whether the `dlgMapLabel::save()`/`dlgMapLabel::slot_save()` method is needed at all, as it might be that the `QDialog::accept()` slot could have been inserted into the `QObject::connect(...)` call directly instead...? Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2022-08-27 10:47:01 +02:00
void dlgMapLabel::slot_updateControlsVisibility()
{
const bool isText = isTextLabel();
label_image->setVisible(!isText);
lineEdit_image->setVisible(!isText);
checkBox_stretchImage->setVisible(!isText);
toolButton_imagePick->setVisible(!isText);
label_text->setVisible(isText);
Improve: make map label input box handle more than one line. (#7674) #### Brief overview of PR changes/additions Changes the text entry widget for the text content for that type of "Map Label" from a `QLineEdit` to a `QPlainTextEdit`. #### Motivation for adding to Mudlet To make it possible to enter multi-line texts into text Map Labels. The existing widget does not show/enable the native entry of line-feeds and the only way to get them into such texts is to prepare them in an external location and paste them in - and after doing so they look just like spaces. #### Other info (issues closed, discussion etc) This the first (I hope) of some improvements I want to make to the map label user-experience. I found out that this was needed whilst MUDding on After the Plague MUD where, when map making I wanted to label area exits with some extra details and to include textual information about locations within the map. I also discovered the `(bool) tabChangesFocus` property which several text entry widgets possess which if set (and it is normally `false`) allows the `<Tab>` key to be used to move the focus out of that widget; when it is `false` it is used to enter *tabs* into the text itself. For this widget I have set it to `true` - but I do wonder if there are other widgets in the Mudlet application where this needs to be reviewed because it does impact on the user experience particularly for visually-impaired persons. --------- Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2025-01-21 21:14:02 +00:00
plainTextEdit_labelText->setVisible(isText);
label_font->setVisible(isText);
lineEdit_font->setVisible(isText);
toolButton_fontPick->setVisible(isText);
pushButton_fgColor->setVisible(isText);
label_fg->setVisible(isText);
pushButton_outlineColor->setVisible(isText);
label_outline->setVisible(isText);
}