Commit 9091ff16 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Remove KCompletion dependency

Summary: For all uses of KLineEdit it is enough to use QLineEdit.

Test Plan: starts and works as expected

Reviewers: aacid

Reviewed By: aacid

Subscribers: aacid, kde-edu

Tags: #kde_edu

Differential Revision: https://phabricator.kde.org/D25557
parent 32a7cefa
......@@ -40,7 +40,6 @@ find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED
find_package(Phonon4Qt5 REQUIRED)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Completion
Crash
DocTools
I18n
......
......@@ -27,7 +27,6 @@ ecm_add_app_icon(klettres_SRCS ICONS ${ICONS_SRCS})
add_executable(klettres ${klettres_SRCS})
target_link_libraries(klettres
KF5::Completion
KF5::Crash
KF5::NewStuff
KF5::I18n
......
......@@ -33,6 +33,7 @@
#include <QDomDocument>
#include <QWidget>
#include <QStandardPaths>
#include <QPointer>
//KDE includes
#include <KActionCollection>
......@@ -444,7 +445,7 @@ void KLettres::slotPasteChar()
QIcon KLettres::charIcon(QChar c)
{
///Create a name and path for the icon
//
//
// FIXME: This code used KStandardDirs::locateLocal("icon", ...) before
// and I am not sure if GenericCacheLocation is what we are aiming
// for. So best would be if somebody experienced in QStandardPaths
......
......@@ -42,7 +42,7 @@ KLettresView::KLettresView(KLettres *parent)
m_klettres = parent;
//lineEdit for user input
m_letterEdit = new KLineEdit( this );
m_letterEdit = new QLineEdit( this );
m_letterEdit->setToolTip(i18n("Type the letter or syllable that you just heard" ) );
m_letterEdit->setFont(Prefs::font());
m_letterEdit->setContextMenuPolicy(Qt::NoContextMenu);
......@@ -156,7 +156,7 @@ void KLettresView::game()
m_cursorPos = 1;
//reset everything so when you change language or levels
//it all restarts nicely
QObject::disconnect(m_letterEdit, &KLineEdit::textChanged, this, &KLettresView::slotProcess);
QObject::disconnect(m_letterEdit, &QLineEdit::textChanged, this, &KLettresView::slotProcess);
m_letterEdit->clear();
m_letterEdit->setCursorPosition(0);
m_letterEdit->setMaxLength( 1 );
......@@ -164,19 +164,19 @@ void KLettresView::game()
m_upperLetter.clear();
chooseSound();
randomInt++;
QObject::connect(m_letterEdit, &KLineEdit::textChanged, this, &KLettresView::slotProcess);
QObject::connect(m_letterEdit, &QLineEdit::textChanged, this, &KLettresView::slotProcess);
}
void KLettresView::slotProcess(const QString &inputLetter)
{
QString lang = Prefs::language();
QObject::disconnect(m_letterEdit, &KLineEdit::textChanged, this, &KLettresView::slotProcess);
QObject::disconnect(m_letterEdit, &QLineEdit::textChanged, this, &KLettresView::slotProcess);
//check if backspace
if (inputLetter.length() != m_cursorPos) {
m_cursorPos--;
m_letterEdit->setMaxLength( m_cursorPos );
QObject::connect(m_letterEdit, &KLineEdit::textChanged, this, &KLettresView::slotProcess);
QObject::connect(m_letterEdit, &QLineEdit::textChanged, this, &KLettresView::slotProcess);
return;
}
QChar input_character = inputLetter.at(inputLetter.length()-1);
......@@ -198,7 +198,7 @@ void KLettresView::slotProcess(const QString &inputLetter)
} else {
qCDebug(KLETTRES_LOG) << "cursor " << m_cursorPos << endl;
m_letterEdit->backspace();
QObject::connect(m_letterEdit, &KLineEdit::textChanged, this, &KLettresView::slotProcess);
QObject::connect(m_letterEdit, &QLineEdit::textChanged, this, &KLettresView::slotProcess);
}
}
......@@ -216,7 +216,7 @@ void KLettresView::slotTimerDone()
m_letterEdit->setCursorPosition( m_cursorPos );
m_letterEdit->setFocus();
m_cursorPos ++;
QObject::connect(m_letterEdit, &KLineEdit::textChanged, this, &KLettresView::slotProcess);
QObject::connect(m_letterEdit, &QLineEdit::textChanged, this, &KLettresView::slotProcess);
} else {
game(); //another syllable
}
......@@ -227,7 +227,7 @@ void KLettresView::slotTimerDone()
m_letterEdit->setFocus();
//play sound again
m_klettres->soundFactory->playSound(m_random);
QObject::connect(m_letterEdit, &KLineEdit::textChanged, this, &KLettresView::slotProcess);
QObject::connect(m_letterEdit, &QLineEdit::textChanged, this, &KLettresView::slotProcess);
}
}
......
......@@ -21,7 +21,7 @@
#ifndef KLETTRESVIEW_H
#define KLETTRESVIEW_H
#include <KLineEdit>
#include <QLineEdit>
class QPixmap;
class QRect;
......@@ -62,7 +62,7 @@ public:
///A Klettres object
KLettres *m_klettres;
///The line where the user enters his/her input
KLineEdit *m_letterEdit;
QLineEdit *m_letterEdit;
///set the chosen theme
void setTheme(KLTheme *theme);
......
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