Commit 64544ea8 authored by Albert Astals Cid's avatar Albert Astals Cid

Use QRandomGenerator::global instead of KRandom::random()

We're trying to deprecate the second
parent b46bed5e
......@@ -45,7 +45,7 @@ target_link_libraries(KF5ConfigWidgets
KF5::WidgetsAddons # For K*Action, KPage*, KViewStateSerializer, KAcceleratorManager, K*GuiItem
KF5::ConfigGui # KStandardAction uses KStandardShortcut
PRIVATE
KF5::CoreAddons # KCModule uses KAboutData, KTipDialog uses KRandom
KF5::CoreAddons # KCModule uses KAboutData
KF5::GuiAddons # KColorScheme uses KColorUtils
KF5::I18n # For action and widget texts
)
......
......@@ -34,6 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <QLabel>
#include <QDesktopWidget>
#include <QPushButton>
#include <QRandomGenerator>
#include <QScreen>
#include <QTextBrowser>
#include <QHBoxLayout>
......@@ -129,7 +130,7 @@ KTipDatabase::KTipDatabase(const QString &_tipFile)
d->loadTips(tipFile);
if (!d->tips.isEmpty()) {
d->currentTip = KRandom::random() % d->tips.count();
d->currentTip = QRandomGenerator::global()->bounded(d->tips.count());
}
}
......@@ -145,7 +146,7 @@ KTipDatabase::KTipDatabase(const QStringList &tipsFiles)
}
if (!d->tips.isEmpty()) {
d->currentTip = KRandom::random() % d->tips.count();
d->currentTip = QRandomGenerator::global()->bounded(d->tips.count());
}
}
......@@ -381,7 +382,7 @@ void KTipDialog::showMultiTip(QWidget *parent, const QStringList &tipFiles, bool
QDateTime lastShown = configGroup.readEntry( "TipLastShown", QDateTime() );
// Show tip roughly once a week
if ( lastShown.secsTo( QDateTime::currentDateTime() ) < (oneDay + (KRandom::random() % (10 * oneDay))) )
if ( lastShown.secsTo( QDateTime::currentDateTime() ) < (oneDay + (QRandomGenerator::global()->bounded(10 * oneDay))) )
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment