Qt extended commands enhancement
For Qt's pick-an-exetended-command dialog, allow a player to toggle the grid layout from column-oriented to row-oriented and vice versa and when in wizard mode to cycle the set of shown (and typable) commands from 'all' to 'normal mode-only' to 'wizard mode-only' back to 'all'. The most recent values are saved by Qt along with tile size, font size, and some other stuff. The extended command dialog has a Reset button to force them (the two extended command values) back to their defaults. The dialog layout has a slight change to conserve screen space as well as three additional control buttons: Was Now | [ Cancel ] | [Cancel] [Filter][Layout][Reset ] |# |# Grid Title | Grid title | [cmd 1] [cmd R+1] [cmd 2*R+1] ... | [cmd 1] [cmd R+1] [cmd 2*R+1] ... | [cmd 2] [cmd R+2] | [cmd 2] [cmd R+2] |... |... | [cmd R] [cmd 2*R] | [cmd R] [cmd 2*R] '#' is the prompt where typed text gets echoed and 'R' is the number of rows in the grid and varies by the set of commands from the current filter. Grid dimensions have been adjusted: 'all' is 13x9, 'normal' is 13x7, and 'wizard' is 7x4 or 4x7 depending on layout orientation. The wizard mode-only filter setting probably isn't very useful because you can only type--or click on--commands which are visible. So when set to wizard mode-only, you can't #quit for instance. (Via extended command; there are still menu choices for that particular action. And it's trivial to change filter.)
This commit is contained in:
@@ -20,6 +20,7 @@ extern "C" {
|
||||
#include "qt_glyph.h"
|
||||
#include "qt_main.h"
|
||||
#include "qt_bind.h"
|
||||
#include "qt_xcmd.h"
|
||||
#include "qt_str.h"
|
||||
|
||||
// Dialog box accessed via "Qt Settings..." in the games menu (non-OSX)
|
||||
@@ -108,6 +109,12 @@ NetHackQtSettings::NetHackQtSettings() :
|
||||
#endif
|
||||
default_fontsize = settings.value("fontsize", 2).toInt();
|
||||
|
||||
// these aren't currently part of the settings dialog; they're managed
|
||||
// by the extended commands menu ('#' command) and updateXcmd() below
|
||||
// but are included in qt_settings to be remembered across play sessions
|
||||
xcmd_by_row = settings.value("xcmdByRow", false).toBool();
|
||||
xcmd_set = settings.value("xcmdSet", all_cmds).toInt();
|
||||
|
||||
// Tile/font sizes read from .nethackrc
|
||||
if (qt_tilewidth != NULL) {
|
||||
tilewidth.setValue(atoi(qt_tilewidth));
|
||||
@@ -274,6 +281,16 @@ void NetHackQtSettings::setDollShown(bool on_off)
|
||||
}
|
||||
#endif
|
||||
|
||||
// called from NetHackQtExtCmdRequestor::Retry()
|
||||
void NetHackQtSettings::updateXcmd(bool by_row, int which_set)
|
||||
{
|
||||
// update 'settings' to have Qt store the revised values for next session
|
||||
xcmd_by_row = by_row;
|
||||
settings.setValue("xcmdByRow", QVariant(xcmd_by_row));
|
||||
xcmd_set = which_set;
|
||||
settings.setValue("xcmdSet", xcmd_set);
|
||||
}
|
||||
|
||||
const QFont& NetHackQtSettings::normalFont()
|
||||
{
|
||||
static int size[]={ 18, 14, 12, 10, 8 };
|
||||
|
||||
Reference in New Issue
Block a user