[SCM] Development fot GoFind! branch, master, updated. 74d3c6f29567ae73a5cd0465537c592ef3a8460e

Miriam Ruiz miriam at debian.org
Sun Nov 23 11:33:43 UTC 2008


The following commit has been merged in the master branch:
commit 74d3c6f29567ae73a5cd0465537c592ef3a8460e
Author: Miriam Ruiz <miriam at debian.org>
Date:   Sun Nov 23 12:36:14 2008 +0100

    FLTK plugin is fully functional now

diff --git a/fltk/pkgbrowser.cpp b/fltk/pkgbrowser.cpp
index c7aa245..9989a1c 100644
--- a/fltk/pkgbrowser.cpp
+++ b/fltk/pkgbrowser.cpp
@@ -32,6 +32,7 @@
 #include "ui.h"
 #include "aux.h"
 #include "../common.h"
+#include "../pkgdata.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -66,8 +67,6 @@ using namespace ept;
 using namespace ept::debtags;
 using namespace ept::apt;
 
-static const char legalchars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz at _?+-,.~/%&=:*#";
-
 PackageBrowser::PackageBrowser(int x, int y, int w, int h, const char *l)
 	: VersatileBrowser(x, y, w, h, l), num_bar_images(2)
 {
@@ -93,6 +92,8 @@ PackageBrowser::~PackageBrowser()
 	}
 }
 
+static const char legalchars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz at _?+-,.~/%&=:*#";
+
 static void text2html(const std::string &in_text, std::string &out_html)
 {
 	const char *text = in_text.c_str();
@@ -205,43 +206,28 @@ void PackageBrowser::item_select(void *p, int s)
 
 			Fl_Group *highest_parent=parent();
 			while (highest_parent->parent()) highest_parent = highest_parent->parent();
-			GamesUI *ui = highest_parent ? (GamesUI*)(highest_parent->user_data()) : NULL;
-			if (ui && img) ui->Screenshot(img);
-
-			const char *pkgname = "package";
-			const char *pkgshort = "package short description";
-			const char *pkglong ="Lorem ipsum dolor sit amet, "
-				"consectetur adipiscing elit, sed eiusmod tempor incidunt ut labore "
-				"et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud "
-				"exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. "
-				"Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu "
-				"fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, "
-				"sunt in culpa qui officia deserunt mollit anim id est laborum.";
+
+			GamesUI *p_ui = highest_parent ? (GamesUI*)(highest_parent->user_data()) : NULL;
+			GamesUI &ui = *static_cast<GamesUI*>(p_ui);
+			PackageData &pkgdata = *(PackageData *)(ui.user_data);
+			PackageRecord rec(pkgdata.apt().rawRecord((const char *)data));
+
+			if (img) ui.Screenshot(img);
 
 			std::string pkg_desc;
-			if (ui)
-			{
-				pkg_desc = std::string ("<center><h1><a href=\"pkg:")
-					+ pkgname + "\">" + pkgname + "</a></h1></center><br />";
-				pkg_desc += std::string("<center>") + pkgshort + "</center><hr /><p>";
-				text2html(pkglong, pkg_desc);
-				ui->InfoView->value(pkg_desc.c_str());
-			}
+
+			pkg_desc = std::string ("<center><h1><a href=\"pkg:") + rec.package() + "\">" + rec.package() +
+				"</a></h1></center><br />";
+			pkg_desc += std::string("<center>") + rec.shortDescription() + "</center><hr /><p>";
+			text2html(rec.longDescription(), pkg_desc);
+			ui.InfoView->value(pkg_desc.c_str());
 
 			static int widths[] = { 150, 0 }; // widths for each column
-			ui->DebTagsBrowser->clear();
-			ui->DebTagsBrowser->showcolsep(1);
-			ui->DebTagsBrowser->column_widths(widths);
-			ui->DebTagsBrowser->add(_("@B12 at C7@b at .FACET\t at B12@C7 at b@.TAG"));
-/*
-			const char taglist[][32] = {
-				"example::tag1" ,
-				"example::tag2" ,
-				"example::tag3" ,
-				"example::tag4" ,
-				"example::tag5"
-			};
-*/
+			ui.DebTagsBrowser->clear();
+			ui.DebTagsBrowser->showcolsep(1);
+			ui.DebTagsBrowser->column_widths(widths);
+			ui.DebTagsBrowser->add(_("@B12 at C7@b at .FACET\t at B12@C7 at b@.TAG"));
+
 			ept::debtags::Debtags debtags;
 
 			set<ept::debtags::Tag> tags = debtags.getTagsOfItem("libc6");
@@ -275,7 +261,7 @@ void PackageBrowser::item_select(void *p, int s)
 					bk, fr,
 					gettext(i->shortDescription().c_str())
 				);
