Ignore:
Timestamp:
Feb 1, 2013, 8:58:55 PM (10 years ago)
Author:
jordan
Message:

in the Qt and GTK+ clients, move the torrent count indicator from the statusbar to the filterbar

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/filterbar.cc

    r13869 r13927  
    407407  const int hmargin = qMax (int (HIG::PAD), style ()->pixelMetric (QStyle::PM_LayoutHorizontalSpacing));
    408408
     409  myCountLabel = new QLabel;
    409410  h->setSpacing (0);
    410411  h->setContentsMargins (2, 2, 2, 2);
    411   h->addWidget (new QLabel (tr ("Show:"), this));
     412  h->addWidget (myCountLabel);
    412413  h->addSpacing (hmargin);
    413414
     
    438439  connect (myActivityCombo, SIGNAL (currentIndexChanged (int)), this, SLOT (onActivityIndexChanged (int)));
    439440  connect (myTrackerCombo, SIGNAL (currentIndexChanged (int)), this, SLOT (onTrackerIndexChanged (int)));
     441  connect (&myFilter, SIGNAL (rowsInserted (const QModelIndex&,int,int)), this, SLOT (refreshCountLabel ()));
     442  connect (&myFilter, SIGNAL (rowsRemoved (const QModelIndex&,int,int)), this, SLOT (refreshCountLabel ()));
    440443  connect (&myTorrents, SIGNAL (modelReset ()), this, SLOT (onTorrentModelReset ()));
    441444  connect (&myTorrents, SIGNAL (rowsInserted (const QModelIndex&,int,int)), this, SLOT (onTorrentModelRowsInserted (const QModelIndex&,int,int)));
     
    446449  recountSoon ();
    447450  refreshTrackers ();
     451  refreshCountLabel ();
    448452  myIsBootstrapping = false;
    449453
     
    579583  return QString ("%L1").arg (n);
    580584}
     585
     586void
     587FilterBar :: refreshCountLabel ()
     588{
     589  const int visibleCount = myFilter.rowCount ();
     590  const int torrentCount = visibleCount + myFilter.hiddenRowCount ();
     591
     592  if (visibleCount == torrentCount)
     593    myCountLabel->setText (tr("Show:"));
     594  else
     595    myCountLabel->setText (tr("Show %Ln:", 0, visibleCount));
     596}
Note: See TracChangeset for help on using the changeset viewer.