Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Widgets|libappfw: Dialog for managing a list of directories
- Loading branch information
Showing
9 changed files
with
156 additions
and
13 deletions.
There are no files selected for viewing
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 @@ | ||
#include "dialogs/directorylistdialog.h" |
53 changes: 53 additions & 0 deletions
53
doomsday/sdk/libappfw/include/de/dialogs/directorylistdialog.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,53 @@ | ||
/** @file directorylistdialog.h Dialog for editing a list of directories. | ||
* | ||
* @authors Copyright (c) 2016 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* LGPL: http://www.gnu.org/licenses/lgpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 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 Lesser | ||
* General Public License for more details. You should have received a copy of | ||
* the GNU Lesser General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#ifndef LIBAPPFW_DIRECTORYLISTDIALOG_H | ||
#define LIBAPPFW_DIRECTORYLISTDIALOG_H | ||
|
||
#include "../MessageDialog" | ||
#include "../DirectoryArrayWidget" | ||
|
||
namespace de { | ||
|
||
/** | ||
* Dialog for editing a list of directories. | ||
*/ | ||
class LIBAPPFW_PUBLIC DirectoryListDialog : public MessageDialog | ||
{ | ||
public: | ||
DirectoryListDialog(String const &name = String()); | ||
|
||
/** | ||
* Sets the list elements. | ||
* @param elements Array of text strings, or a single TextValue. | ||
*/ | ||
void setValue(Value const &elements); | ||
|
||
/** | ||
* Returns the contents of the directory list. | ||
* Array of text strings, or a single TextValue. | ||
*/ | ||
Value const &value() const; | ||
|
||
private: | ||
DENG2_PRIVATE(d) | ||
}; | ||
|
||
} // namespace de | ||
|
||
#endif // LIBAPPFW_DIRECTORYLISTDIALOG_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
2 changes: 1 addition & 1 deletion
2
doomsday/sdk/libappfw/include/de/widgets/directoryarraywidget.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** @file directorylistdialog.cpp Dialog for editing a list of directories. | ||
* | ||
* @authors Copyright (c) 2016 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* LGPL: http://www.gnu.org/licenses/lgpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 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 Lesser | ||
* General Public License for more details. You should have received a copy of | ||
* the GNU Lesser General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#include "de/DirectoryListDialog" | ||
#include "de/DirectoryArrayWidget" | ||
|
||
#include <de/SignalAction> | ||
|
||
namespace de { | ||
|
||
DENG2_PIMPL(DirectoryListDialog) | ||
{ | ||
Variable array; | ||
DirectoryArrayWidget *list; | ||
|
||
Instance(Public *i) : Base(i) | ||
{ | ||
array.set(new ArrayValue); | ||
list = new DirectoryArrayWidget(array); | ||
self.add(list->detachAddButton(self.area().rule().width())); | ||
list->addButton().hide(); | ||
} | ||
}; | ||
|
||
DirectoryListDialog::DirectoryListDialog(String const &name) | ||
: MessageDialog(name) | ||
, d(new Instance(this)) | ||
{ | ||
area().add(d->list); | ||
|
||
buttons() << new DialogButtonItem(Default | Accept) | ||
<< new DialogButtonItem(Reject) | ||
<< new DialogButtonItem(Action, style().images().image("create"), | ||
tr("Add Folder"), | ||
new SignalAction(&d->list->addButton(), SLOT(trigger()))); | ||
|
||
updateLayout(); | ||
} | ||
|
||
void DirectoryListDialog::setValue(Value const &elements) | ||
{ | ||
d->array.set(elements); | ||
} | ||
|
||
Value const &DirectoryListDialog::value() const | ||
{ | ||
return d->array.value(); | ||
} | ||
|
||
} // namespace de |
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