summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-01 17:05:28 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-01 17:27:14 +0300
commit4ecea7806d45ca40b370b13da6fe4781ef04367d (patch)
tree22eef831511daf36cc0bd7e497fae972e0371735
parent40efe9ac2ad7b080f3b817b7fc909fcc2b333093 (diff)
downloadmv-4ecea7806d45ca40b370b13da6fe4781ef04367d.tar.gz
mv-4ecea7806d45ca40b370b13da6fe4781ef04367d.tar.bz2
mv-4ecea7806d45ca40b370b13da6fe4781ef04367d.tar.xz
mv-4ecea7806d45ca40b370b13da6fe4781ef04367d.zip
add option to override detected screen density.
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/graphicsmanager.cpp9
-rw-r--r--src/gui/setup_other.cpp20
-rw-r--r--src/gui/setup_other.h4
4 files changed, 28 insertions, 6 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 0d1fa91d9..1995d1ee6 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -315,6 +315,7 @@ DefaultsData* getConfigDefaults()
AddDEF("showAllLang", false);
AddDEF("moveNames", false);
AddDEF("uselonglivesprites", false);
+ AddDEF("screenDensity", 0);
return configData;
}
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 8c2c9f9b2..f9df9570e 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -1030,8 +1030,13 @@ void GraphicsManager::detectPixelSize()
#endif
logger->log("screen size in pixels: %dx%d", mMaxWidth, mMaxHeight);
logger->log("screen size in millimeters: %dx%d", mWidthMM, mHeightMM);
- logger->log("screen density: \"%s\" = %d",
- getDensityString().c_str(), mDensity);
+ logger->log("actual screen density: " + getDensityString());
+ const int density = config.getIntValue("screenDensity");
+ if (density > 0 && density <= densitySize)
+ {
+ mDensity = density - 1;
+ logger->log("selected screen density: " + getDensityString());
+ }
}
std::string GraphicsManager::getDensityString() const
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index c4ce2a500..bc4bf8f24 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -58,10 +58,24 @@ static const char *const proxyTypeList[] =
N_("SOCKS5 hostname")
};
+static const int densityListSize = 7;
+
+static const char *const densityList[] =
+{
+ N_("default"),
+ N_("low"),
+ N_("medium"),
+ N_("tv"),
+ N_("high"),
+ N_("xhigh"),
+ N_("xxhigh")
+};
+
Setup_Other::Setup_Other(const Widget2 *const widget) :
SetupTabScroll(widget),
mProxyTypeList(new NamesModel),
- mShortcutsList(new NamesModel)
+ mShortcutsList(new NamesModel),
+ mDensityList(new NamesModel)
{
setName(_("Misc"));
@@ -275,6 +289,10 @@ Setup_Other::Setup_Other(const Widget2 *const widget) :
new SetupItemCheckBox(_("Show background"), "", "showBackground",
this, "showBackgroundEvent");
+ mDensityList->fillFromArray(&densityList[0], densityListSize);
+ new SetupItemDropDown(_("Screen density override"), "",
+ "screenDensity", this, "screenDensityEvent", mDensityList, 100);
+
setDimension(gcn::Rectangle(0, 0, 550, 350));
}
diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h
index 2f0fdaf04..cc20ad2d9 100644
--- a/src/gui/setup_other.h
+++ b/src/gui/setup_other.h
@@ -39,15 +39,13 @@ class Setup_Other final : public SetupTabScroll
A_DELETE_COPY(Setup_Other)
~Setup_Other();
-
void apply();
-
void externalUpdated();
protected:
NamesModel *mProxyTypeList;
-
NamesModel *mShortcutsList;
+ NamesModel *mDensityList;
};
#endif