Skip to content

Commit

Permalink
Resources|libdoomsday: Configuring multiple IWAD folders
Browse files Browse the repository at this point in the history
Using the new DirectoryArrayWidget to configure multiple directories
where IWADs may be found.
  • Loading branch information
skyjake committed Jun 20, 2016
1 parent 69353de commit d7f4e2a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
28 changes: 16 additions & 12 deletions doomsday/apps/client/src/ui/widgets/taskbarwidget.cpp
Expand Up @@ -46,14 +46,15 @@
#include <doomsday/filesys/fs_main.h>
#include <doomsday/console/exec.h>

#include <de/AnimationRule>
#include <de/BlurWidget>
#include <de/ButtonWidget>
#include <de/Config>
#include <de/DirectoryArrayWidget>
#include <de/Drawable>
#include <de/GLBuffer>
#include <de/KeyEvent>
#include <de/PopupMenuWidget>
#include <de/AnimationRule>
#include <de/SequentialLayout>
#include <de/SignalAction>
#include <de/ui/SubwidgetItem>
Expand Down Expand Up @@ -150,10 +151,6 @@ DENG_GUI_PIMPL(TaskBarWidget)

~Instance()
{
// DoomsdayApp::app().audienceForGameChange() -= this;
// ClientApp::serverLink().audienceForJoin -= this;
// ClientApp::serverLink().audienceForLeave -= this;

releaseRef(vertShift);
}

Expand Down Expand Up @@ -350,10 +347,10 @@ TaskBarWidget::TaskBarWidget() : GuiWidget("taskbar"), d(new Instance(this))

d->backBlur = new LabelWidget;
d->backBlur->rule()
.setInput(Rule::Left, rule().left())
.setInput(Rule::Left, rule().left())
.setInput(Rule::Bottom, rule().bottom())
.setInput(Rule::Right, rule().right())
.setInput(Rule::Top, rule().top());
.setInput(Rule::Right, rule().right())
.setInput(Rule::Top, rule().top());
d->backBlur->set(Background(ClientWindow::main().taskBarBlur(), Vector4f(1, 1, 1, 1)));
add(d->backBlur);

Expand Down Expand Up @@ -461,8 +458,13 @@ TaskBarWidget::TaskBarWidget() : GuiWidget("taskbar"), d(new Instance(this))
<< unloadMenu // hidden with null-game
<< new ui::Item(ui::Item::Separator)
<< new ui::Item(ui::Item::Separator, tr("Doomsday"))
<< new ui::ActionItem(tr("Packages"), new SignalAction(this, SLOT(openPackagesSidebar())))
<< new ui::ActionItem(tr("IWAD Folder..."), new SignalAction(this, SLOT(chooseIWADFolder())))
<< new ui::ActionItem(tr("Packages..."), new SignalAction(this, SLOT(openPackagesSidebar())))
//<< new ui::ActionItem(tr("IWAD Folder..."), new SignalAction(this, SLOT(chooseIWADFolder())))
<< new ui::SubwidgetItem(tr("IWAD Folders"), ui::Left, [] () -> PopupWidget * {
PopupWidget *pop = new PopupWidget;
pop->setContent(new DirectoryArrayWidget(App::config("resource.iwadFolder")));
return pop;
})
<< new ui::ActionItem(tr("Check for Updates..."), new CommandAction("updateandnotify"))
<< new ui::ActionItem(tr("About Doomsday"), new SignalAction(this, SLOT(showAbout())))
<< helpMenu
Expand Down Expand Up @@ -732,8 +734,10 @@ void TaskBarWidget::chooseIWADFolder()

bool reload = false;



// Use a native dialog to select the IWAD folder.
ClientApp::app().beginNativeUIMode();
/*ClientApp::app().beginNativeUIMode();
QFileDialog dlg(&ClientWindow::main(),
tr("Select IWAD Folder"),
Expand All @@ -748,7 +752,7 @@ void TaskBarWidget::chooseIWADFolder()
reload = true;
}
ClientApp::app().endNativeUIMode();
ClientApp::app().endNativeUIMode();*/

// Reload packages and recheck for game availability.
if (reload)
Expand Down
5 changes: 4 additions & 1 deletion doomsday/apps/libdoomsday/src/doomsdayapp.cpp
Expand Up @@ -256,7 +256,10 @@ DENG2_PIMPL(DoomsdayApp)
}

// Configured via GUI.
attachWadFeed("user-selected", App::config().gets("resource.iwadFolder", ""));
for (String path : App::config().getStringList("resource.iwadFolder"))
{
attachWadFeed("user-selected", path);
}

wads.populate();
}
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/libdoomsday/src/resource/databundle.cpp
Expand Up @@ -453,7 +453,7 @@ DENG2_PIMPL(DataBundle)
*/
void parseSnowberryInfo(File const &infoFile, Record &meta)
{
Info info(String::fromUtf8(Block(infoFile)));
Info info(infoFile);
auto const &rootBlock = info.root();

// Tag it as a Snowberry package.
Expand Down
3 changes: 2 additions & 1 deletion doomsday/apps/libdoomsday/src/resource/resources.cpp
Expand Up @@ -110,6 +110,7 @@ ResourceClass &Resources::resClass(resourceclassid_t id)

void Resources::updateOverrideIWADPathFromConfig()
{
/*
String path = App::config().gets("resource.iwadFolder", "");
if (!path.isEmpty())
{
Expand All @@ -119,7 +120,7 @@ void Resources::updateOverrideIWADPathFromConfig()
ps.clearSearchPathGroup(FS1::OverridePaths);
ps.addSearchPath(SearchPath(de::Uri::fromNativeDirPath(path, RC_PACKAGE),
SearchPath::NoDescend), FS1::OverridePaths);
}
}*/
}

NativePath Resources::nativeSavePath() const
Expand Down

0 comments on commit d7f4e2a

Please sign in to comment.