Fix various cppcheck comments for Qt client code
This commit is contained in:
parent
9605bfc36a
commit
2adbb42763
|
@ -308,7 +308,7 @@ MyApp::MyApp (int& argc, char ** argv):
|
|||
/* these functions are for popping up desktop notifications */
|
||||
|
||||
void
|
||||
MyApp::onTorrentsAdded (QSet<int> torrents)
|
||||
MyApp::onTorrentsAdded (const QSet<int>& torrents)
|
||||
{
|
||||
if (!myPrefs->getBool (Prefs::SHOW_NOTIFICATION_ON_ADD))
|
||||
return;
|
||||
|
|
2
qt/app.h
2
qt/app.h
|
@ -57,7 +57,7 @@ class MyApp: public QApplication
|
|||
void onSessionSourceChanged ();
|
||||
void refreshPref (int key);
|
||||
void refreshTorrents ();
|
||||
void onTorrentsAdded (QSet<int>);
|
||||
void onTorrentsAdded (const QSet<int>& torrents);
|
||||
void onTorrentCompleted (int);
|
||||
void onNewTorrentChanged (int);
|
||||
|
||||
|
|
|
@ -98,9 +98,9 @@ class PeerItem: public QTreeWidgetItem
|
|||
|
||||
virtual ~PeerItem () {}
|
||||
|
||||
PeerItem (const Peer& p)
|
||||
PeerItem (const Peer& p):
|
||||
peer(p)
|
||||
{
|
||||
peer = p;
|
||||
int q[4];
|
||||
if (sscanf (p.address.toUtf8 ().constData (), "%d.%d.%d.%d", q+0, q+1, q+2, q+3) == 4)
|
||||
collatedAddress.sprintf ("%03d.%03d.%03d.%03d", q[0], q[1], q[2], q[3]);
|
||||
|
@ -408,18 +408,19 @@ Details::refresh ()
|
|||
|
||||
// myHaveLabel
|
||||
double sizeWhenDone = 0;
|
||||
double leftUntilDone = 0;
|
||||
double available = 0;
|
||||
int64_t haveTotal = 0;
|
||||
int64_t haveVerified = 0;
|
||||
int64_t haveUnverified = 0;
|
||||
int64_t verifiedPieces = 0;
|
||||
if (torrents.empty ())
|
||||
{
|
||||
string = none;
|
||||
}
|
||||
else
|
||||
{
|
||||
double leftUntilDone = 0;
|
||||
int64_t haveTotal = 0;
|
||||
int64_t haveVerified = 0;
|
||||
int64_t haveUnverified = 0;
|
||||
int64_t verifiedPieces = 0;
|
||||
|
||||
foreach (const Torrent * t, torrents)
|
||||
{
|
||||
if (t->hasMetadata ())
|
||||
|
@ -841,7 +842,7 @@ Details::refresh ()
|
|||
foreach (const Peer& peer, peers)
|
||||
{
|
||||
const QString key = idStr + ":" + peer.address;
|
||||
PeerItem * item = (PeerItem*) myPeers.value (key, 0);
|
||||
PeerItem * item = static_cast<PeerItem*> (myPeers.value (key, 0));
|
||||
|
||||
if (item == 0) // new peer has connected
|
||||
{
|
||||
|
|
|
@ -623,7 +623,6 @@ FileTreeModel::addFile (int fileIndex,
|
|||
QList<QModelIndex> & rowsAdded,
|
||||
bool updateFields)
|
||||
{
|
||||
bool added = false;
|
||||
FileTreeItem * item;
|
||||
QStringList tokens = filename.split (QChar::fromLatin1('/'));
|
||||
|
||||
|
@ -651,6 +650,8 @@ FileTreeModel::addFile (int fileIndex,
|
|||
}
|
||||
else // we haven't build the FileTreeItems for these tokens yet
|
||||
{
|
||||
bool added = false;
|
||||
|
||||
item = myRootItem;
|
||||
while (!tokens.isEmpty())
|
||||
{
|
||||
|
|
|
@ -285,7 +285,7 @@ FilterBar::createActivityCombo ()
|
|||
|
||||
namespace
|
||||
{
|
||||
QString readableHostName (const QString host)
|
||||
QString readableHostName (const QString& host)
|
||||
{
|
||||
// get the readable name...
|
||||
QString name = host;
|
||||
|
|
|
@ -1412,7 +1412,7 @@ TrMainWindow::onError (QNetworkReply::NetworkError code)
|
|||
}
|
||||
|
||||
void
|
||||
TrMainWindow::errorMessage (const QString msg)
|
||||
TrMainWindow::errorMessage (const QString& msg)
|
||||
{
|
||||
myErrorMessage = msg;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class TrMainWindow: public QMainWindow
|
|||
void dataReadProgress ();
|
||||
void dataSendProgress ();
|
||||
void onError (QNetworkReply::NetworkError);
|
||||
void errorMessage (const QString);
|
||||
void errorMessage (const QString&);
|
||||
void toggleWindows (bool doShow);
|
||||
void onSetPrefs ();
|
||||
void onSetPrefs (bool);
|
||||
|
|
|
@ -143,7 +143,6 @@ TorrentModel::updateTorrents (tr_variant * torrents, bool isCompleteList)
|
|||
QSet<int> oldIds;
|
||||
QSet<int> addIds;
|
||||
QSet<int> newIds;
|
||||
int updatedCount = 0;
|
||||
|
||||
if (isCompleteList)
|
||||
oldIds = getIds ();
|
||||
|
@ -172,7 +171,6 @@ TorrentModel::updateTorrents (tr_variant * torrents, bool isCompleteList)
|
|||
else
|
||||
{
|
||||
tor->update (child);
|
||||
++updatedCount;
|
||||
if (tor->isMagnet() && tor->hasMetadata())
|
||||
{
|
||||
addIds.insert (tor->id());
|
||||
|
|
Loading…
Reference in New Issue