Fixing #1895, first draft.
Known problems: * no paging in the network hub results (see SearchWindow.cxx:703); * row coloring problem #1902.
This commit is contained in:
parent
4f8c9aa226
commit
7b23ed6103
6 changed files with 311 additions and 30 deletions
|
@ -318,6 +318,17 @@ class SearchCriteria
|
||||||
condition->value);
|
condition->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the limit field.
|
||||||
|
*
|
||||||
|
* @return the maximum number of search results to be returned
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
getLimit() throw()
|
||||||
|
{
|
||||||
|
return limit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the limit field.
|
* Set the limit field.
|
||||||
*
|
*
|
||||||
|
@ -335,6 +346,18 @@ class SearchCriteria
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the offset field.
|
||||||
|
*
|
||||||
|
* @return the index of the first matching condition
|
||||||
|
* to be returned (first = 0)
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
getOffset() throw()
|
||||||
|
{
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the offset field.
|
* Set the offset field.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1391,14 +1391,12 @@ GLiveSupport :: detachCueAudioListener(AudioPlayerEventListener * listener)
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Search in the local storage.
|
* Search in the local storage.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
Ptr<LiveSupport::GLiveSupport::GLiveSupport::PlayableList>::Ref
|
int
|
||||||
LiveSupport :: GLiveSupport ::
|
LiveSupport :: GLiveSupport ::
|
||||||
GLiveSupport :: search(Ptr<SearchCriteria>::Ref criteria)
|
GLiveSupport :: search(Ptr<SearchCriteria>::Ref criteria)
|
||||||
throw (XmlRpcException)
|
throw (XmlRpcException)
|
||||||
{
|
{
|
||||||
storage->search(sessionId, criteria);
|
return storage->search(sessionId, criteria);
|
||||||
|
|
||||||
return getSearchResults();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -962,13 +962,16 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search in the local storage.
|
* Search in the local storage.
|
||||||
|
* Note that the return value (number of items found) will not be
|
||||||
|
* the same as the size of getSearchResults() if the limit and offset
|
||||||
|
* fields in the criteria parameter are not zero.
|
||||||
*
|
*
|
||||||
* @param criteria the search conditions to use.
|
* @param criteria the search conditions to use.
|
||||||
* @return the list of audio clips and playlists found.
|
* @return the number of audio clips and playlists found.
|
||||||
* @exception XmlRpcException thrown by
|
* @exception XmlRpcException thrown by
|
||||||
* StorageClientInterface::search()
|
* StorageClientInterface::search()
|
||||||
*/
|
*/
|
||||||
Ptr<PlayableList>::Ref
|
int
|
||||||
search(Ptr<SearchCriteria>::Ref criteria)
|
search(Ptr<SearchCriteria>::Ref criteria)
|
||||||
throw (XmlRpcException);
|
throw (XmlRpcException);
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,21 @@ const std::string searchWhereLocalKey = "searchWhereLocal";
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
const std::string searchWhereRemoteKey = "searchWhereRemote";
|
const std::string searchWhereRemoteKey = "searchWhereRemote";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The number of items which can be shown in the search results.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const int searchResultsSize = 10;
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The label for the Backward button.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const Glib::ustring backwardButtonText = "⇧";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The label for the Forward button.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const Glib::ustring forwardButtonText = "⇩";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
@ -111,11 +126,11 @@ SearchWindow :: SearchWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the search results box
|
// set up the search results box
|
||||||
ScrolledWindow * searchResultsView = constructSearchResultsView();
|
Gtk::Box * searchResultsView = constructSearchResultsView();
|
||||||
|
|
||||||
// set the sizes of the two parts of the window
|
// set the sizes of the two parts of the window
|
||||||
searchInput ->set_size_request(750, 240);
|
searchInput ->set_size_request(750, 231);
|
||||||
searchResultsView->set_size_request(750, 300);
|
searchResultsView->set_size_request(750, 340);
|
||||||
|
|
||||||
// put them in one big box
|
// put them in one big box
|
||||||
Gtk::VBox * bigBox = Gtk::manage(new Gtk::VBox);
|
Gtk::VBox * bigBox = Gtk::manage(new Gtk::VBox);
|
||||||
|
@ -318,7 +333,7 @@ SearchWindow :: constructTransportsView(void) throw ()
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Construct the search results display.
|
* Construct the search results display.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
ScrolledWindow *
|
Gtk::Box *
|
||||||
SearchWindow :: constructSearchResultsView(void) throw ()
|
SearchWindow :: constructSearchResultsView(void) throw ()
|
||||||
{
|
{
|
||||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||||
|
@ -341,16 +356,16 @@ SearchWindow :: constructSearchResultsView(void) throw ()
|
||||||
modelColumns.typeColumn, 20);
|
modelColumns.typeColumn, 20);
|
||||||
searchResultsTreeView->appendColumn(
|
searchResultsTreeView->appendColumn(
|
||||||
*getResourceUstring("titleColumnLabel"),
|
*getResourceUstring("titleColumnLabel"),
|
||||||
modelColumns.titleColumn, 320);
|
modelColumns.titleColumn, 300);
|
||||||
searchResultsTreeView->appendColumn(
|
searchResultsTreeView->appendColumn(
|
||||||
*getResourceUstring("creatorColumnLabel"),
|
*getResourceUstring("creatorColumnLabel"),
|
||||||
modelColumns.creatorColumn, 200);
|
modelColumns.creatorColumn, 200);
|
||||||
searchResultsTreeView->appendColumn(
|
searchResultsTreeView->appendColumn(
|
||||||
*getResourceUstring("sourceColumnLabel"),
|
*getResourceUstring("sourceColumnLabel"),
|
||||||
modelColumns.sourceColumn, 150);
|
modelColumns.sourceColumn, 145);
|
||||||
searchResultsTreeView->appendCenteredColumn(
|
searchResultsTreeView->appendCenteredColumn(
|
||||||
*getResourceUstring("lengthColumnLabel"),
|
*getResourceUstring("lengthColumnLabel"),
|
||||||
modelColumns.lengthColumn, 50);
|
modelColumns.lengthColumn, 55);
|
||||||
} catch (std::invalid_argument &e) {
|
} catch (std::invalid_argument &e) {
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
std::exit(1);
|
std::exit(1);
|
||||||
|
@ -368,9 +383,25 @@ SearchWindow :: constructSearchResultsView(void) throw ()
|
||||||
constructRemoteContextMenu();
|
constructRemoteContextMenu();
|
||||||
|
|
||||||
// put the tree view inside a scrolled window
|
// put the tree view inside a scrolled window
|
||||||
ScrolledWindow * view = Gtk::manage(new ScrolledWindow);
|
ScrolledWindow * resultsWindow = Gtk::manage(new ScrolledWindow);
|
||||||
view->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
resultsWindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
||||||
view->add(*searchResultsTreeView);
|
resultsWindow->add(*searchResultsTreeView);
|
||||||
|
|
||||||
|
// create the page backward and forward buttons
|
||||||
|
backwardButton = Gtk::manage(wf->createButton(backwardButtonText));
|
||||||
|
forwardButton = Gtk::manage(wf->createButton(forwardButtonText));
|
||||||
|
|
||||||
|
backwardButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&SearchWindow::onBackwardButtonClicked));
|
||||||
|
forwardButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&SearchWindow::onForwardButtonClicked));
|
||||||
|
updateBackwardAndForwardButtons();
|
||||||
|
|
||||||
|
// pack everything in a box
|
||||||
|
Gtk::Box * view = Gtk::manage(new Gtk::VBox);
|
||||||
|
view->pack_start(*backwardButton, Gtk::PACK_SHRINK, 2);
|
||||||
|
view->pack_start(*resultsWindow, Gtk::PACK_EXPAND_WIDGET, 0);
|
||||||
|
view->pack_start(*forwardButton, Gtk::PACK_SHRINK, 2);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -407,7 +438,7 @@ SearchWindow :: onSimpleSearch(void) throw ()
|
||||||
criteria->addCondition(*metadata->getDcName(), "partial", value);
|
criteria->addCondition(*metadata->getDcName(), "partial", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearch(criteria);
|
onInitialSearch(criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -417,7 +448,7 @@ SearchWindow :: onSimpleSearch(void) throw ()
|
||||||
void
|
void
|
||||||
SearchWindow :: onAdvancedSearch(void) throw ()
|
SearchWindow :: onAdvancedSearch(void) throw ()
|
||||||
{
|
{
|
||||||
onSearch(advancedSearchEntry->getSearchCriteria());
|
onInitialSearch(advancedSearchEntry->getSearchCriteria());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -427,7 +458,33 @@ SearchWindow :: onAdvancedSearch(void) throw ()
|
||||||
void
|
void
|
||||||
SearchWindow :: onBrowse(void) throw ()
|
SearchWindow :: onBrowse(void) throw ()
|
||||||
{
|
{
|
||||||
onSearch(browseEntry->getSearchCriteria());
|
onInitialSearch(browseEntry->getSearchCriteria());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Do the searching (first set of results).
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SearchWindow :: onInitialSearch(Ptr<SearchCriteria>::Ref criteria)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
criteria->setOffset(0);
|
||||||
|
criteria->setLimit(getSearchResultsSize());
|
||||||
|
onSearch(criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Do the searching (after paging backward or forward).
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SearchWindow :: onContinuedSearch(int offset)
|
||||||
|
throw ()
|
||||||
|
{
|
||||||
|
Ptr<SearchCriteria>::Ref criteria = getSearchCriteria();
|
||||||
|
criteria->setOffset(offset);
|
||||||
|
onSearch(criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -458,12 +515,15 @@ SearchWindow :: localSearch(Ptr<SearchCriteria>::Ref criteria)
|
||||||
|
|
||||||
Ptr<GLiveSupport::PlayableList>::Ref searchResults;
|
Ptr<GLiveSupport::PlayableList>::Ref searchResults;
|
||||||
try {
|
try {
|
||||||
searchResults = gLiveSupport->search(criteria);
|
localSearchResultsCount = gLiveSupport->search(criteria);
|
||||||
|
searchResults = gLiveSupport->getSearchResults();
|
||||||
} catch (XmlRpcException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
displayLocalSearchError(e);
|
displayLocalSearchError(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
localSearchCriteria = criteria;
|
||||||
|
|
||||||
displaySearchResults(searchResults, localSearchResults);
|
displaySearchResults(searchResults, localSearchResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,6 +539,7 @@ SearchWindow :: displaySearchResults(
|
||||||
{
|
{
|
||||||
treeModel->clear();
|
treeModel->clear();
|
||||||
searchResultsTreeView->set_model(treeModel);
|
searchResultsTreeView->set_model(treeModel);
|
||||||
|
updateBackwardAndForwardButtons();
|
||||||
|
|
||||||
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
|
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
|
||||||
|
|
||||||
|
@ -595,6 +656,8 @@ SearchWindow :: remoteSearchOpen(Ptr<SearchCriteria>::Ref criteria)
|
||||||
} catch (XmlRpcException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
displayRemoteSearchError(e);
|
displayRemoteSearchError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remoteSearchCriteria = criteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -637,6 +700,7 @@ SearchWindow :: remoteSearchClose(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remoteSearchResultsCount = results->size(); // FIXME
|
||||||
displaySearchResults(results, remoteSearchResults);
|
displaySearchResults(results, remoteSearchResults);
|
||||||
|
|
||||||
} else if (state == AsyncState::closedState) {
|
} else if (state == AsyncState::closedState) {
|
||||||
|
@ -971,6 +1035,8 @@ SearchWindow :: onSearchWhereChanged(void) throw ()
|
||||||
} else {
|
} else {
|
||||||
searchResultsTreeView->set_model(remoteSearchResults);
|
searchResultsTreeView->set_model(remoteSearchResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateBackwardAndForwardButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1073,3 +1139,69 @@ SearchWindow :: constructRemoteContextMenu(void) throw ()
|
||||||
remoteContextMenu->accelerate(*this);
|
remoteContextMenu->accelerate(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Return the number of search results which can be displayed.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
int
|
||||||
|
SearchWindow :: getSearchResultsSize(void) throw ()
|
||||||
|
{
|
||||||
|
return searchResultsSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for a click on the Backward button.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SearchWindow :: onBackwardButtonClicked(void) throw ()
|
||||||
|
{
|
||||||
|
Ptr<SearchCriteria>::Ref criteria = getSearchCriteria();
|
||||||
|
int offset = criteria->getOffset();
|
||||||
|
|
||||||
|
if (offset > 0) {
|
||||||
|
int newOffset = offset - getSearchResultsSize();
|
||||||
|
if (newOffset < 0) {
|
||||||
|
newOffset = 0;
|
||||||
|
}
|
||||||
|
onContinuedSearch(newOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for a click on the Forward button.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SearchWindow :: onForwardButtonClicked(void) throw ()
|
||||||
|
{
|
||||||
|
Ptr<SearchCriteria>::Ref criteria = getSearchCriteria();
|
||||||
|
int offset = criteria->getOffset();
|
||||||
|
int count = getSearchResultsCount();
|
||||||
|
|
||||||
|
int newOffset = offset + getSearchResultsSize();
|
||||||
|
if (newOffset < count) {
|
||||||
|
onContinuedSearch(newOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Enable or disable the Backward and Forward buttons.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SearchWindow :: updateBackwardAndForwardButtons(void) throw ()
|
||||||
|
{
|
||||||
|
Ptr<SearchCriteria>::Ref criteria = getSearchCriteria();
|
||||||
|
|
||||||
|
if (criteria) {
|
||||||
|
int offset = criteria->getOffset();
|
||||||
|
int count = getSearchResultsCount();
|
||||||
|
backwardButton->setDisabled(offset == 0);
|
||||||
|
forwardButton->setDisabled(offset + getSearchResultsSize() >= count);
|
||||||
|
} else {
|
||||||
|
backwardButton->setDisabled(true);
|
||||||
|
forwardButton->setDisabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,26 @@ class SearchWindow : public GuiWindow
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The criteria for the last local search.
|
||||||
|
*/
|
||||||
|
Ptr<SearchCriteria>::Ref localSearchCriteria;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The criteria for the last remote search.
|
||||||
|
*/
|
||||||
|
Ptr<SearchCriteria>::Ref remoteSearchCriteria;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of items found by the last local search.
|
||||||
|
*/
|
||||||
|
int localSearchResultsCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of items found by the last remote search.
|
||||||
|
*/
|
||||||
|
int remoteSearchResultsCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The "search where" input field.
|
* The "search where" input field.
|
||||||
*/
|
*/
|
||||||
|
@ -108,6 +128,16 @@ class SearchWindow : public GuiWindow
|
||||||
*/
|
*/
|
||||||
TransportList * transportList;
|
TransportList * transportList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The button for paging in the search results backward.
|
||||||
|
*/
|
||||||
|
Button * backwardButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The button for paging in the search results forward.
|
||||||
|
*/
|
||||||
|
Button * forwardButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Export Playlist pop-up window.
|
* The Export Playlist pop-up window.
|
||||||
*/
|
*/
|
||||||
|
@ -164,9 +194,9 @@ class SearchWindow : public GuiWindow
|
||||||
/**
|
/**
|
||||||
* Construct the search results display.
|
* Construct the search results display.
|
||||||
*
|
*
|
||||||
* @return a pointer to the new tree view (already Gtk::manage()'ed)
|
* @return a pointer to the new view (already Gtk::manage()'ed)
|
||||||
*/
|
*/
|
||||||
ScrolledWindow *
|
Gtk::Box *
|
||||||
constructSearchResultsView(void) throw ();
|
constructSearchResultsView(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -206,6 +236,24 @@ class SearchWindow : public GuiWindow
|
||||||
void
|
void
|
||||||
onBrowse(void) throw ();
|
onBrowse(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do the searching (first set of results).
|
||||||
|
* Sets the offset to 0, and calls onSearch().
|
||||||
|
*
|
||||||
|
* @param criteria the search criteria.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
onInitialSearch(Ptr<SearchCriteria>::Ref criteria) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do the searching (after paging backward or forward).
|
||||||
|
* Sets the offset to the given value, and calls onSearch().
|
||||||
|
*
|
||||||
|
* @param offset the new offset to use for this search.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
onContinuedSearch(int offset) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do the searching.
|
* Do the searching.
|
||||||
* Calls either localSearch() or remoteSearch().
|
* Calls either localSearch() or remoteSearch().
|
||||||
|
@ -221,6 +269,55 @@ class SearchWindow : public GuiWindow
|
||||||
bool
|
bool
|
||||||
searchIsLocal(void) throw ();
|
searchIsLocal(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the search criteria used for the last search
|
||||||
|
* of the currently selected kind.
|
||||||
|
* Returns either localSearchCriteria or remoteSearchCriteria
|
||||||
|
* depending on the value of searchIsLocal().
|
||||||
|
*
|
||||||
|
* @return the saved search criteria of the appropriate kind;
|
||||||
|
* or a 0 pointer if nothing has been saved yet.
|
||||||
|
*/
|
||||||
|
Ptr<SearchCriteria>::Ref
|
||||||
|
getSearchCriteria(void) throw ()
|
||||||
|
{
|
||||||
|
return searchIsLocal() ? localSearchCriteria
|
||||||
|
: remoteSearchCriteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the search criteria for the currently selected kind.
|
||||||
|
* Sets either localSearchCriteria or remoteSearchCriteria
|
||||||
|
* depending on the value of searchIsLocal().
|
||||||
|
*
|
||||||
|
* @param criteria the new criteria to be saved.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
setSearchCriteria(Ptr<SearchCriteria>::Ref criteria) throw ()
|
||||||
|
{
|
||||||
|
if (searchIsLocal()) {
|
||||||
|
localSearchCriteria = criteria;
|
||||||
|
} else {
|
||||||
|
remoteSearchCriteria = criteria;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of search results found by the last search
|
||||||
|
* of the currently selected kind.
|
||||||
|
* Returns either localSearchResultsCount or remoteSearchResultsCount
|
||||||
|
* depending on the value of searchIsLocal().
|
||||||
|
*
|
||||||
|
* @return the saved search result count of the appropriate kind;
|
||||||
|
* undefined if nothing has been saved yet.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
getSearchResultsCount(void) throw ()
|
||||||
|
{
|
||||||
|
return searchIsLocal() ? localSearchResultsCount
|
||||||
|
: remoteSearchResultsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the displayed search results (local or remote).
|
* Change the displayed search results (local or remote).
|
||||||
*/
|
*/
|
||||||
|
@ -260,6 +357,12 @@ class SearchWindow : public GuiWindow
|
||||||
Glib::RefPtr<Gtk::ListStore> treeModel)
|
Glib::RefPtr<Gtk::ListStore> treeModel)
|
||||||
throw ();
|
throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable or disable the Backward and Forward buttons.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
updateBackwardAndForwardButtons(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorting function for the search results.
|
* Sorting function for the search results.
|
||||||
*
|
*
|
||||||
|
@ -311,21 +414,33 @@ class SearchWindow : public GuiWindow
|
||||||
* Signal handler for the "export playlist" menu item selected from
|
* Signal handler for the "export playlist" menu item selected from
|
||||||
* the entry context menu.
|
* the entry context menu.
|
||||||
*/
|
*/
|
||||||
virtual void
|
void
|
||||||
onExportPlaylist(void) throw ();
|
onExportPlaylist(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal handler for "upload to hub" in the context menu.
|
* Signal handler for "upload to hub" in the context menu.
|
||||||
*/
|
*/
|
||||||
virtual void
|
void
|
||||||
onUploadToHub(void) throw ();
|
onUploadToHub(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal handler for "download from hub" in the context menu.
|
* Signal handler for "download from hub" in the context menu.
|
||||||
*/
|
*/
|
||||||
virtual void
|
void
|
||||||
onDownloadFromHub(void) throw ();
|
onDownloadFromHub(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event handler for a click on the Backward button.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
onBackwardButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event handler for a click on the Forward button.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
onForwardButtonClicked(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler called when the the window gets hidden.
|
* Event handler called when the the window gets hidden.
|
||||||
*
|
*
|
||||||
|
@ -469,6 +584,16 @@ class SearchWindow : public GuiWindow
|
||||||
displayRemoteSearchError(const XmlRpcException & error)
|
displayRemoteSearchError(const XmlRpcException & error)
|
||||||
throw ();
|
throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the number of search results which can be displayed.
|
||||||
|
* As currently implemented, this returns a constant 10.
|
||||||
|
*
|
||||||
|
* @return the number of rows which can be displayed in the
|
||||||
|
* search results section of the window.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
getSearchResultsSize(void) throw ();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue