Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI|Home: Merged popups for configuring data files (IWAD, packages)
Also added a button in the end of the Packages list for opening the Data Files settings.
- Loading branch information
Showing
6 changed files
with
172 additions
and
37 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
doomsday/apps/client/include/ui/dialogs/datafilesettingsdialog.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** @file datafilesettingsdialog.h Data file settings. | ||
* | ||
* @authors Copyright (c) 2017 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* GPL: http://www.gnu.org/licenses/gpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. You should have received a copy of the GNU | ||
* General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#ifndef DENG_CLIENT_DATAFILESETTINGSDIALOG_H | ||
#define DENG_CLIENT_DATAFILESETTINGSDIALOG_H | ||
|
||
#include <de/DirectoryListDialog> | ||
|
||
/** | ||
* Dialog for data file settings. | ||
*/ | ||
class DataFileSettingsDialog : public de::DirectoryListDialog | ||
{ | ||
public: | ||
DataFileSettingsDialog(de::String const &name = "datafilesettings"); | ||
|
||
protected: | ||
void finish(int result) override; | ||
|
||
private: | ||
DENG2_PRIVATE(d) | ||
}; | ||
|
||
#endif // DENG_CLIENT_DATAFILESETTINGSDIALOG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
doomsday/apps/client/src/ui/dialogs/datafilesettingsdialog.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** @file datafilesettings.cpp Data file settings. | ||
* | ||
* @authors Copyright (c) 2017 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* GPL: http://www.gnu.org/licenses/gpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
* Public License for more details. You should have received a copy of the GNU | ||
* General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#include "ui/dialogs/datafilesettingsdialog.h" | ||
#include "ui/clientwindow.h" | ||
#include "ui/widgets/consolewidget.h" | ||
#include "ui/widgets/packageswidget.h" | ||
|
||
#include <doomsday/DoomsdayApp> | ||
#include <de/Config> | ||
|
||
using namespace de; | ||
|
||
DENG2_PIMPL_NOREF(DataFileSettingsDialog) | ||
{ | ||
Variable &iwadFolders = Config::get("resource.iwadFolder"); | ||
Variable &pkgFolders = Config::get("resource.packageFolder"); | ||
Id iwadGroup; | ||
Id pkgGroup; | ||
bool modified = false; | ||
}; | ||
|
||
DataFileSettingsDialog::DataFileSettingsDialog(String const &name) | ||
: DirectoryListDialog(name) | ||
, d(new Impl) | ||
{ | ||
buttons().clear() | ||
<< new DialogButtonItem(Default | Accept, tr("Close")); | ||
|
||
title().setFont("heading"); | ||
title().setText(tr("Data Files")); | ||
title().setStyleImage("package.icon", "heading"); | ||
|
||
message().hide(); | ||
|
||
//dlg->title().setFont("heading"); | ||
//dlg->title().setStyleImage("package.icon"); | ||
//dlg->title().setOverrideImageSize(Style::get().fonts().font("heading").ascent().value()); | ||
//dlg->title().setTextGap("dialog.gap"); | ||
//dlg->title().setText(QObject::tr("IWAD Folders")); | ||
//dlg->message().setText(QObject::tr("The following folders are searched for game data files:")); | ||
|
||
d->iwadGroup = addGroup(tr("IWAD Folders"), | ||
tr("The following folders are searched for game IWAD files:")); | ||
setValue(d->iwadGroup, d->iwadFolders.value()); | ||
|
||
d->pkgGroup = addGroup(tr("Add-on and Package Folders"), | ||
tr("The following folders and all their subfolders are searched " | ||
"for resource packs and other add-ons:")); | ||
setValue(d->pkgGroup, d->pkgFolders.value()); | ||
|
||
connect(this, &DirectoryListDialog::arrayChanged, [this] () | ||
{ | ||
d->modified = true; | ||
}); | ||
} | ||
|
||
void DataFileSettingsDialog::finish(int result) | ||
{ | ||
DirectoryListDialog::finish(result); | ||
|
||
if (d->modified) | ||
{ | ||
d->iwadFolders.set(value(d->iwadGroup)); | ||
d->pkgFolders .set(value(d->pkgGroup)); | ||
|
||
// Reload packages and recheck for game availability. | ||
auto &win = ClientWindow::main(); | ||
win.console().closeLogAndUnfocusCommandLine(); | ||
win.root().find("home-packages")->as<PackagesWidget>().showProgressIndicator(); | ||
DoomsdayApp::app().initWadFolders(); | ||
DoomsdayApp::app().initPackageFolders(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters