void RippleAnimation::paint(QPainter &p, int x, int y, int outerWidth, const QColor *colorOverride) { if (_ripples.empty()) { return; } if (rtl()) x = outerWidth - x - (_mask.width() / cIntRetinaFactor()); p.translate(x, y); for (const auto &ripple : _ripples) { ripple->paint(p, _mask, colorOverride); } p.translate(-x, -y); clearFinished(); }
Transfers::Transfers(QWidget* _p, const char* _n) : QWidget(_p) { QVBoxLayout *MainBox = new QVBoxLayout(this); MainBox->setMargin(0); MainBox->setSpacing(0); transferSplitter = new QSplitter(this); MainBox->addWidget(transferSplitter); downloadsWidget = new QWidget(transferSplitter); uploadsWidget = new QWidget(transferSplitter); transferSplitter->setOrientation(Qt::Vertical); if (museeq->settings()->value("saveTransfersLayout", false).toBool()) { QString optionName = "transferSplitter_Layout"; transferSplitter->restoreState(museeq->settings()->value(optionName).toByteArray()); } // Downloads QVBoxLayout *downloadVbox = new QVBoxLayout(downloadsWidget); downloadVbox->setMargin(0); downloadVbox->setSpacing(3); QHBoxLayout *downloadHbox = new QHBoxLayout; downloadVbox->addLayout(downloadHbox); QLabel * downloadsLabel = new QLabel(tr("Downloads:"), downloadsWidget); downloadsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); downloadHbox->addWidget(downloadsLabel); mDownrate = new QSpinBox(downloadsWidget); mDownrate->setMaximum(9999); downloadHbox->addWidget(mDownrate); QLabel * downrateLabel = new QLabel(tr("KiB/s"), downloadsWidget); downloadHbox->addWidget(downrateLabel); connect(mDownrate, SIGNAL(valueChanged(const QString&)), SLOT(setDownrate(const QString&))); connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&))); QFrame* sep = new QFrame(downloadsWidget); downloadHbox->addWidget(sep); sep->setFrameShape(QFrame::VLine); sep->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); mDownslots = new QSpinBox(downloadsWidget); downloadHbox->addWidget(mDownslots); QLabel * downslotsLabel = new QLabel(tr("slots"), downloadsWidget); downloadHbox->addWidget(downslotsLabel); connect(mDownslots, SIGNAL(valueChanged(const QString&)), SLOT(setDownslots(const QString&))); connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&))); QFrame* sep2 = new QFrame(downloadsWidget); downloadHbox->addWidget(sep2); sep2->setFrameShape(QFrame::VLine); sep2->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); mGroupDownloads = new QCheckBox(tr("Group by user"), downloadsWidget); downloadHbox->addWidget(mGroupDownloads); connect(mGroupDownloads, SIGNAL(toggled(bool)), SLOT(groupDownloadsSet(bool))); mDownloads = new TransferListView(true, downloadsWidget, "downloads"); downloadVbox->addWidget(mDownloads); mDownloads->setAcceptDrops(true); connect(museeq, SIGNAL(downloadUpdated(const NTransfer&)), mDownloads, SLOT(update(const NTransfer&))); connect(museeq, SIGNAL(downloadRemoved(const QString&, const QString&)), mDownloads, SLOT(remove(const QString&, const QString&))); connect(mDownloads, SIGNAL(dropSlsk(const QList<QUrl>&)), SLOT(dropSlsk(const QList<QUrl>&))); // Uploads QVBoxLayout *uploadVbox = new QVBoxLayout(uploadsWidget); uploadVbox->setMargin(0); uploadVbox->setSpacing(3); QHBoxLayout *uploadHbox = new QHBoxLayout; uploadVbox->addLayout(uploadHbox); uploadHbox->setSpacing(5); QLabel * uploadsLabel = new QLabel(tr("Uploads:")); uploadsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); uploadHbox->addWidget(uploadsLabel); mUprate = new QSpinBox(uploadsWidget); mUprate->setMaximum(9999); uploadHbox->addWidget(mUprate); QLabel * uprateLabel = new QLabel(tr("KiB/s"), uploadsWidget); uploadHbox->addWidget(uprateLabel); connect(mUprate, SIGNAL(valueChanged(const QString&)), SLOT(setUprate(const QString&))); connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&))); QFrame* sep3 = new QFrame(uploadsWidget); uploadHbox->addWidget(sep3); sep3->setFrameShape(QFrame::VLine); sep3->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); mUpslots = new QSpinBox(uploadsWidget); uploadHbox->addWidget(mUpslots); QLabel * upslotsLabel = new QLabel(tr("slots"), uploadsWidget); uploadHbox->addWidget(upslotsLabel); connect(mUpslots, SIGNAL(valueChanged(const QString&)), SLOT(setUpslots(const QString&))); connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&))); QFrame* sep4 = new QFrame(uploadsWidget); uploadHbox->addWidget(sep4); sep4->setFrameShape(QFrame::VLine); sep4->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); mGroupUploads = new QCheckBox(tr("Group by user"), uploadsWidget); uploadHbox->addWidget(mGroupUploads); connect(mGroupUploads, SIGNAL(toggled(bool)), SLOT(groupUploadsSet(bool))); mUploads = new TransferListView(false, uploadsWidget, "uploads"); uploadVbox->addWidget(mUploads); connect(museeq, SIGNAL(uploadUpdated(const NTransfer&)), mUploads, SLOT(update(const NTransfer&))); connect(museeq, SIGNAL(uploadRemoved(const QString&, const QString&)), mUploads, SLOT(remove(const QString&, const QString&))); mTransferMenu = new QMenu(this); ActionRetry = new QAction(tr("Retry"), this); connect(ActionRetry, SIGNAL(triggered()), this, SLOT(retrySelected())); mTransferMenu->addAction(ActionRetry); ActionCheckPosition = new QAction(tr("Check place"), this); connect(ActionCheckPosition, SIGNAL(triggered()), this, SLOT(updateSelected())); mTransferMenu->addAction(ActionCheckPosition); ActionAbort = new QAction(tr("Abort"), this); connect(ActionAbort, SIGNAL(triggered()), this, SLOT(abortSelected())); mTransferMenu->addAction(ActionAbort); ActionMessageDownloading = new QAction(tr("Message downloading users"), this); connect(ActionMessageDownloading, SIGNAL(triggered()), this, SLOT(messageDownloadingUsers())); mTransferMenu->addAction(ActionMessageDownloading); mClearMenu = mTransferMenu->addMenu(tr("Clear")); ActionClearSelected = new QAction(tr("Selected"), this); connect(ActionClearSelected, SIGNAL(triggered()), this, SLOT(clearSelected())); mClearMenu->addAction(ActionClearSelected); mClearMenu->addSeparator(); ActionClearFinished = new QAction(tr("Finished"), this); connect(ActionClearFinished, SIGNAL(triggered()), this, SLOT(clearFinished())); mClearMenu->addAction(ActionClearFinished); ActionClearAborted = new QAction(tr("Aborted"), this); connect(ActionClearAborted, SIGNAL(triggered()), this, SLOT(clearAborted())); mClearMenu->addAction(ActionClearAborted); ActionClearAwaiting = new QAction(tr("Offline"), this); connect(ActionClearAwaiting, SIGNAL(triggered()), this, SLOT(clearAwaiting())); mClearMenu->addAction(ActionClearAwaiting); ActionClearCruft = new QAction(tr("Cruft"), this); connect(ActionClearCruft, SIGNAL(triggered()), this, SLOT(clearCruft())); mClearMenu->addAction(ActionClearCruft); ActionClearFinishedAborted = new QAction(tr("Finished / aborted"), this); connect(ActionClearFinishedAborted, SIGNAL(triggered()), this, SLOT(clearFinishedAborted())); mClearMenu->addAction(ActionClearFinishedAborted); ActionClearQueued = new QAction(tr("Queued"), this); connect(ActionClearQueued, SIGNAL(triggered()), this, SLOT(clearQueued())); mClearMenu->addAction(ActionClearQueued); mTransferMenu->addSeparator(); mUsersMenu = mTransferMenu->addMenu(tr("Users")); connect(mDownloads, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(popupDownloads(const QPoint&))); connect(mUploads, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(popupUploads(const QPoint&))); connect(museeq, SIGNAL(transfersSorting(bool)), SLOT(setSorting(bool))); mUpGroupingChanging = mDownGroupingChanging = true; groupDownloads(museeq->settings()->value("groupDownloads", false).toBool()); groupUploads(museeq->settings()->value("groupUploads", false).toBool()); mUpGroupingChanging = mDownGroupingChanging = false; connect(museeq, SIGNAL(closingMuseeq()), this, SLOT(onClosingMuseeq())); }