From 41fe8530d1c1c83e1db207dae2f0be83e7426ce9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 3 Sep 2004 23:55:25 +0000 Subject: show size of sample cache in stat window show size in sample window git-svn-id: file:///home/lennart/svn/public/paman/trunk@28 cdefa82f-4ce1-0310-97f5-ab6066f37c3c --- src/SampleWindow.cc | 7 ++- src/SampleWindow.hh | 3 +- src/ServerInfoManager.cc | 2 + src/ServerInfoManager.hh | 2 +- src/StatWindow.cc | 8 ++- src/StatWindow.hh | 3 +- src/paman.glade | 142 +++++++++++++++++++++++++++++++++++++++-------- 7 files changed, 139 insertions(+), 28 deletions(-) diff --git a/src/SampleWindow.cc b/src/SampleWindow.cc index b1ea149..5b254f0 100644 --- a/src/SampleWindow.cc +++ b/src/SampleWindow.cc @@ -11,6 +11,7 @@ SampleWindow::SampleWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("volumeLabel", volumeLabel); refGlade->get_widget("sampleTypeLabel", sampleTypeLabel); refGlade->get_widget("durationLabel", durationLabel); + refGlade->get_widget("sizeLabel", sizeLabel); refGlade->get_widget("closeButton", closeButton); closeButton->signal_clicked().connect(sigc::mem_fun(*this, &SampleWindow::onCloseButton)); @@ -32,7 +34,7 @@ SampleWindow* SampleWindow::create() { } void SampleWindow::updateInfo(const SampleInfo &i) { - char t[20], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; + char t[60], ss[PA_SAMPLE_SNPRINT_MAX_LENGTH]; nameLabel->set_text(i.name); snprintf(t, sizeof(t), "#%u", i.index); @@ -46,6 +48,9 @@ void SampleWindow::updateInfo(const SampleInfo &i) { snprintf(t, sizeof(t), "%0.1fs", (double) i.duration/1000000); durationLabel->set_text(t); + + pa_bytes_snprint(t, sizeof(t), i.bytes); + sizeLabel->set_text(t); set_title("Sample: "+i.name); } diff --git a/src/SampleWindow.hh b/src/SampleWindow.hh index 61c8535..a7c99dd 100644 --- a/src/SampleWindow.hh +++ b/src/SampleWindow.hh @@ -17,7 +17,8 @@ public: *indexLabel, *volumeLabel, *sampleTypeLabel, - *durationLabel; + *durationLabel, + *sizeLabel; Gtk::Button *closeButton; diff --git a/src/ServerInfoManager.cc b/src/ServerInfoManager.cc index 55a3f3f..be934f8 100644 --- a/src/ServerInfoManager.cc +++ b/src/ServerInfoManager.cc @@ -249,6 +249,7 @@ SampleInfo::SampleInfo(const struct pa_sample_info &i) : sample_spec(i.sample_spec), volume(i.volume), duration(i.duration), + bytes(i.bytes), window(NULL) { } @@ -263,6 +264,7 @@ void SampleInfo::update(const struct pa_sample_info &i) { sample_spec = i.sample_spec; volume = i.volume; duration = i.duration; + bytes = i.bytes; if (window) window->updateInfo(*this); diff --git a/src/ServerInfoManager.hh b/src/ServerInfoManager.hh index 6762f75..3395de1 100644 --- a/src/ServerInfoManager.hh +++ b/src/ServerInfoManager.hh @@ -154,7 +154,7 @@ public: uint32_t index; Glib::ustring name; struct pa_sample_spec sample_spec; - uint32_t volume, duration; + uint32_t volume, duration, bytes; Gtk::TreeRowReference treeRef; diff --git a/src/StatWindow.cc b/src/StatWindow.cc index 7adb752..6e0c4b8 100644 --- a/src/StatWindow.cc +++ b/src/StatWindow.cc @@ -9,6 +9,7 @@ StatWindow::StatWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("totalSizeLabel", totalSizeLabel); refGlade->get_widget("allocatedLabel", allocatedLabel); refGlade->get_widget("allocatedSizeLabel", allocatedSizeLabel); + refGlade->get_widget("sampleCacheLabel", sampleCacheLabel); refGlade->get_widget("closeButton", closeButton); refGlade->get_widget("refreshButton", refreshButton); @@ -51,12 +53,14 @@ static void stat_cb(struct pa_context *c, const struct pa_stat_info *i, void *us snprintf(t, sizeof(t), "%u", i->memblock_total); s->totalLabel->set_text(t); - snprintf(t, sizeof(t), "%u bytes", i->memblock_total_size); + pa_bytes_snprint(t, sizeof(t), i->memblock_total_size); s->totalSizeLabel->set_text(t); snprintf(t, sizeof(t), "%u", i->memblock_allocated); s->allocatedLabel->set_text(t); - snprintf(t, sizeof(t), "%u bytes", i->memblock_allocated_size); + pa_bytes_snprint(t, sizeof(t), i->memblock_allocated_size); s->allocatedSizeLabel->set_text(t); + pa_bytes_snprint(t, sizeof(t), i->scache_size); + s->sampleCacheLabel->set_text(t); pa_operation_unref(s->operation); s->operation = NULL; diff --git a/src/StatWindow.hh b/src/StatWindow.hh index 092404a..f3461f0 100644 --- a/src/StatWindow.hh +++ b/src/StatWindow.hh @@ -17,7 +17,8 @@ public: Gtk::Label *totalLabel, *totalSizeLabel, *allocatedLabel, - *allocatedSizeLabel; + *allocatedSizeLabel, + *sampleCacheLabel; Gtk::Button *closeButton, *refreshButton; diff --git a/src/paman.glade b/src/paman.glade index f6b2c17..958e6e5 100644 --- a/src/paman.glade +++ b/src/paman.glade @@ -4382,7 +4382,7 @@ True - 4 + 5 2 False 12 @@ -4390,6 +4390,7 @@ + 100 True True @@ -4398,7 +4399,7 @@ GTK_JUSTIFY_LEFT False True - 0 + 1 0.5 0 0 @@ -4423,7 +4424,7 @@ GTK_JUSTIFY_LEFT False True - 0 + 1 0.5 0 0 @@ -4448,7 +4449,7 @@ GTK_JUSTIFY_LEFT False True - 0 + 1 0.5 0 0 @@ -4569,7 +4570,7 @@ GTK_JUSTIFY_LEFT False True - 0 + 1 0.5 0 0 @@ -4583,6 +4584,55 @@ + + + + True + Total Size of Sample Cache: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + True + + False + False + GTK_JUSTIFY_LEFT + False + True + 1 + 0.5 + 0 + 0 + + + 1 + 2 + 4 + 5 + fill + + + 0 @@ -4679,7 +4729,7 @@ 12 True - 5 + 6 2 False 6 @@ -4833,9 +4883,9 @@ - + True - <b>Default Volume:</b> + <b>Index:</b> False True GTK_JUSTIFY_LEFT @@ -4849,17 +4899,42 @@ 0 1 - 4 - 5 + 1 + 2 fill - + True - <b>Index:</b> + True + label4816 + False + False + GTK_JUSTIFY_LEFT + False + True + 0 + 0.5 + 0 + 0 + + + 1 + 2 + 1 + 2 + fill + + + + + + + True + <b>Default Volume:</b> False True GTK_JUSTIFY_LEFT @@ -4873,18 +4948,18 @@ 0 1 - 1 - 2 + 5 + 6 fill - + True True - label4816 + label4813 False False GTK_JUSTIFY_LEFT @@ -4898,23 +4973,46 @@ 1 2 - 1 - 2 + 5 + 6 fill - + True - True - label4813 + <b>Size:</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + label4819 False False GTK_JUSTIFY_LEFT False - True + False 0 0.5 0 -- cgit