mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 05:39:40 +00:00
Feature #2532. Global filter shortcuts for project::added and project::modified.
- Add a startup warning message if global filters are being used. - Add tooltip messages for the checkbox shortcuts.
This commit is contained in:
parent
65a88aaedb
commit
60f963382b
4 changed files with 53 additions and 2 deletions
|
@ -7,6 +7,9 @@
|
|||
#include <QLocalServer>
|
||||
#include <QLocalSocket>
|
||||
#include <QMessageBox>
|
||||
#include <QSplashScreen>
|
||||
#include <QFont>
|
||||
#include <QTimer>
|
||||
|
||||
#include <OgreRoot.h>
|
||||
#include <OgreRenderWindow.h>
|
||||
|
@ -213,6 +216,7 @@ void CS::Editor::createNewFile (const boost::filesystem::path &savePath)
|
|||
mDocumentManager.addDocument (files, savePath, true);
|
||||
|
||||
mFileDialog.hide();
|
||||
showSplashMessage();
|
||||
}
|
||||
|
||||
void CS::Editor::createNewGame (const boost::filesystem::path& file)
|
||||
|
@ -224,6 +228,7 @@ void CS::Editor::createNewGame (const boost::filesystem::path& file)
|
|||
mDocumentManager.addDocument (files, file, true);
|
||||
|
||||
mNewGame.hide();
|
||||
showSplashMessage();
|
||||
}
|
||||
|
||||
void CS::Editor::showStartup()
|
||||
|
@ -435,9 +440,51 @@ std::auto_ptr<sh::Factory> CS::Editor::setupGraphics()
|
|||
void CS::Editor::documentAdded (CSMDoc::Document *document)
|
||||
{
|
||||
mViewManager.addView (document);
|
||||
showSplashMessage();
|
||||
}
|
||||
|
||||
void CS::Editor::lastDocumentDeleted()
|
||||
{
|
||||
QApplication::quit();
|
||||
}
|
||||
|
||||
void CS::Editor::showSplashMessage()
|
||||
{
|
||||
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
|
||||
if(settings.settingValue ("filter/project-added") == "true" ||
|
||||
settings.settingValue ("filter/project-modified") == "true")
|
||||
{
|
||||
QPixmap img(QPixmap(":./openmw-cs.png"));
|
||||
|
||||
QString msgTop("You have active global filters.");
|
||||
QString msgBottom("Some rows may be hidden!");
|
||||
QFont splashFont(QFont("Arial", 16, QFont::Bold)); // TODO: use system font?
|
||||
//splashFont.setStretch(125);
|
||||
|
||||
QFontMetrics fm(splashFont);
|
||||
int msgWidth = std::max(fm.width(msgTop), fm.width(msgBottom));
|
||||
img.scaledToWidth(msgWidth);
|
||||
|
||||
QSplashScreen *splash = new QSplashScreen(img, Qt::WindowStaysOnTopHint);
|
||||
splash->setFont(splashFont);
|
||||
splash->resize(msgWidth+20, splash->height()+fm.lineSpacing()*2+20); // add some margin
|
||||
|
||||
// try to center the message near the center of the saved window
|
||||
QWidget dummy;
|
||||
bool xWorkaround = settings.settingValue ("window/x-save-state-workaround").toStdString() == "true";
|
||||
if (settings.settingValue ("window/save-state").toStdString() == "true" &&
|
||||
!(xWorkaround && settings.settingValue ("window/maximized").toStdString() == "true"))
|
||||
{
|
||||
dummy.restoreGeometry(settings.value("window/geometry").toByteArray());
|
||||
splash->move(dummy.x()+std::max(0, (dummy.width()-msgWidth)/2),
|
||||
dummy.y()+std::max(0, (dummy.height()-splash->height())/2));
|
||||
}
|
||||
else
|
||||
splash->move(std::max(0, splash->x()-msgWidth/2), splash->y());
|
||||
|
||||
splash->show();
|
||||
splash->showMessage(msgTop+"\n"+msgBottom, Qt::AlignHCenter|Qt::AlignBottom, Qt::red);
|
||||
QTimer::singleShot(4000, splash, SLOT(close())); // 4 seconds should be enough
|
||||
splash->raise(); // for X windows
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,8 @@ namespace CS
|
|||
boost::filesystem::ofstream mPidFile;
|
||||
bool mFsStrict;
|
||||
|
||||
void showSplashMessage();
|
||||
|
||||
void setupDataFiles (const Files::PathContainer& dataDirs);
|
||||
|
||||
std::pair<Files::PathContainer, std::vector<std::string> > readConfig();
|
||||
|
|
|
@ -252,12 +252,12 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|||
{
|
||||
Setting *projAdded = createSetting (Type_CheckBox, "project-added", "Project::added initial value");
|
||||
projAdded->setDefaultValue ("false");
|
||||
projAdded->setToolTip ("Show records added by the project when a table is first opened."
|
||||
projAdded->setToolTip ("Show records added by the project when opening a table."
|
||||
" Other records are filterd out.");
|
||||
|
||||
Setting *projModified = createSetting (Type_CheckBox, "project-modified", "Project::modified initial value");
|
||||
projModified->setDefaultValue ("false");
|
||||
projModified->setToolTip ("Show records modified by the project when a table is first opened."
|
||||
projModified->setToolTip ("Show records modified by the project when opening a table."
|
||||
" Other records are filterd out.");
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
|||
QHBoxLayout *hLayout = new QHBoxLayout;
|
||||
QCheckBox *added = new QCheckBox("A");
|
||||
QCheckBox *modified = new QCheckBox("M");
|
||||
added->setToolTip("Apply filter project::added. Changes to\nthis filter setting is not saved in preferences.");
|
||||
modified->setToolTip("Apply filter project::modified. Changes to\nthis filter setting is not saved in preferences.");
|
||||
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
|
||||
added->setCheckState(
|
||||
userSettings.settingValue ("filter/project-added") == "true" ? Qt::Checked : Qt::Unchecked);
|
||||
|
|
Loading…
Reference in a new issue