-				ui->DebTagsBrowser->add(tag_txt);
+				ui.DebTagsBrowser->add(tag_txt);
 			}
 			delete [] tag_txt;
 		}
diff --git a/gui_fltk.cpp b/gui_fltk.cpp
index 8c45421..fa57b56 100644
--- a/gui_fltk.cpp
+++ b/gui_fltk.cpp
@@ -196,6 +196,9 @@ static void CallBackTypeSelection(Fl_Choice* choice, void *data)
 	//printf("CallBackTypeSelection\n");
 	//fflush(stdout);
 	GamesUI& ui = *static_cast<GamesUI*>(data);
+	PackageData &pkgdata = *(PackageData *)(ui.user_data);
+	PackageData::Tag tag = pkgdata.voc().tagByName(ReadFlChoice(*choice));
+	pkgdata.setTypeFilter(tag);
 	UpdateUILists(ui);
 }
 
@@ -204,6 +207,9 @@ static void CallBackInterfaceSelection(Fl_Choice* choice, void *data)
 	//printf("CallBackInterfaceSelection\n");
 	//fflush(stdout);
 	GamesUI& ui = *static_cast<GamesUI*>(data);
+	PackageData &pkgdata = *(PackageData *)(ui.user_data);
+	PackageData::Tag tag = pkgdata.voc().tagByName(ReadFlChoice(*choice));
+	pkgdata.setInterfaceFilter(tag);
 	UpdateUILists(ui);
 }
 
@@ -211,6 +217,8 @@ static void CallBackSearchInput(Fl_Input* input, void *data)
 {
 	//printf("CallBackSearchInput\n"); fflush(stdout);
 	GamesUI& ui = *static_cast<GamesUI*>(data);
+	PackageData &pkgdata = *(PackageData *)(ui.user_data);
+	pkgdata.setKeywordFilter(input->value());
 	UpdateUILists(ui);
 }
 
@@ -218,10 +226,11 @@ static void CallBackAlreadyInstalled(Fl_Round_Button*, void *data)
 {
 	//printf("CallBackInstalled\n"); fflush(stdout);
 	GamesUI& ui = *static_cast<GamesUI*>(data);
+	PackageData &pkgdata = *(PackageData *)(ui.user_data);
 	ui.AlreadyInstalled->value(1); ui.AlreadyInstalled->redraw();
 	ui.ToBeInstalled->value(0); ui.ToBeInstalled->redraw();
 	ui.InstalledOrNot->value(0); ui.InstalledOrNot->redraw();
-//	ui.engine->setInstalledFilter(Engine::INSTALLED);
+	pkgdata.setInstalledFilter(Engine::INSTALLED);
 	UpdateUILists(ui);
 }
 
@@ -229,10 +238,11 @@ static void CallBackToBeInstalled(Fl_Round_Button*, void *data)
 {
 	//printf("CallBackToBeInstalled\n"); fflush(stdout);
 	GamesUI& ui = *static_cast<GamesUI*>(data);
+	PackageData &pkgdata = *(PackageData *)(ui.user_data);
 	ui.AlreadyInstalled->value(0); ui.AlreadyInstalled->redraw();
 	ui.ToBeInstalled->value(1); ui.ToBeInstalled->redraw();
 	ui.InstalledOrNot->value(0); ui.InstalledOrNot->redraw();
-//	ui.engine->setInstalledFilter(Engine::NOTINSTALLED);
+	pkgdata.setInstalledFilter(Engine::NOTINSTALLED);
 	UpdateUILists(ui);
 }
 
@@ -240,10 +250,11 @@ static void CallBackInstalledOrNot(Fl_Round_Button*, void *data)
 {
 	//printf("CallBackToBeInstalled\n"); fflush(stdout);
 	GamesUI& ui = *static_cast<GamesUI*>(data);
+	PackageData &pkgdata = *(PackageData *)(ui.user_data);
 	ui.AlreadyInstalled->value(0); ui.AlreadyInstalled->redraw();
 	ui.ToBeInstalled->value(0); ui.ToBeInstalled->redraw();
 	ui.InstalledOrNot->value(1); ui.InstalledOrNot->redraw();
-//	ui.engine->setInstalledFilter(Engine::ANY);
+	pkgdata.setInstalledFilter(Engine::ANY);
 	UpdateUILists(ui);
 }
 
diff --git a/pkgdata.h b/pkgdata.h
index 1f5d4ba..68e469b 100644
--- a/pkgdata.h
+++ b/pkgdata.h
@@ -26,6 +26,7 @@
 #include "filter.h"
 
 #include <ept/debtags/tag.h>
+#include <string>
 
 using namespace ept;
 

-- 
Development fot GoFind!



More information about the Pkg-games-commits mailing list