moved SearchCriteria from Storage to Core;
added get_text() function to Widgets/EntryBin; moved advanced search input box to Widgets; added (first, testing) functionality to search button in advanced search
This commit is contained in:
parent
212f97ea93
commit
0fc4dd64d6
13 changed files with 377 additions and 83 deletions
|
@ -20,8 +20,8 @@
|
|||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#
|
||||
# Author : $Author: maroy $
|
||||
# Version : $Revision: 1.26 $
|
||||
# Author : $Author: fgerlits $
|
||||
# Version : $Revision: 1.27 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/etc/Makefile.in,v $
|
||||
#
|
||||
# @configure_input@
|
||||
|
@ -126,7 +126,8 @@ CORE_LIB_OBJS = ${TMP_DIR}/UniqueId.o \
|
|||
${TMP_DIR}/XmlRpcTools.o \
|
||||
${TMP_DIR}/XmlRpcException.o \
|
||||
${TMP_DIR}/TagConversion.o \
|
||||
${TMP_DIR}/BaseTestMethod.o
|
||||
${TMP_DIR}/BaseTestMethod.o \
|
||||
${TMP_DIR}/SearchCriteria.o
|
||||
|
||||
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
|
||||
${TMP_DIR}/UniqueIdTest.o \
|
||||
|
@ -141,7 +142,8 @@ TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
|
|||
${TMP_DIR}/LocalizedConfigurableTest.o \
|
||||
${TMP_DIR}/Md5Test.o \
|
||||
${TMP_DIR}/XmlRpcToolsTest.o \
|
||||
${TMP_DIR}/TagConversionTest.o
|
||||
${TMP_DIR}/TagConversionTest.o \
|
||||
${TMP_DIR}/SearchCriteriaTest.o
|
||||
|
||||
TEST_RUNNER_RES = ${TMP_DIR}/${PACKAGE_NAME}_root.res \
|
||||
${TMP_DIR}/${PACKAGE_NAME}_en.res \
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.4 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/include/LiveSupport/Storage/Attic/SearchCriteria.h,v $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/SearchCriteria.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef LiveSupport_Storage_SearchCriteria_h
|
||||
#define LiveSupport_Storage_SearchCriteria_h
|
||||
#ifndef LiveSupport_Core_SearchCriteria_h
|
||||
#define LiveSupport_Core_SearchCriteria_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
|
@ -44,10 +44,14 @@
|
|||
#include <cctype>
|
||||
#include <XmlRpcValue.h>
|
||||
|
||||
// forward declaration of friend class
|
||||
namespace LiveSupport {
|
||||
namespace Storage {
|
||||
class TestStorageClient;
|
||||
} }
|
||||
|
||||
class TestStorageClient; // forward declaration of friend class
|
||||
namespace LiveSupport {
|
||||
namespace Core {
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
@ -150,7 +154,7 @@ class SearchCriteria
|
|||
/**
|
||||
* Give access of private members to the TestStorageClient.
|
||||
*/
|
||||
friend class Storage::TestStorageClient;
|
||||
friend class LiveSupport::Storage::TestStorageClient;
|
||||
|
||||
|
||||
public:
|
||||
|
@ -283,8 +287,8 @@ class SearchCriteria
|
|||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Storage
|
||||
} // namespace Core
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Storage_SearchCriteria_h
|
||||
#endif // LiveSupport_Core_SearchCriteria_h
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.4 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/Attic/SearchCriteria.cxx,v $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/SearchCriteria.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -33,9 +33,9 @@
|
|||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include "LiveSupport/Storage/SearchCriteria.h"
|
||||
#include "LiveSupport/Core/SearchCriteria.h"
|
||||
|
||||
using namespace LiveSupport::Storage;
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
|
@ -22,17 +22,19 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.2 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/Attic/SearchCriteriaTest.cxx,v $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/SearchCriteriaTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#include "LiveSupport/Storage/SearchCriteria.h"
|
||||
#include <iostream>
|
||||
|
||||
#include "LiveSupport/Core/SearchCriteria.h"
|
||||
#include "SearchCriteriaTest.h"
|
||||
|
||||
using namespace LiveSupport::Storage;
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
@ -66,8 +68,6 @@ SearchCriteriaTest :: tearDown(void) throw ()
|
|||
}
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Test to see if we can do some simple operations
|
||||
*----------------------------------------------------------------------------*/
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/Attic/SearchCriteriaTest.h,v $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/SearchCriteriaTest.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef SearchCriteriaTest_h
|
||||
|
@ -44,7 +44,7 @@
|
|||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Storage {
|
||||
namespace Core {
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
@ -100,7 +100,7 @@ class SearchCriteriaTest : public CPPUNIT_NS::TestFixture
|
|||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Storage
|
||||
} // namespace Core
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // SearchCriteriaTest_h
|
|
@ -21,7 +21,7 @@
|
|||
#
|
||||
#
|
||||
# Author : $Author: fgerlits $
|
||||
# Version : $Revision: 1.20 $
|
||||
# Version : $Revision: 1.21 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/etc/Makefile.in,v $
|
||||
#
|
||||
# @configure_input@
|
||||
|
@ -115,13 +115,11 @@ LDFLAGS = @LDFLAGS@ -pthread \
|
|||
#-------------------------------------------------------------------------------
|
||||
# Dependencies
|
||||
#-------------------------------------------------------------------------------
|
||||
STORAGE_LIB_OBJS = ${TMP_DIR}/SearchCriteria.o \
|
||||
${TMP_DIR}/StorageClientFactory.o \
|
||||
STORAGE_LIB_OBJS = ${TMP_DIR}/StorageClientFactory.o \
|
||||
${TMP_DIR}/TestStorageClient.o \
|
||||
${TMP_DIR}/WebStorageClient.o
|
||||
|
||||
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
|
||||
${TMP_DIR}/SearchCriteriaTest.o \
|
||||
${TMP_DIR}/StorageClientFactoryTest.o \
|
||||
${TMP_DIR}/TestStorageClientTest.o \
|
||||
${TMP_DIR}/WebStorageClientTest.o
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.11 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.12 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/include/LiveSupport/Storage/StorageClientInterface.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -46,8 +46,7 @@
|
|||
#include "LiveSupport/Core/Playlist.h"
|
||||
#include "LiveSupport/Core/SessionId.h"
|
||||
#include "LiveSupport/Core/XmlRpcException.h"
|
||||
|
||||
#include "LiveSupport/Storage/SearchCriteria.h"
|
||||
#include "LiveSupport/Core/SearchCriteria.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
|
@ -66,8 +65,8 @@ using namespace Core;
|
|||
/**
|
||||
* An interface for storage clients.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.11 $
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.12 $
|
||||
*/
|
||||
class StorageClientInterface
|
||||
{
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#
|
||||
# Author : $Author: maroy $
|
||||
# Version : $Revision: 1.13 $
|
||||
# Author : $Author: fgerlits $
|
||||
# Version : $Revision: 1.14 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/etc/Makefile.in,v $
|
||||
#
|
||||
# @configure_input@
|
||||
|
@ -120,7 +120,9 @@ WIDGETS_LIB_OBJS = ${TMP_DIR}/ImageButton.o \
|
|||
${TMP_DIR}/ZebraTreeView.o \
|
||||
${TMP_DIR}/ZebraCellRenderer.o \
|
||||
${TMP_DIR}/Colors.o \
|
||||
${TMP_DIR}/MessageWindow.o
|
||||
${TMP_DIR}/MessageWindow.o \
|
||||
${TMP_DIR}/AdvancedSearchEntry.o
|
||||
|
||||
TEST_EXE_OBJS = ${TMP_DIR}/TestWindow.o \
|
||||
${TMP_DIR}/main.o
|
||||
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport 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.
|
||||
|
||||
LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/Attic/AdvancedSearchEntry.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef LiveSupport_Widgets_AdvancedSearchEntry_h
|
||||
#define LiveSupport_Widgets_AdvancedSearchEntry_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <gtkmm/box.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Core/LocalizedObject.h"
|
||||
#include "LiveSupport/Core/SearchCriteria.h"
|
||||
#include "LiveSupport/Widgets/ComboBoxText.h"
|
||||
#include "LiveSupport/Widgets/EntryBin.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace Widgets {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* A Gtk::VBox with one or more search input fields in it.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
class AdvancedSearchEntry : public Gtk::VBox,
|
||||
public LocalizedObject
|
||||
{
|
||||
private:
|
||||
|
||||
/**
|
||||
* The metadata field.
|
||||
*/
|
||||
ComboBoxText * metadataType;
|
||||
|
||||
/**
|
||||
* The operator field.
|
||||
*/
|
||||
ComboBoxText * operatorType;
|
||||
|
||||
/**
|
||||
* The "search for this value" field.
|
||||
*/
|
||||
EntryBin * entryBin;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
AdvancedSearchEntry(void) throw ();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor with localization parameter.
|
||||
*/
|
||||
AdvancedSearchEntry(Ptr<ResourceBundle>::Ref bundle)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* A virtual destructor.
|
||||
*/
|
||||
virtual
|
||||
~AdvancedSearchEntry(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current state of the search fields.
|
||||
*
|
||||
* @return a new LiveSupport::Storage::SearchCriteria instance,
|
||||
* which contains the data entered by the user
|
||||
*/
|
||||
Ptr<SearchCriteria>::Ref
|
||||
getSearchCriteria(void) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace Widgets
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // LiveSupport_Widgets_AdvancedSearchEntry_h
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.3 $
|
||||
Version : $Revision: 1.4 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/EntryBin.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -65,7 +65,7 @@ using namespace LiveSupport::Core;
|
|||
* A container, holding a Gtk::Entry as its only child.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.3 $
|
||||
* @version $Revision: 1.4 $
|
||||
*/
|
||||
class EntryBin : public BlueBin
|
||||
{
|
||||
|
@ -103,6 +103,17 @@ class EntryBin : public BlueBin
|
|||
{
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the text of the entry.
|
||||
*
|
||||
* @return the get_text() string of the Gtk::Entry.
|
||||
*/
|
||||
Glib::ustring
|
||||
get_text(void) throw ()
|
||||
{
|
||||
return getEntry()->get_text();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
146
livesupport/modules/widgets/src/AdvancedSearchEntry.cxx
Normal file
146
livesupport/modules/widgets/src/AdvancedSearchEntry.cxx
Normal file
|
@ -0,0 +1,146 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport 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.
|
||||
|
||||
LiveSupport 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 LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/Attic/AdvancedSearchEntry.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||
|
||||
#include "LiveSupport/Widgets/AdvancedSearchEntry.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constructor.
|
||||
*----------------------------------------------------------------------------*/
|
||||
AdvancedSearchEntry :: AdvancedSearchEntry(Ptr<ResourceBundle>::Ref bundle)
|
||||
throw ()
|
||||
: LocalizedObject(bundle)
|
||||
{using namespace LiveSupport::Storage;
|
||||
|
||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||
|
||||
// only one option for now
|
||||
Gtk::Box * searchOptionsBox = Gtk::manage(new Gtk::HBox);
|
||||
pack_start(*searchOptionsBox, Gtk::PACK_SHRINK, 5);
|
||||
|
||||
try {
|
||||
Gtk::Label * searchByLabel = Gtk::manage(new Gtk::Label(
|
||||
*getResourceUstring("searchByTextLabel") ));
|
||||
searchOptionsBox->pack_start(*searchByLabel, Gtk::PACK_SHRINK, 0);
|
||||
|
||||
} catch (std::invalid_argument &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
metadataType = Gtk::manage(wf->createComboBoxText());
|
||||
metadataType->append_text("Title");
|
||||
metadataType->append_text("Creator");
|
||||
metadataType->append_text("Length");
|
||||
metadataType->set_active_text("Title");
|
||||
searchOptionsBox->pack_start(*metadataType, Gtk::PACK_EXPAND_WIDGET, 0);
|
||||
|
||||
operatorType = Gtk::manage(wf->createComboBoxText());
|
||||
operatorType->append_text("contains");
|
||||
operatorType->append_text("starts with");
|
||||
operatorType->append_text("equals");
|
||||
operatorType->append_text(">=");
|
||||
operatorType->append_text("<=");
|
||||
operatorType->set_active_text("contains");
|
||||
searchOptionsBox->pack_start(*operatorType, Gtk::PACK_EXPAND_WIDGET, 0);
|
||||
|
||||
entryBin = Gtk::manage(wf->createEntryBin());
|
||||
searchOptionsBox->pack_start(*entryBin, Gtk::PACK_EXPAND_WIDGET, 0);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Return the current state of the search fields.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<SearchCriteria>::Ref
|
||||
AdvancedSearchEntry :: getSearchCriteria(void) throw ()
|
||||
{
|
||||
Ptr<SearchCriteria>::Ref criteria(new SearchCriteria("all"));
|
||||
|
||||
std::string key;
|
||||
if (metadataType->get_active_text() == "Title") {
|
||||
key = "dc:title";
|
||||
} else if (metadataType->get_active_text() == "Creator") {
|
||||
key = "dc:creator";
|
||||
} else if (metadataType->get_active_text() == "Length") {
|
||||
key = "dcterms:extent";
|
||||
} else {
|
||||
std::cerr << "unknown metadata type in advanced search entry"
|
||||
<< std::endl
|
||||
<< "(this should never happen)" << std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
std::string comparisonOperator;
|
||||
if (operatorType->get_active_text() == "contains") {
|
||||
comparisonOperator = "partial";
|
||||
} else if (operatorType->get_active_text() == "starts with") {
|
||||
comparisonOperator = "prefix";
|
||||
} else if (operatorType->get_active_text() == "equals") {
|
||||
comparisonOperator = "=";
|
||||
} else if (operatorType->get_active_text() == ">=") {
|
||||
comparisonOperator = ">=";
|
||||
} else if (operatorType->get_active_text() == "<=") {
|
||||
comparisonOperator = "<=";
|
||||
} else {
|
||||
std::cerr << "unknown comparison operator in advanced search entry"
|
||||
<< std::endl
|
||||
<< "(this should never happen)" << std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
std::string value = entryBin->get_text();
|
||||
|
||||
criteria->addCondition(key, comparisonOperator, value);
|
||||
return criteria;
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.3 $
|
||||
Version : $Revision: 1.4 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -39,8 +39,7 @@
|
|||
#include "LiveSupport/Widgets/WidgetFactory.h"
|
||||
#include "LiveSupport/Widgets/Notebook.h"
|
||||
#include "LiveSupport/Widgets/Button.h"
|
||||
#include "LiveSupport/Widgets/ComboBoxText.h"
|
||||
#include "LiveSupport/Widgets/EntryBin.h"
|
||||
#include "LiveSupport/Widgets/AdvancedSearchEntry.h"
|
||||
#include "LiveSupport/Widgets/ZebraTreeView.h"
|
||||
#include "SearchWindow.h"
|
||||
|
||||
|
@ -121,49 +120,24 @@ SearchWindow :: constructAdvancedSearchView(void) throw ()
|
|||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||
|
||||
// the three main components of the window
|
||||
Gtk::Box * searchOptionsBox = Gtk::manage(new Gtk::HBox);
|
||||
advancedSearchOptions = Gtk::manage(new AdvancedSearchEntry(getBundle()));
|
||||
Gtk::Box * searchButtonBox = Gtk::manage(new Gtk::HButtonBox(
|
||||
Gtk::BUTTONBOX_END ));
|
||||
ZebraTreeView * searchResults = Gtk::manage(wf->createTreeView(treeModel));
|
||||
ZebraTreeView * searchResults = Gtk::manage(wf->createTreeView(
|
||||
treeModel ));
|
||||
|
||||
// make a new box, and pack the main components into it
|
||||
Gtk::VBox * view = Gtk::manage(new Gtk::VBox);
|
||||
view->pack_start(*searchOptionsBox, Gtk::PACK_SHRINK, 5);
|
||||
view->pack_start(*advancedSearchOptions, Gtk::PACK_SHRINK, 5);
|
||||
view->pack_start(*searchButtonBox, Gtk::PACK_SHRINK, 5);
|
||||
view->pack_start(*searchResults, Gtk::PACK_SHRINK, 5);
|
||||
|
||||
// set up the search options box
|
||||
try {
|
||||
Gtk::Label * searchByLabel = Gtk::manage(new Gtk::Label(
|
||||
*getResourceUstring("searchByTextLabel") ));
|
||||
searchOptionsBox->pack_start(*searchByLabel, Gtk::PACK_SHRINK, 5);
|
||||
|
||||
} catch (std::invalid_argument &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
ComboBoxText * metadataType = Gtk::manage(wf->createComboBoxText());
|
||||
metadataType->append_text("Title");
|
||||
metadataType->append_text("Creator");
|
||||
metadataType->append_text("Length");
|
||||
metadataType->set_active_text("Title");
|
||||
searchOptionsBox->pack_start(*metadataType, Gtk::PACK_EXPAND_WIDGET, 5);
|
||||
|
||||
ComboBoxText * operatorType = Gtk::manage(wf->createComboBoxText());
|
||||
operatorType->append_text("contains");
|
||||
operatorType->append_text("equals");
|
||||
operatorType->append_text(">=");
|
||||
operatorType->append_text("<");
|
||||
operatorType->set_active_text("contains");
|
||||
searchOptionsBox->pack_start(*operatorType, Gtk::PACK_EXPAND_WIDGET, 5);
|
||||
|
||||
EntryBin * entryBin = Gtk::manage(wf->createEntryBin());
|
||||
searchOptionsBox->pack_start(*entryBin, Gtk::PACK_EXPAND_WIDGET, 5);
|
||||
|
||||
// set up the search button box
|
||||
try {
|
||||
Button * searchButton = Gtk::manage(wf->createButton(
|
||||
*getResourceUstring("searchButtonLabel") ));
|
||||
searchButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&SearchWindow::onSearchButtonClicked));
|
||||
searchButtonBox->pack_start(*searchButton, Gtk::PACK_SHRINK, 5);
|
||||
|
||||
} catch (std::invalid_argument &e) {
|
||||
|
@ -174,3 +148,18 @@ SearchWindow :: constructAdvancedSearchView(void) throw ()
|
|||
return view;
|
||||
}
|
||||
|
||||
|
||||
#include <XmlRpcValue.h>
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Event handler for the Search button getting clicked
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SearchWindow :: onSearchButtonClicked(void) throw ()
|
||||
{
|
||||
XmlRpc::XmlRpcValue xmlRpcValue(*advancedSearchOptions
|
||||
->getSearchCriteria());
|
||||
std::cerr << xmlRpcValue << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.2 $
|
||||
Version : $Revision: 1.3 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -51,6 +51,7 @@
|
|||
#include "LiveSupport/Widgets/WhiteWindow.h"
|
||||
#include "LiveSupport/Widgets/Button.h"
|
||||
#include "LiveSupport/Widgets/ZebraTreeModelColumnRecord.h"
|
||||
#include "LiveSupport/Widgets/AdvancedSearchEntry.h"
|
||||
#include "GLiveSupport.h"
|
||||
|
||||
namespace LiveSupport {
|
||||
|
@ -72,12 +73,17 @@ using namespace LiveSupport::Widgets;
|
|||
* The Search/Browse window.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.2 $
|
||||
* @version $Revision: 1.3 $
|
||||
*/
|
||||
class SearchWindow : public WhiteWindow, public LocalizedObject
|
||||
{
|
||||
private:
|
||||
|
||||
/**
|
||||
* The box containing the advanced search input fields.
|
||||
*/
|
||||
AdvancedSearchEntry * advancedSearchOptions;
|
||||
|
||||
/**
|
||||
* Construct the advanced search view.
|
||||
*
|
||||
|
@ -86,15 +92,18 @@ class SearchWindow : public WhiteWindow, public LocalizedObject
|
|||
Gtk::VBox*
|
||||
constructAdvancedSearchView(void) throw ();
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Event handler for the Search button getting clicked.
|
||||
*/
|
||||
void
|
||||
onSearchButtonClicked(void) throw ();
|
||||
|
||||
/**
|
||||
* The columns model needed by Gtk::TreeView.
|
||||
* Lists one clip per row.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.2 $
|
||||
* @version $Revision: 1.3 $
|
||||
*/
|
||||
class ModelColumns : public ZebraTreeModelColumnRecord
|
||||
{
|
||||
|
@ -137,7 +146,6 @@ class SearchWindow : public WhiteWindow, public LocalizedObject
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The column model.
|
||||
*/
|
||||
|
@ -153,6 +161,7 @@ class SearchWindow : public WhiteWindow, public LocalizedObject
|
|||
*/
|
||||
Ptr<GLiveSupport>::Ref gLiveSupport;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue