[Aptitude-svn-commit] r4141 - in branches/aptitude-0.3/aptitude: .
src
Daniel Burrows
dburrows at costa.debian.org
Tue Sep 20 22:55:56 UTC 2005
Author: dburrows
Date: Tue Sep 20 22:55:53 2005
New Revision: 4141
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/broken_indicator.cc
branches/aptitude-0.3/aptitude/src/solution_screen.cc
Log:
Display the resolver statistics in the solution screen instead of the broken indicator;
use the new slot_event class to set up the broken indicator's timed events.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Tue Sep 20 22:55:53 2005
@@ -1,5 +1,11 @@
2005-09-20 Daniel Burrows <dburrows at debian.org>
+ * src/broken_indicator.cc, src/solution_screen.cc:
+
+ Display the resolver progress in the solution screen instead of
+ in the broken indicator; use the new slot timeout object
+ to set up the broken indicator's timeout.
+
* src/vscreen/vscreen.cc, src/vscreen/vscreen.h:
Add a slot_event that wraps a sigc++ slot in a safe
Modified: branches/aptitude-0.3/aptitude/src/broken_indicator.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/broken_indicator.cc (original)
+++ branches/aptitude-0.3/aptitude/src/broken_indicator.cc Tue Sep 20 22:55:53 2005
@@ -77,24 +77,6 @@
update();
}
- class tick_timeout_event;
- friend class tick_timeout_event;
-
- class tick_timeout_event : public vscreen_event
- {
- ref_ptr<broken_indicator> b;
- public:
- tick_timeout_event(broken_indicator *_b)
- : b(_b)
- {
- }
-
- void dispatch()
- {
- b->tick_timeout();
- }
- };
-
protected:
broken_indicator()
:spin_count(0)
@@ -109,7 +91,7 @@
update();
- vscreen_addtimeout(new tick_timeout_event(this),
+ vscreen_addtimeout(new slot_event(sigc::mem_fun(this, &broken_indicator::tick_timeout)),
aptcfg->FindI(PACKAGE "::Spin-Interval", 500));
}
@@ -144,7 +126,7 @@
vscreen_update();
}
- vscreen_addtimeout(new tick_timeout_event(this),
+ vscreen_addtimeout(new slot_event(sigc::mem_fun(this, &broken_indicator::tick_timeout)),
aptcfg->FindI(PACKAGE "::Spin-Interval", 500));
}
@@ -228,10 +210,9 @@
vector<fragment_column_entry> columns;
- columns.push_back(fragment_column_entry(true, 1, fragment_column_entry::top, flowbox(fragf(_("Resolving dependencies%n%s"),
- ssprintf(_("open: %d; closed: %d; defer: %d; conflict: %d"),
- state.open_size, state.closed_size,
- state.deferred_size, state.conflicts_size).c_str()))));
+ columns.push_back(fragment_column_entry(true, 1, fragment_column_entry::top, flowbox(text_fragment(ssprintf(_("[%d(%d)/...] Resolving dependencies"),
+ state.selected_solution + 1,
+ state.generated_solutions)))));
columns.push_back(fragment_column_entry(false, 1, fragment_column_entry::top, NULL));
Modified: branches/aptitude-0.3/aptitude/src/solution_screen.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/solution_screen.cc (original)
+++ branches/aptitude-0.3/aptitude/src/solution_screen.cc Tue Sep 20 22:55:53 2005
@@ -39,6 +39,7 @@
#include <vscreen/fragment.h>
#include <vscreen/transcode.h>
#include <vscreen/vs_label.h>
+#include <vscreen/vs_layout_item.h>
#include <vscreen/vs_multiplex.h>
#include <vscreen/vs_staticitem.h>
#include <vscreen/vs_subtree.h>
@@ -942,6 +943,20 @@
}
}
+ void tick()
+ {
+ if(resman != NULL && resman->resolver_exists())
+ {
+ resolver_manager::state state = resman->state_snapshot();
+
+ if(state.background_thread_active &&
+ state.selected_solution >= state.generated_solutions)
+ update_from_state(state);
+ }
+
+ vscreen_addtimeout(new slot_event(sigc::mem_fun(this, &solution_examiner::tick)), 1000);
+ }
+
protected:
solution_examiner(const sigc::slot1<void, fragment *> &_set_short_description,
const sigc::slot1<void, aptitude_resolver_dep> &_set_active_dep)
@@ -961,6 +976,8 @@
cycled.connect(sigc::mem_fun(*this, &solution_examiner::update_highlights));
+ vscreen_addtimeout(new slot_event(sigc::mem_fun(this, &solution_examiner::tick)), 1000);
+
update();
}
@@ -996,7 +1013,11 @@
}
resolver_manager::state state = resman->state_snapshot();
+ update_from_state(state);
+ }
+ void update_from_state(const resolver_manager::state &state)
+ {
if(state.solutions_exhausted && state.generated_solutions == 0)
{
set_static_root(transcode(_("No resolution found.")));
@@ -1006,7 +1027,21 @@
if(state.selected_solution >= state.generated_solutions)
{
- set_static_root(transcode(_("Resolving dependencies...")));
+ wstring generation_info = swsprintf(transcode(_("open: %d; closed: %d; defer: %d; conflict: %d")).c_str(),
+ state.open_size, state.closed_size,
+ state.deferred_size, state.conflicts_size);
+
+ wstring msg = transcode(_("Resolving dependencies..."));
+
+ vs_subtree_generic *sol_root = new label_tree(msg);
+ sol_root->add_child(new vs_layout_item(hardwrapbox(text_fragment(generation_info))));
+
+ vs_subtree_generic *story_root = new label_tree(msg);
+ story_root->add_child(new vs_layout_item(hardwrapbox(text_fragment(generation_info))));
+
+ solution_tree->set_root(sol_root, true);
+ story_tree->set_root(story_root, true);
+
last_sol.nullify();
return;
}
More information about the Aptitude-svn-commit
mailing list