merged with upstream/master

This commit is contained in:
csoler 2016-05-01 15:22:13 -04:00
commit 70648398e2
39 changed files with 1086 additions and 584 deletions

View file

@ -219,8 +219,8 @@ TransfersDialog::TransfersDialog(QWidget *parent)
// workaround for Qt bug, should be solved in next Qt release 4.7.0
// http://bugreports.qt.nokia.com/browse/QTBUG-8270
QShortcut *Shortcut = new QShortcut(QKeySequence (Qt::Key_Delete), ui.downloadList, 0, 0, Qt::WidgetShortcut);
connect(Shortcut, SIGNAL(activated()), this, SLOT( cancel ()));
mShortcut = new QShortcut(QKeySequence (Qt::Key_Delete), ui.downloadList, 0, 0, Qt::WidgetShortcut);
connect(mShortcut, SIGNAL(activated()), this, SLOT( cancel ()));
//Selection Setup
selection = ui.downloadList->selectionModel();
@ -942,7 +942,8 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo)
qlonglong completed = fileInfo.transfered;
qlonglong remaining = fileInfo.size - fileInfo.transfered;
qlonglong downloadtime = (fileInfo.size - fileInfo.transfered) / (fileInfo.tfRate * 1024.0);
qlonglong downloadtime = (fileInfo.tfRate > 0)?( (fileInfo.size - fileInfo.transfered) / (fileInfo.tfRate * 1024.0) ) : 0 ;
qint64 qi64LastDL = fileInfo.lastTS ; //std::numeric_limits<qint64>::max();
if (qi64LastDL == 0) // file is complete, or any raison why the time has not been set properly
@ -1355,7 +1356,7 @@ void TransfersDialog::insertTransfers()
qlonglong fileSize = info.size;
qlonglong completed = pit->transfered;
// double progress = (info.size > 0)?(pit->transfered * 100.0 / info.size):0.0;
qlonglong remaining = (info.size - pit->transfered) / (pit->tfRate * 1024.0);
qlonglong remaining = (pit->tfRate>0)?((info.size - pit->transfered) / (pit->tfRate * 1024.0)):0;
// Estimate the completion. We need something more accurate, meaning that we need to
// transmit the completion info.

View file

@ -31,6 +31,7 @@
#define IMAGE_TRANSFERS ":/icons/ktorrent_128.png"
class QShortcut;
class DLListDelegate;
class ULListDelegate;
class QStandardItemModel;
@ -243,6 +244,8 @@ private:
QString downloads;
QString uploads;
QShortcut *mShortcut ;
/** Qt Designer generated object */
Ui::TransfersDialog ui;

View file

@ -1725,7 +1725,11 @@ void ChatWidget::quote()
void ChatWidget::dropPlacemark()
{
ui->textBrowser->append("----------");
ui->textBrowser->moveCursor(QTextCursor::End); // *append* inserts text at end but with formatting in effect at
ui->textBrowser->append("----------"); // current cursor position, such as in the middle of a hotlink,
// which would be strange. This OTOH inserts text with
// formatting in effect on the last line, which may be strange
// or not.
}
void ChatWidget::saveImage()

View file

@ -10,6 +10,7 @@ SubscribeToolButton::SubscribeToolButton(QWidget *parent) :
{
mSubscribed = false;
mMenu = NULL ;
setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
#ifdef USE_MENUBUTTONPOPUP
@ -46,14 +47,18 @@ void SubscribeToolButton::updateUi()
setIcon(QIcon(":/images/accepted16.png"));
setText(tr("Subscribed"));
QMenu *menu = new QMenu;
menu->addAction(QIcon(":/images/cancel.png"), tr("Unsubscribe"), this, SLOT(unsubscribePrivate()));
if(mMenu != NULL) // that's because setMenu does not give away memory ownership
delete mMenu ;
mMenu = new QMenu;
mMenu->addAction(QIcon(":/images/cancel.png"), tr("Unsubscribe"), this, SLOT(unsubscribePrivate()));
if (!mSubscribedActions.empty()) {
menu->addSeparator();
menu->addActions(mSubscribedActions);
mMenu->addSeparator();
mMenu->addActions(mSubscribedActions);
}
setMenu(menu);
setMenu(mMenu);
#ifndef USE_MENUBUTTONPOPUP
disconnect(this, SIGNAL(clicked()), this, SLOT(subscribePrivate()));

View file

@ -26,6 +26,7 @@ private:
private:
bool mSubscribed;
QList<QAction*> mSubscribedActions;
QMenu *mMenu ;
};
#endif // SUBSCRIBETOOLBUTTON_H

View file

@ -259,7 +259,7 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
}
}
static void convolveWithGaussian(double *forceMap,int S,int /*s*/)
static void convolveWithGaussian(double *forceMap,unsigned int S,int /*s*/)
{
static double *bf = NULL ;
@ -267,8 +267,8 @@ static void convolveWithGaussian(double *forceMap,int S,int /*s*/)
{
bf = new double[S*S*2] ;
for(int i=0;i<S;++i)
for(int j=0;j<S;++j)
for(unsigned int i=0;i<S;++i)
for(unsigned int j=0;j<S;++j)
{
int x = (i<S/2)?i:(S-i) ;
int y = (j<S/2)?j:(S-j) ;
@ -284,8 +284,8 @@ static void convolveWithGaussian(double *forceMap,int S,int /*s*/)
unsigned long nn[2] = {S,S};
fourn(&forceMap[-1],&nn[-1],2,1) ;
for(int i=0;i<S;++i)
for(int j=0;j<S;++j)
for(unsigned int i=0;i<S;++i)
for(unsigned int j=0;j<S;++j)
{
float a = forceMap[2*(i+S*j)]*bf[2*(i+S*j)] - forceMap[2*(i+S*j)+1]*bf[2*(i+S*j)+1] ;
float b = forceMap[2*(i+S*j)]*bf[2*(i+S*j)+1] + forceMap[2*(i+S*j)+1]*bf[2*(i+S*j)] ;
@ -296,7 +296,7 @@ static void convolveWithGaussian(double *forceMap,int S,int /*s*/)
fourn(&forceMap[-1],&nn[-1],2,-1) ;
for(int i=0;i<S*S*2;++i)
for(unsigned int i=0;i<S*S*2;++i)
forceMap[i] /= S*S;
}