Show countdown for clipboard clearing (#6333)

* Closes #1843

Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
ByteHamster 2021-04-01 05:12:59 +02:00 committed by GitHub
parent 8c9530e3ec
commit 439c155552
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 67 additions and 14 deletions

View file

@ -623,6 +623,19 @@ MainWindow::MainWindow()
connect(qApp, SIGNAL(openFile(QString)), this, SLOT(openDatabase(QString)));
connect(qApp, SIGNAL(quitSignalReceived()), this, SLOT(appExit()), Qt::DirectConnection);
statusBar()->setFixedHeight(24);
m_progressBarLabel = new QLabel(statusBar());
m_progressBarLabel->setVisible(false);
statusBar()->addPermanentWidget(m_progressBarLabel);
m_progressBar = new QProgressBar(statusBar());
m_progressBar->setVisible(false);
m_progressBar->setTextVisible(false);
m_progressBar->setMaximumWidth(100);
m_progressBar->setFixedHeight(15);
m_progressBar->setMaximum(100);
statusBar()->addPermanentWidget(m_progressBar);
connect(clipboard(), SIGNAL(updateCountdown(int, QString)), this, SLOT(updateProgressBar(int, QString)));
restoreConfigState();
}
@ -1388,6 +1401,19 @@ void MainWindow::updateTrayIcon()
QApplication::setQuitOnLastWindowClosed(!isTrayIconEnabled());
}
void MainWindow::updateProgressBar(int percentage, QString message)
{
if (percentage < 0) {
m_progressBar->setVisible(false);
m_progressBarLabel->setVisible(false);
} else {
m_progressBar->setValue(percentage);
m_progressBar->setVisible(true);
m_progressBarLabel->setText(message);
m_progressBarLabel->setVisible(true);
}
}
void MainWindow::obtainContextFocusLock()
{
m_contextMenuFocusLock = true;