Qt: Remember the tile and font size
The QT_TILEWIDTH and QT_TILEHEIGHT read from NetHack config file override the remembered settings. Also set the smallest tile size to 6x6
This commit is contained in:
@@ -162,6 +162,7 @@ unix: Makefile.src and Makefile.utl inadvertently relied on a 'gnu make'
|
|||||||
Qt: add Qt5 specific hints file for linux and Mac OS X (Ray Chason)
|
Qt: add Qt5 specific hints file for linux and Mac OS X (Ray Chason)
|
||||||
Qt: enable compiling Qt5 on Windows (Ray Chason)
|
Qt: enable compiling Qt5 on Windows (Ray Chason)
|
||||||
Qt: entering extended commands, hide non-matching ones
|
Qt: entering extended commands, hide non-matching ones
|
||||||
|
Qt: remember tile and font size
|
||||||
|
|
||||||
|
|
||||||
General New Features
|
General New Features
|
||||||
|
|||||||
@@ -490,6 +490,10 @@ NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) :
|
|||||||
addToolBar(toolbar);
|
addToolBar(toolbar);
|
||||||
menubar = menuBar();
|
menubar = menuBar();
|
||||||
|
|
||||||
|
QCoreApplication::setOrganizationName("The NetHack DevTeam");
|
||||||
|
QCoreApplication::setOrganizationDomain("nethack.org");
|
||||||
|
QCoreApplication::setApplicationName("NetHack");
|
||||||
|
|
||||||
setWindowTitle("Qt NetHack");
|
setWindowTitle("Qt NetHack");
|
||||||
if ( qt_compact_mode )
|
if ( qt_compact_mode )
|
||||||
setWindowIcon(QIcon(QPixmap(nh_icon_small)));
|
setWindowIcon(QIcon(QPixmap(nh_icon_small)));
|
||||||
|
|||||||
+15
-6
@@ -36,10 +36,11 @@ int qt_compact_mode = 0;
|
|||||||
|
|
||||||
namespace nethack_qt4 {
|
namespace nethack_qt4 {
|
||||||
|
|
||||||
#define TILEWMIN 1
|
#define TILEWMIN 6
|
||||||
#define TILEHMIN 1
|
#define TILEHMIN 6
|
||||||
|
|
||||||
NetHackQtSettings::NetHackQtSettings(int w, int h) :
|
NetHackQtSettings::NetHackQtSettings(int w, int h) :
|
||||||
|
settings(),
|
||||||
tilewidth(this),
|
tilewidth(this),
|
||||||
tileheight(this),
|
tileheight(this),
|
||||||
widthlbl("&Width:",this),
|
widthlbl("&Width:",this),
|
||||||
@@ -63,9 +64,9 @@ NetHackQtSettings::NetHackQtSettings(int w, int h) :
|
|||||||
heightlbl.setBuddy(&tileheight);
|
heightlbl.setBuddy(&tileheight);
|
||||||
tileheight.setRange(TILEHMIN, 128);
|
tileheight.setRange(TILEHMIN, 128);
|
||||||
|
|
||||||
default_fontsize=2;
|
tilewidth.setValue(settings.value("tilewidth", 16).toInt());
|
||||||
tilewidth.setValue(16);
|
tileheight.setValue(settings.value("tileheight", 16).toInt());
|
||||||
tileheight.setValue(16);
|
default_fontsize = settings.value("fontsize", 2).toInt();
|
||||||
|
|
||||||
// Tile/font sizes read from .nethackrc
|
// Tile/font sizes read from .nethackrc
|
||||||
if (qt_tilewidth != NULL) {
|
if (qt_tilewidth != NULL) {
|
||||||
@@ -100,7 +101,7 @@ NetHackQtSettings::NetHackQtSettings(int w, int h) :
|
|||||||
fontsize.addItem("Small");
|
fontsize.addItem("Small");
|
||||||
fontsize.addItem("Tiny");
|
fontsize.addItem("Tiny");
|
||||||
fontsize.setCurrentIndex(default_fontsize);
|
fontsize.setCurrentIndex(default_fontsize);
|
||||||
connect(&fontsize,SIGNAL(activated(int)),this,SIGNAL(fontChanged()));
|
connect(&fontsize,SIGNAL(activated(int)),this,SLOT(changedFont()));
|
||||||
|
|
||||||
QGridLayout* grid = new QGridLayout(this);
|
QGridLayout* grid = new QGridLayout(this);
|
||||||
grid->addWidget(&whichsize, 0, 0, 1, 2);
|
grid->addWidget(&whichsize, 0, 0, 1, 2);
|
||||||
@@ -126,11 +127,19 @@ NetHackQtGlyphs& NetHackQtSettings::glyphs()
|
|||||||
return *theglyphs;
|
return *theglyphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetHackQtSettings::changedFont()
|
||||||
|
{
|
||||||
|
settings.setValue("fontsize", fontsize.currentIndex());
|
||||||
|
emit fontChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void NetHackQtSettings::resizeTiles()
|
void NetHackQtSettings::resizeTiles()
|
||||||
{
|
{
|
||||||
int w = tilewidth.value();
|
int w = tilewidth.value();
|
||||||
int h = tileheight.value();
|
int h = tileheight.value();
|
||||||
|
|
||||||
|
settings.setValue("tilewidth", tilewidth.value());
|
||||||
|
settings.setValue("tileheight", tileheight.value());
|
||||||
theglyphs->setSize(w,h);
|
theglyphs->setSize(w,h);
|
||||||
emit tilesChanged();
|
emit tilesChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public slots:
|
|||||||
void setGlyphSize(bool);
|
void setGlyphSize(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QSettings settings;
|
||||||
QSpinBox tilewidth;
|
QSpinBox tilewidth;
|
||||||
QSpinBox tileheight;
|
QSpinBox tileheight;
|
||||||
QLabel widthlbl;
|
QLabel widthlbl;
|
||||||
@@ -48,6 +49,7 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void resizeTiles();
|
void resizeTiles();
|
||||||
|
void changedFont();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern NetHackQtSettings* qt_settings;
|
extern NetHackQtSettings* qt_settings;
|
||||||
|
|||||||
Reference in New Issue
Block a user