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