Fix YN function in Qt windowport compact mode (wasn't parsing properly).

Often, the yn_function "choices" parameter is not set, so for a non-keyboard
GUI (compact mode is for handheld computers with a stylus), the windowport
has to parse the prompt to find out the posible input choices. I got the
parsing wrong.
This commit is contained in:
warwick
2002-01-13 00:33:02 +00:00
parent e37ac86799
commit 15e5fc1a95

View File

@@ -3946,6 +3946,7 @@ char NetHackQtYnDialog::Exec()
QString enable;
if ( qt_compact_mode && !choices ) {
// expand choices from prompt
// ##### why isn't choices set properly???
const char* c=question;
while ( *c && *c != '[' )
c++;
@@ -3956,13 +3957,16 @@ char NetHackQtYnDialog::Exec()
ch.append(*c++);
char from=0;
while ( *c && *c != ']' && *c != ' ' ) {
if ( *c == '-' )
if ( *c == '-' ) {
from = c[-1];
else if ( from )
for (char f=from; f<=*c; f++)
} else if ( from ) {
for (char f=from+1; f<=*c; f++)
ch.append(f);
else
from = 0;
} else {
ch.append(*c);
from = 0;
}
c++;
}
if ( *c == ' ' ) {
@@ -4415,8 +4419,10 @@ NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) :
int NetHackQtSavedGameSelector::choose()
{
#if defined(QWS) // probably safe with Qt 3, too (where show!=exec in QDialog).
if ( qt_compact_mode )
showMaximized();
#endif
return exec()-2;
}