Commit 8d5d9b3b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make compile against qt6

parent bbca0079
Pipeline #139331 passed with stage
in 42 seconds
......@@ -10,7 +10,7 @@ set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_
project(klettres VERSION ${RELEASE_SERVICE_VERSION})
set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.85.0")
set(KF5_MIN_VERSION "5.90.0")
# we need some parts of the ECM CMake helpers
find_package (ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
......@@ -31,14 +31,14 @@ include(ECMSetupVersion)
# Load the frameworks we need
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED
Core
Svg
Network
Test
Widgets
)
find_package(Phonon4Qt5 REQUIRED)
find_package(Phonon4Qt${QT_MAJOR_VERSION} REQUIRED)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Crash
......
......@@ -36,9 +36,9 @@ target_link_libraries(klettres
KF5::Crash
KF5::NewStuff
KF5::I18n
Qt5::Svg
Qt::Svg
${PHONON_LIBRARY}
Qt5::Xml)
Qt::Xml)
install(TARGETS klettres ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
......@@ -46,7 +46,7 @@ install(TARGETS klettres ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
########### install files ###############
install( PROGRAMS org.kde.klettres.desktop DESTINATION ${KDE_INSTALL_APPDIR} )
install( FILES klettresui.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/klettres )
install( FILES klettresui.rc DESTINATION ${KDE_INSTALL_KXMLGUIDIR}/klettres )
install( FILES klettres.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR} )
install( FILES klettres.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR} )
......
......@@ -5,7 +5,6 @@
*/
#include "klettres.h"
#include <kwidgetsaddons_version.h>
//Qt includes
#include <QAction>
......@@ -32,7 +31,7 @@
#include <KToolBar>
#include <KToggleAction>
#include <kns3/downloaddialog.h>
#include <KNS3/QtQuickDialogWrapper>
//Project includes
#include "ui_fontsdlg.h"
#include "timer.h"
......@@ -114,7 +113,7 @@ void KLettres::setupActions()
{
QAction *m_newAction = actionCollection()->addAction(QStringLiteral("play_new"));
m_newAction->setText(i18n("New Sound"));
actionCollection()->setDefaultShortcut(m_newAction,QKeySequence(Qt::CTRL+Qt::Key_N));
actionCollection()->setDefaultShortcut(m_newAction,QKeySequence(Qt::CTRL | Qt::Key_N));
m_newAction->setIcon(QIcon::fromTheme(QStringLiteral("document-new"))); // ### better icon for this?
connect(m_newAction, &QAction::triggered, m_view, &KLettresView::game);
m_newAction->setToolTip(i18n("Play a new sound"));
......@@ -161,33 +160,21 @@ void KLettres::setupActions()
m_kidAction = actionCollection()->add<KToggleAction>(QStringLiteral("mode_kid"));
m_kidAction->setText(i18n("Mode Kid"));
actionCollection()->setDefaultShortcut(m_kidAction,QKeySequence(Qt::CTRL+Qt::Key_K));
actionCollection()->setDefaultShortcut(m_kidAction,QKeySequence(Qt::CTRL | Qt::Key_K));
m_kidAction->setIcon(QIcon::fromTheme(QStringLiteral("klettres_kids")));
connect(m_kidAction, &KToggleAction::triggered, this, &KLettres::slotModeKid);
m_kidAction->setWhatsThis(i18n("If you are in the Grown-up mode, clicking on this button will set up the Kid mode. The Kid mode has no menubar and the font is bigger in the statusbar."));
m_grownupAction = actionCollection()->add<KToggleAction>(QStringLiteral("mode_grownup"));
m_grownupAction->setText(i18n("Mode Grown-up"));
actionCollection()->setDefaultShortcut(m_grownupAction,QKeySequence(Qt::CTRL+Qt::Key_G));
actionCollection()->setDefaultShortcut(m_grownupAction,QKeySequence(Qt::CTRL | Qt::Key_G));
m_grownupAction->setIcon(QIcon::fromTheme(QStringLiteral("klettres_grownup")));
connect(m_grownupAction, &KToggleAction::triggered, this, &KLettres::slotModeGrownup);
m_grownupAction->setWhatsThis(i18n("The Grownup mode is the normal mode where you can see the menubar."));
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 78, 0)
connect(m_levelAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &KLettres::slotChangeLevel);
#else
connect(m_levelAction, &KSelectAction::indexTriggered, this, &KLettres::slotChangeLevel);
#endif
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 78, 0)
connect(m_languageAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &KLettres::slotChangeLanguage);
#else
connect(m_languageAction, &KSelectAction::indexTriggered, this, &KLettres::slotChangeLanguage);
#endif
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 78, 0)
connect(m_themeAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &KLettres::slotChangeTheme);
#else
connect(m_themeAction, &KSelectAction::indexTriggered, this, &KLettres::slotChangeTheme);
#endif
KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection());
......@@ -257,13 +244,11 @@ void KLettres::loadSettings()
void KLettres::slotDownloadNewStuff()
{
QPointer<KNS3::DownloadDialog> dialog(new KNS3::DownloadDialog(QStringLiteral("klettres.knsrc"), this));
if ( dialog->exec() == QDialog::Accepted ) {
// do nothing
KNS3::QtQuickDialogWrapper dialog(QStringLiteral("klettres.knsrc"));
const QList<KNSCore::EntryInternal> entries = dialog.exec();
if (entries.isEmpty()) {
return;
}
delete dialog;
//look for languages dirs installed
QStringList languages = LangUtils::getLanguages();
m_languageNames = LangUtils::getLanguagesNames(languages);
......
......@@ -11,7 +11,9 @@
#include <QCommandLineParser>
#include <KLocalizedString>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <Kdelibs4ConfigMigrator>
#endif
#include <KCrash>
#include <KAboutData>
#include "klettres.h"
......@@ -20,10 +22,11 @@
int main(int argc, char **argv)
{
QApplication app(argc, argv);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif
KLocalizedString::setApplicationDomain("klettres");
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QStringList configFiles;
QStringList rcFiles;
configFiles << QStringLiteral("klettresrc");
......@@ -32,6 +35,7 @@ int main(int argc, char **argv)
migrator.setConfigFiles(configFiles);
migrator.setUiFiles(rcFiles);
migrator.migrate();
#endif
KAboutData about(QStringLiteral("klettres"), i18n("KLettres"), QStringLiteral(KLETTRES_VERSION_STRING), i18n("KLettres helps a very young child or an adult learning \n"
"a new language by associating sounds and \n"
......
......@@ -8,6 +8,7 @@
#include "soundfactory.h"
#include <KRandom>
#include <QStandardPaths>
#include <KMessageBox>
......@@ -170,13 +171,12 @@ bool SoundFactory::loadLanguage(QDomDocument &layoutDocument, const QString &cur
void SoundFactory::setSoundSequence()
{
// Seed the random number generator
KRandomSequence randomSequence;
randomList.clear();
//get the number of sounds then shuffle it: each number will be taken once then the sequence will come back
for (uint j = 0; j < sounds; j++)
randomList.append(j);
randomSequence.randomize(randomList);
KRandom::shuffle(randomList);
}
......@@ -10,6 +10,6 @@ add_executable(MalayalamTest ${malayalamtest_SRCS})
add_test(NAME MalayalamTest COMMAND MalayalamTest)
ecm_mark_as_test(MalayalamTest)
target_link_libraries(MalayalamTest
Qt5::Test
Qt::Test
)
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