in the Qt and GTK+ clients, move the torrent count indicator from the statusbar to the filterbar
This commit is contained in:
parent
70289d9629
commit
16d46a72a1
51
gtk/filter.c
51
gtk/filter.c
|
@ -791,6 +791,7 @@ struct filter_data
|
||||||
GtkWidget * activity;
|
GtkWidget * activity;
|
||||||
GtkWidget * tracker;
|
GtkWidget * tracker;
|
||||||
GtkWidget * entry;
|
GtkWidget * entry;
|
||||||
|
GtkWidget * show_lb;
|
||||||
GtkTreeModel * filter_model;
|
GtkTreeModel * filter_model;
|
||||||
int active_activity_type;
|
int active_activity_type;
|
||||||
int active_tracker_type;
|
int active_tracker_type;
|
||||||
|
@ -854,6 +855,47 @@ selection_changed_cb (GtkComboBox * combo, gpointer vdata)
|
||||||
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (data->filter_model));
|
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (data->filter_model));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
****
|
||||||
|
***/
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_count_label (struct filter_data * data)
|
||||||
|
{
|
||||||
|
char buf[512];
|
||||||
|
GtkTreeModel * tmodel = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (data->filter_model));
|
||||||
|
const int torrentCount = gtk_tree_model_iter_n_children (tmodel, NULL);
|
||||||
|
const int visibleCount = gtk_tree_model_iter_n_children (data->filter_model, NULL);
|
||||||
|
|
||||||
|
/* set the text */
|
||||||
|
if (visibleCount == torrentCount)
|
||||||
|
g_snprintf (buf, sizeof(buf), _("_Show:"));
|
||||||
|
else
|
||||||
|
g_snprintf (buf, sizeof(buf), _("_Show %'d:"), visibleCount);
|
||||||
|
gtk_label_set_markup_with_mnemonic (GTK_LABEL (data->show_lb), buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_filter_model_row_inserted (GtkTreeModel * tree_model UNUSED,
|
||||||
|
GtkTreePath * path UNUSED,
|
||||||
|
GtkTreeIter * iter UNUSED,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
update_count_label (data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_filter_model_row_deleted (GtkTreeModel * tree_model UNUSED,
|
||||||
|
GtkTreePath * path UNUSED,
|
||||||
|
gpointer data UNUSED)
|
||||||
|
{
|
||||||
|
update_count_label (data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
****
|
||||||
|
***/
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gtr_filter_bar_new (tr_session * session, GtkTreeModel * tmodel, GtkTreeModel ** filter_model)
|
gtr_filter_bar_new (tr_session * session, GtkTreeModel * tmodel, GtkTreeModel ** filter_model)
|
||||||
{
|
{
|
||||||
|
@ -864,7 +906,6 @@ gtr_filter_bar_new (tr_session * session, GtkTreeModel * tmodel, GtkTreeModel **
|
||||||
GtkWidget * activity;
|
GtkWidget * activity;
|
||||||
GtkWidget * tracker;
|
GtkWidget * tracker;
|
||||||
GtkBox * h_box;
|
GtkBox * h_box;
|
||||||
const char * str;
|
|
||||||
struct filter_data * data;
|
struct filter_data * data;
|
||||||
|
|
||||||
g_assert (DIRTY_KEY == 0);
|
g_assert (DIRTY_KEY == 0);
|
||||||
|
@ -874,9 +915,12 @@ gtr_filter_bar_new (tr_session * session, GtkTreeModel * tmodel, GtkTreeModel **
|
||||||
TORRENT_MODEL_KEY = g_quark_from_static_string ("tr-filter-torrent-model-key");
|
TORRENT_MODEL_KEY = g_quark_from_static_string ("tr-filter-torrent-model-key");
|
||||||
|
|
||||||
data = g_new0 (struct filter_data, 1);
|
data = g_new0 (struct filter_data, 1);
|
||||||
|
data->show_lb = gtk_label_new (NULL);
|
||||||
data->activity = activity = activity_combo_box_new (tmodel);
|
data->activity = activity = activity_combo_box_new (tmodel);
|
||||||
data->tracker = tracker = tracker_combo_box_new (tmodel);
|
data->tracker = tracker = tracker_combo_box_new (tmodel);
|
||||||
data->filter_model = gtk_tree_model_filter_new (tmodel, NULL);
|
data->filter_model = gtk_tree_model_filter_new (tmodel, NULL);
|
||||||
|
g_signal_connect (data->filter_model, "row-deleted", G_CALLBACK(on_filter_model_row_deleted), data);
|
||||||
|
g_signal_connect (data->filter_model, "row-inserted", G_CALLBACK(on_filter_model_row_inserted), data);
|
||||||
|
|
||||||
g_object_set (G_OBJECT (data->tracker), "width-request", 170, NULL);
|
g_object_set (G_OBJECT (data->tracker), "width-request", 170, NULL);
|
||||||
g_object_set_qdata (G_OBJECT (gtk_combo_box_get_model (GTK_COMBO_BOX (data->tracker))), SESSION_KEY, session);
|
g_object_set_qdata (G_OBJECT (gtk_combo_box_get_model (GTK_COMBO_BOX (data->tracker))), SESSION_KEY, session);
|
||||||
|
@ -892,10 +936,8 @@ gtr_filter_bar_new (tr_session * session, GtkTreeModel * tmodel, GtkTreeModel **
|
||||||
h_box = GTK_BOX (h);
|
h_box = GTK_BOX (h);
|
||||||
|
|
||||||
/* add the activity combobox */
|
/* add the activity combobox */
|
||||||
str = _("_Show:");
|
|
||||||
w = activity;
|
w = activity;
|
||||||
l = gtk_label_new (NULL);
|
l = data->show_lb;
|
||||||
gtk_label_set_markup_with_mnemonic (GTK_LABEL (l), str);
|
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (l), w);
|
gtk_label_set_mnemonic_widget (GTK_LABEL (l), w);
|
||||||
gtk_box_pack_start (h_box, l, FALSE, FALSE, 0);
|
gtk_box_pack_start (h_box, l, FALSE, FALSE, 0);
|
||||||
gtk_box_pack_start (h_box, w, TRUE, TRUE, 0);
|
gtk_box_pack_start (h_box, w, TRUE, TRUE, 0);
|
||||||
|
@ -924,5 +966,6 @@ gtr_filter_bar_new (tr_session * session, GtkTreeModel * tmodel, GtkTreeModel **
|
||||||
selection_changed_cb (NULL, data);
|
selection_changed_cb (NULL, data);
|
||||||
|
|
||||||
*filter_model = data->filter_model;
|
*filter_model = data->filter_model;
|
||||||
|
update_count_label (data);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ typedef struct
|
||||||
GtkLabel * stats_lb;
|
GtkLabel * stats_lb;
|
||||||
GtkLabel * freespace_lb;
|
GtkLabel * freespace_lb;
|
||||||
GtkWidget * freespace_icon;
|
GtkWidget * freespace_icon;
|
||||||
GtkLabel * count_lb;
|
|
||||||
GtkWidget * alt_speed_image;
|
GtkWidget * alt_speed_image;
|
||||||
GtkWidget * alt_speed_button;
|
GtkWidget * alt_speed_button;
|
||||||
GtkWidget * options_menu;
|
GtkWidget * options_menu;
|
||||||
|
@ -716,25 +715,18 @@ gtr_window_new (GtkApplication * app, GtkUIManager * ui_mgr, TrCore * core)
|
||||||
gtk_grid_attach_next_to (grid, w, sibling, GTK_POS_RIGHT, 1, 1);
|
gtk_grid_attach_next_to (grid, w, sibling, GTK_POS_RIGHT, 1, 1);
|
||||||
sibling = w;
|
sibling = w;
|
||||||
|
|
||||||
/* torrent count */
|
/* freespace */
|
||||||
w = gtk_label_new ("N Torrents");
|
w = gtk_image_new_from_stock (GTK_STOCK_HARDDISK, GTK_ICON_SIZE_MENU);
|
||||||
p->count_lb = GTK_LABEL (w);
|
p->freespace_icon = w;
|
||||||
gtk_label_set_single_line_mode (p->count_lb, TRUE);
|
g_object_set (G_OBJECT(w), "margin-left", GUI_PAD, NULL);
|
||||||
gtk_grid_attach_next_to (grid, w, sibling, GTK_POS_RIGHT, 1, 1);
|
gtk_grid_attach_next_to (grid, w, sibling, GTK_POS_RIGHT, 1, 1);
|
||||||
sibling = w;
|
sibling = w;
|
||||||
|
|
||||||
/* freespace */
|
|
||||||
w = gtk_label_new (NULL);
|
w = gtk_label_new (NULL);
|
||||||
g_object_set (G_OBJECT(w), "margin-left", GUI_PAD_BIG*2, NULL);
|
g_object_set (G_OBJECT(w), "margin-left", GUI_PAD_BIG*2, NULL);
|
||||||
p->freespace_lb = GTK_LABEL (w);
|
p->freespace_lb = GTK_LABEL (w);
|
||||||
gtk_label_set_single_line_mode (p->freespace_lb, TRUE);
|
gtk_label_set_single_line_mode (p->freespace_lb, TRUE);
|
||||||
gtk_grid_attach_next_to (grid, w, sibling, GTK_POS_RIGHT, 1, 1);
|
gtk_grid_attach_next_to (grid, w, sibling, GTK_POS_RIGHT, 1, 1);
|
||||||
sibling = w;
|
sibling = w;
|
||||||
w = gtk_image_new_from_stock (GTK_STOCK_HARDDISK, GTK_ICON_SIZE_MENU);
|
|
||||||
p->freespace_icon = w;
|
|
||||||
g_object_set (G_OBJECT(w), "margin-left", GUI_PAD, NULL);
|
|
||||||
gtk_grid_attach_next_to (grid, w, sibling, GTK_POS_RIGHT, 1, 1);
|
|
||||||
sibling = w;
|
|
||||||
|
|
||||||
/* spacer */
|
/* spacer */
|
||||||
w = gtk_alignment_new (0.0f, 0.0f, 0.0f, 0.0f);
|
w = gtk_alignment_new (0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
@ -829,42 +821,6 @@ gtr_window_new (GtkApplication * app, GtkUIManager * ui_mgr, TrCore * core)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
updateTorrentCount (PrivateData * p)
|
|
||||||
{
|
|
||||||
bool visible = false;
|
|
||||||
|
|
||||||
g_return_if_fail (p != NULL);
|
|
||||||
|
|
||||||
if (p->core != NULL)
|
|
||||||
{
|
|
||||||
const int torrentCount = gtk_tree_model_iter_n_children (gtr_core_model (p->core), NULL);
|
|
||||||
const int visibleCount = gtk_tree_model_iter_n_children (p->filter_model, NULL);
|
|
||||||
|
|
||||||
visible = torrentCount > 0;
|
|
||||||
|
|
||||||
if (visible)
|
|
||||||
{
|
|
||||||
char countStr[512];
|
|
||||||
|
|
||||||
if (torrentCount != visibleCount)
|
|
||||||
g_snprintf (countStr, sizeof (countStr),
|
|
||||||
ngettext ("%1$'d of %2$'d Torrent",
|
|
||||||
"%1$'d of %2$'d Torrents",
|
|
||||||
torrentCount),
|
|
||||||
visibleCount, torrentCount);
|
|
||||||
else
|
|
||||||
g_snprintf (countStr, sizeof (countStr),
|
|
||||||
ngettext ("%'d Torrent", "%'d Torrents", torrentCount),
|
|
||||||
torrentCount);
|
|
||||||
|
|
||||||
gtr_label_set_text (p->count_lb, countStr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_set_visible (GTK_WIDGET(p->count_lb), visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
updateFreeSpace (PrivateData * p)
|
updateFreeSpace (PrivateData * p)
|
||||||
{
|
{
|
||||||
|
@ -887,8 +843,10 @@ updateFreeSpace (PrivateData * p)
|
||||||
{
|
{
|
||||||
char * tip;
|
char * tip;
|
||||||
char sizeStr[32];
|
char sizeStr[32];
|
||||||
|
|
||||||
tr_strlsize (sizeStr, n, sizeof(sizeStr));
|
tr_strlsize (sizeStr, n, sizeof(sizeStr));
|
||||||
gtk_label_set_text (p->freespace_lb, sizeStr);
|
gtk_label_set_text (p->freespace_lb, sizeStr);
|
||||||
|
|
||||||
tip = tr_strdup_printf (_("Download folder \"%1$s\" has %2$s free"), downloadDir, sizeStr);
|
tip = tr_strdup_printf (_("Download folder \"%1$s\" has %2$s free"), downloadDir, sizeStr);
|
||||||
gtk_widget_set_tooltip_text (w, tip);
|
gtk_widget_set_tooltip_text (w, tip);
|
||||||
g_free (tip);
|
g_free (tip);
|
||||||
|
@ -989,7 +947,6 @@ gtr_window_refresh (GtkWindow * self)
|
||||||
if (p && p->core && gtr_core_session (p->core))
|
if (p && p->core && gtr_core_session (p->core))
|
||||||
{
|
{
|
||||||
updateSpeeds (p);
|
updateSpeeds (p);
|
||||||
updateTorrentCount (p);
|
|
||||||
updateStats (p);
|
updateStats (p);
|
||||||
updateFreeSpace (p);
|
updateFreeSpace (p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,9 +406,10 @@ FilterBar :: FilterBar (Prefs& prefs, TorrentModel& torrents, TorrentFilter& fil
|
||||||
QHBoxLayout * h = new QHBoxLayout (this);
|
QHBoxLayout * h = new QHBoxLayout (this);
|
||||||
const int hmargin = qMax (int (HIG::PAD), style ()->pixelMetric (QStyle::PM_LayoutHorizontalSpacing));
|
const int hmargin = qMax (int (HIG::PAD), style ()->pixelMetric (QStyle::PM_LayoutHorizontalSpacing));
|
||||||
|
|
||||||
|
myCountLabel = new QLabel;
|
||||||
h->setSpacing (0);
|
h->setSpacing (0);
|
||||||
h->setContentsMargins (2, 2, 2, 2);
|
h->setContentsMargins (2, 2, 2, 2);
|
||||||
h->addWidget (new QLabel (tr ("Show:"), this));
|
h->addWidget (myCountLabel);
|
||||||
h->addSpacing (hmargin);
|
h->addSpacing (hmargin);
|
||||||
|
|
||||||
myActivityCombo = createActivityCombo ();
|
myActivityCombo = createActivityCombo ();
|
||||||
|
@ -437,6 +438,8 @@ FilterBar :: FilterBar (Prefs& prefs, TorrentModel& torrents, TorrentFilter& fil
|
||||||
connect (&myPrefs, SIGNAL (changed (int)), this, SLOT (refreshPref (int)));
|
connect (&myPrefs, SIGNAL (changed (int)), this, SLOT (refreshPref (int)));
|
||||||
connect (myActivityCombo, SIGNAL (currentIndexChanged (int)), this, SLOT (onActivityIndexChanged (int)));
|
connect (myActivityCombo, SIGNAL (currentIndexChanged (int)), this, SLOT (onActivityIndexChanged (int)));
|
||||||
connect (myTrackerCombo, SIGNAL (currentIndexChanged (int)), this, SLOT (onTrackerIndexChanged (int)));
|
connect (myTrackerCombo, SIGNAL (currentIndexChanged (int)), this, SLOT (onTrackerIndexChanged (int)));
|
||||||
|
connect (&myFilter, SIGNAL (rowsInserted (const QModelIndex&,int,int)), this, SLOT (refreshCountLabel ()));
|
||||||
|
connect (&myFilter, SIGNAL (rowsRemoved (const QModelIndex&,int,int)), this, SLOT (refreshCountLabel ()));
|
||||||
connect (&myTorrents, SIGNAL (modelReset ()), this, SLOT (onTorrentModelReset ()));
|
connect (&myTorrents, SIGNAL (modelReset ()), this, SLOT (onTorrentModelReset ()));
|
||||||
connect (&myTorrents, SIGNAL (rowsInserted (const QModelIndex&,int,int)), this, SLOT (onTorrentModelRowsInserted (const QModelIndex&,int,int)));
|
connect (&myTorrents, SIGNAL (rowsInserted (const QModelIndex&,int,int)), this, SLOT (onTorrentModelRowsInserted (const QModelIndex&,int,int)));
|
||||||
connect (&myTorrents, SIGNAL (rowsRemoved (const QModelIndex&,int,int)), this, SLOT (onTorrentModelRowsRemoved (const QModelIndex&,int,int)));
|
connect (&myTorrents, SIGNAL (rowsRemoved (const QModelIndex&,int,int)), this, SLOT (onTorrentModelRowsRemoved (const QModelIndex&,int,int)));
|
||||||
|
@ -445,6 +448,7 @@ FilterBar :: FilterBar (Prefs& prefs, TorrentModel& torrents, TorrentFilter& fil
|
||||||
|
|
||||||
recountSoon ();
|
recountSoon ();
|
||||||
refreshTrackers ();
|
refreshTrackers ();
|
||||||
|
refreshCountLabel ();
|
||||||
myIsBootstrapping = false;
|
myIsBootstrapping = false;
|
||||||
|
|
||||||
// initialize our state
|
// initialize our state
|
||||||
|
@ -578,3 +582,15 @@ FilterBar :: getCountString (int n) const
|
||||||
{
|
{
|
||||||
return QString ("%L1").arg (n);
|
return QString ("%L1").arg (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FilterBar :: refreshCountLabel ()
|
||||||
|
{
|
||||||
|
const int visibleCount = myFilter.rowCount ();
|
||||||
|
const int torrentCount = visibleCount + myFilter.hiddenRowCount ();
|
||||||
|
|
||||||
|
if (visibleCount == torrentCount)
|
||||||
|
myCountLabel->setText (tr("Show:"));
|
||||||
|
else
|
||||||
|
myCountLabel->setText (tr("Show %Ln:", 0, visibleCount));
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <QItemDelegate>
|
#include <QItemDelegate>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QPaintEvent;
|
class QPaintEvent;
|
||||||
class QStandardItemModel;
|
class QStandardItemModel;
|
||||||
|
@ -79,6 +80,7 @@ class FilterBar: public QWidget
|
||||||
TorrentFilter& myFilter;
|
TorrentFilter& myFilter;
|
||||||
QComboBox * myActivityCombo;
|
QComboBox * myActivityCombo;
|
||||||
QComboBox * myTrackerCombo;
|
QComboBox * myTrackerCombo;
|
||||||
|
QLabel * myCountLabel;
|
||||||
QStandardItemModel * myTrackerModel;
|
QStandardItemModel * myTrackerModel;
|
||||||
QTimer * myRecountTimer;
|
QTimer * myRecountTimer;
|
||||||
bool myIsBootstrapping;
|
bool myIsBootstrapping;
|
||||||
|
@ -87,6 +89,7 @@ class FilterBar: public QWidget
|
||||||
private slots:
|
private slots:
|
||||||
void recount ();
|
void recount ();
|
||||||
void refreshPref (int key);
|
void refreshPref (int key);
|
||||||
|
void refreshCountLabel ();
|
||||||
void onActivityIndexChanged (int index);
|
void onActivityIndexChanged (int index);
|
||||||
void onTrackerIndexChanged (int index);
|
void onTrackerIndexChanged (int index);
|
||||||
void onTorrentModelReset ();
|
void onTorrentModelReset ();
|
||||||
|
|
|
@ -202,8 +202,6 @@ TrMainWindow :: TrMainWindow (Session& session, Prefs& prefs, TorrentModel& mode
|
||||||
connect (ui.action_SelectAll, SIGNAL (triggered ()), ui.listView, SLOT (selectAll ()));
|
connect (ui.action_SelectAll, SIGNAL (triggered ()), ui.listView, SLOT (selectAll ()));
|
||||||
connect (ui.action_DeselectAll, SIGNAL (triggered ()), ui.listView, SLOT (clearSelection ()));
|
connect (ui.action_DeselectAll, SIGNAL (triggered ()), ui.listView, SLOT (clearSelection ()));
|
||||||
|
|
||||||
connect (&myFilterModel, SIGNAL (rowsInserted (const QModelIndex&,int,int)), this, SLOT (refreshVisibleCount ()));
|
|
||||||
connect (&myFilterModel, SIGNAL (rowsRemoved (const QModelIndex&,int,int)), this, SLOT (refreshVisibleCount ()));
|
|
||||||
connect (&myFilterModel, SIGNAL (rowsInserted (const QModelIndex&,int,int)), this, SLOT (refreshActionSensitivitySoon ()));
|
connect (&myFilterModel, SIGNAL (rowsInserted (const QModelIndex&,int,int)), this, SLOT (refreshActionSensitivitySoon ()));
|
||||||
connect (&myFilterModel, SIGNAL (rowsRemoved (const QModelIndex&,int,int)), this, SLOT (refreshActionSensitivitySoon ()));
|
connect (&myFilterModel, SIGNAL (rowsRemoved (const QModelIndex&,int,int)), this, SLOT (refreshActionSensitivitySoon ()));
|
||||||
|
|
||||||
|
@ -307,7 +305,6 @@ TrMainWindow :: TrMainWindow (Session& session, Prefs& prefs, TorrentModel& mode
|
||||||
refreshStatusBar ();
|
refreshStatusBar ();
|
||||||
refreshFreeSpace ();
|
refreshFreeSpace ();
|
||||||
refreshTitle ();
|
refreshTitle ();
|
||||||
refreshVisibleCount ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TrMainWindow :: ~TrMainWindow ()
|
TrMainWindow :: ~TrMainWindow ()
|
||||||
|
@ -328,7 +325,6 @@ void
|
||||||
TrMainWindow :: onModelReset ()
|
TrMainWindow :: onModelReset ()
|
||||||
{
|
{
|
||||||
refreshTitle ();
|
refreshTitle ();
|
||||||
refreshVisibleCount ();
|
|
||||||
refreshActionSensitivitySoon ();
|
refreshActionSensitivitySoon ();
|
||||||
refreshStatusBar ();
|
refreshStatusBar ();
|
||||||
refreshTrayIconSoon ();
|
refreshTrayIconSoon ();
|
||||||
|
@ -395,18 +391,13 @@ TrMainWindow :: createStatusBar ()
|
||||||
|
|
||||||
h->addStretch (1);
|
h->addStretch (1);
|
||||||
|
|
||||||
l = myVisibleCountLabel = new QLabel (this);
|
l = myFreeSpaceIconLabel = new QLabel (this);
|
||||||
|
l->setPixmap (getStockIcon ("drive-harddisk", QStyle::SP_DriveHDIcon).pixmap (smallIconSize));
|
||||||
h->addWidget (l);
|
h->addWidget (l);
|
||||||
|
|
||||||
h->addSpacing (HIG::PAD_BIG);
|
|
||||||
|
|
||||||
l = myFreeSpaceTextLabel = new QLabel (this);
|
l = myFreeSpaceTextLabel = new QLabel (this);
|
||||||
const int minimumFreeSpaceWidth = l->fontMetrics ().width (Formatter::sizeToString (1024 * 1024));
|
const int minimumFreeSpaceWidth = l->fontMetrics ().width (Formatter::sizeToString (1024 * 1024));
|
||||||
l->setMinimumWidth (minimumFreeSpaceWidth);
|
l->setMinimumWidth (minimumFreeSpaceWidth);
|
||||||
h->addWidget (l);
|
h->addWidget (l);
|
||||||
l = myFreeSpaceIconLabel = new QLabel (this);
|
|
||||||
l->setPixmap (getStockIcon ("drive-harddisk", QStyle::SP_DriveHDIcon).pixmap (smallIconSize));
|
|
||||||
h->addWidget (l);
|
|
||||||
|
|
||||||
h->addStretch (1);
|
h->addStretch (1);
|
||||||
|
|
||||||
|
@ -727,20 +718,6 @@ TrMainWindow :: refreshTitle ()
|
||||||
setWindowTitle (title);
|
setWindowTitle (title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
TrMainWindow :: refreshVisibleCount ()
|
|
||||||
{
|
|
||||||
const int visibleCount (myFilterModel.rowCount ());
|
|
||||||
const int totalCount (visibleCount + myFilterModel.hiddenRowCount ());
|
|
||||||
QString str;
|
|
||||||
if (visibleCount == totalCount)
|
|
||||||
str = tr ("%Ln Torrent (s)", 0, totalCount);
|
|
||||||
else
|
|
||||||
str = tr ("%L1 of %Ln Torrent (s)", 0, totalCount).arg (visibleCount);
|
|
||||||
myVisibleCountLabel->setText (str);
|
|
||||||
myVisibleCountLabel->setVisible (totalCount > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrMainWindow :: refreshFreeSpace ()
|
TrMainWindow :: refreshFreeSpace ()
|
||||||
{
|
{
|
||||||
|
@ -748,13 +725,13 @@ TrMainWindow :: refreshFreeSpace ()
|
||||||
|
|
||||||
if (bytes >= 0)
|
if (bytes >= 0)
|
||||||
{
|
{
|
||||||
const QString text = Formatter::sizeToString (bytes);
|
const QString sizeStr = Formatter::sizeToString (bytes);
|
||||||
|
|
||||||
const QString tip = tr ("Download folder \"%1\" has %2 free")
|
const QString tip = tr ("Download folder \"%1\" has %2 free")
|
||||||
.arg (myPrefs.getString (Prefs::DOWNLOAD_DIR))
|
.arg (myPrefs.getString (Prefs::DOWNLOAD_DIR))
|
||||||
.arg (text);
|
.arg (sizeStr);
|
||||||
|
|
||||||
myFreeSpaceTextLabel->setText (text);
|
myFreeSpaceTextLabel->setText (sizeStr);
|
||||||
myFreeSpaceTextLabel->setToolTip (tip);
|
myFreeSpaceTextLabel->setToolTip (tip);
|
||||||
myFreeSpaceIconLabel->setToolTip (tip);
|
myFreeSpaceIconLabel->setToolTip (tip);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,6 @@ class TrMainWindow: public QMainWindow
|
||||||
void showTotalTransfer ();
|
void showTotalTransfer ();
|
||||||
void showSessionRatio ();
|
void showSessionRatio ();
|
||||||
void showSessionTransfer ();
|
void showSessionTransfer ();
|
||||||
void refreshVisibleCount ();
|
|
||||||
void refreshFreeSpace ();
|
void refreshFreeSpace ();
|
||||||
void refreshTitle ();
|
void refreshTitle ();
|
||||||
void refreshStatusBar ();
|
void refreshStatusBar ();
|
||||||
|
@ -155,7 +154,6 @@ class TrMainWindow: public QMainWindow
|
||||||
QPushButton * myAltSpeedButton;
|
QPushButton * myAltSpeedButton;
|
||||||
QAction * myAltSpeedAction;
|
QAction * myAltSpeedAction;
|
||||||
QPushButton * myOptionsButton;
|
QPushButton * myOptionsButton;
|
||||||
QLabel * myVisibleCountLabel;
|
|
||||||
QPushButton * myStatsModeButton;
|
QPushButton * myStatsModeButton;
|
||||||
QLabel * myStatsLabel;
|
QLabel * myStatsLabel;
|
||||||
QLabel * myDownloadSpeedLabel;
|
QLabel * myDownloadSpeedLabel;
|
||||||
|
|
Loading…
Reference in New Issue