[Aptitude-svn-commit] r3710 - in branches/aptitude-0.3/aptitude: .
src src/cmdline
Daniel Burrows
dburrows at costa.debian.org
Fri Aug 5 23:58:53 UTC 2005
Author: dburrows
Date: Fri Aug 5 23:58:49 2005
New Revision: 3710
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc
branches/aptitude-0.3/aptitude/src/desc_parse.cc
branches/aptitude-0.3/aptitude/src/desc_parse.h
branches/aptitude-0.3/aptitude/src/pkg_info_screen.cc
branches/aptitude-0.3/aptitude/src/pkg_view.cc
Log:
Show tags next to descriptions.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Fri Aug 5 23:58:49 2005
@@ -1,5 +1,10 @@
2005-08-05 Daniel Burrows <dburrows at debian.org>
+ * src/cmdline/cmdline_show.cc, src/desc_parse.cc, src/desc_parse.h, src/pkg_info_screen.cc, src/pkg_view.cc:
+
+ Show package tags right after the description everywhere that
+ it's appropriate.
+
* src/load_grouppolicy.cc:
Parse empty policies without crashing.
Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc (original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc Fri Aug 5 23:58:49 2005
@@ -329,6 +329,10 @@
_("Description: "), rec.ShortDesc().c_str()));
fragments.push_back(indentbox(1, 1, make_desc_fragment(transcode(rec.LongDesc()))));
+ fragment *tags = make_tags_fragment(pkg);
+ if(tags)
+ fragments.push_back(fragf("%n%F", tags));
+
return sequence_fragment(fragments);
}
Modified: branches/aptitude-0.3/aptitude/src/desc_parse.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/desc_parse.cc (original)
+++ branches/aptitude-0.3/aptitude/src/desc_parse.cc Fri Aug 5 23:58:49 2005
@@ -1,13 +1,33 @@
// desc_parse.cc
//
-// Copyright 2004 Daniel Burrows
+// Copyright 2004-2005 Daniel Burrows
+//
+// This program 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.
+//
+// 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
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
//
// Parses a description into a fragment.
#include "desc_parse.h"
+
+#include "aptitude.h"
#include "ui.h"
+#include "generic/tags.h"
+
#include <vscreen/fragment.h>
+#include <vscreen/transcode.h>
#include <vscreen/config/colors.h>
using namespace std;
@@ -229,3 +249,28 @@
// Note that the starting amount of indentation is 1...
return make_level_fragment(desc, 0, 1, loc);
}
+
+
+fragment *make_tags_fragment(const pkgCache::PkgIterator &pkg)
+{
+ if(pkg.end())
+ return NULL;
+
+ const set<tag> *s = get_tags(pkg);
+ if(!s->empty())
+ {
+ vector<fragment *> tags;
+
+ for(set<tag>::const_iterator i = s->begin(); i != s->end(); ++i)
+ tags.push_back(text_fragment(i->str(), style_attrs_on(A_BOLD)));
+
+ wstring tagstitle = transcode(_("Tags"));
+
+ return fragf("%ls: %F",
+ tagstitle.c_str(),
+ indentbox(0, wcswidth(tagstitle.c_str(), tagstitle.size())+2,
+ wrapbox(join_fragments(tags, L", "))));
+ }
+ else
+ return NULL;
+}
Modified: branches/aptitude-0.3/aptitude/src/desc_parse.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/desc_parse.h (original)
+++ branches/aptitude-0.3/aptitude/src/desc_parse.h Fri Aug 5 23:58:49 2005
@@ -1,12 +1,29 @@
-// desc_parse.h
+// desc_parse.h -*-c++-*-
//
-// Copyright 2004 Daniel Burrows
+// Copyright 2004-2005 Daniel Burrows
+//
+// This program 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.
+//
+// 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
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
#ifndef DESC_PARSE_H
#define DESC_PARSE_H
#include <string>
+#include <apt-pkg/pkgcache.h>
+
class fragment;
/** Parses the given description string according to the standard
@@ -17,4 +34,9 @@
*/
fragment *make_desc_fragment(const std::wstring &desc);
+/** \return a fragment listing the tags of the given package, or \b
+ * NULL if there are no tags.
+ */
+fragment *make_tags_fragment(const pkgCache::PkgIterator &pkg);
+
#endif
Modified: branches/aptitude-0.3/aptitude/src/pkg_info_screen.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/pkg_info_screen.cc (original)
+++ branches/aptitude-0.3/aptitude/src/pkg_info_screen.cc Fri Aug 5 23:58:49 2005
@@ -97,6 +97,10 @@
_("Description: "), shortdesc.c_str())));
frags.push_back(indentbox(2, 2, make_desc_fragment(transcode(desc))));
+ fragment *tags = make_tags_fragment(pkg);
+ if(tags != NULL)
+ frags.push_back(fragf("%n%F", tags));
+
// Can I use something other than a clipbox below?
if((pkg->Flags&pkgCache::Flag::Essential)==pkgCache::Flag::Essential ||
Modified: branches/aptitude-0.3/aptitude/src/pkg_view.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/pkg_view.cc (original)
+++ branches/aptitude-0.3/aptitude/src/pkg_view.cc Fri Aug 5 23:58:49 2005
@@ -163,6 +163,12 @@
fragment *frag=make_desc_fragment(newdesc);
+ fragment *tags=make_tags_fragment(pkg);
+ if(tags != NULL)
+ tags = fragf("%n%n%F", tags);
+ else
+ tags = fragf("");
+
fragment *untrusted_frag;
if(pkg.end() || ver.end())
@@ -171,9 +177,9 @@
untrusted_frag=make_untrusted_warning(ver);
if(untrusted_frag == NULL)
- set_fragment(frag);
+ set_fragment(fragf("%F%F", frag, tags));
else
- set_fragment(fragf("%F%n%F", untrusted_frag, frag));
+ set_fragment(fragf("%F%n%F%F", untrusted_frag, frag, tags));
}
};
More information about the Aptitude-svn-commit
mailing list