Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 0631c779 authored by Laurent Montel's avatar Laurent Montel 😁

fix some clazy warning

parent 7d55d059
......@@ -91,8 +91,8 @@ void Application::setupDeclarativeBindings(QQmlEngine* qmlEngine)
QQmlContext* rootContext = qmlEngine->rootContext();
rootContext->setContextProperty("utils", new Utils());
rootContext->setContextProperty("strFormatter", new StringFormatter());
rootContext->setContextProperty(QStringLiteral("utils"), new Utils());
rootContext->setContextProperty(QStringLiteral("strFormatter"), new StringFormatter());
}
QStringList& Application::qmlImportPaths()
......@@ -133,8 +133,8 @@ void Application::registerQmlTypes()
void Application::migrateKde4Files()
{
QStringList configFiles;
configFiles << QLatin1String("ktouchrc");
Kdelibs4ConfigMigrator confMigrator(QLatin1String("ktouch"));
configFiles << QStringLiteral("ktouchrc");
Kdelibs4ConfigMigrator confMigrator(QStringLiteral("ktouch"));
confMigrator.setConfigFiles(configFiles);
confMigrator.migrate();
......@@ -144,7 +144,7 @@ void Application::migrateKde4Files()
{
dataDir.mkpath(dataDir.path());
}
const QString dbPath = dataDir.filePath("profiles.db");
const QString dbPath = dataDir.filePath(QStringLiteral("profiles.db"));
const QString oldDbPath = migration.locateLocal("data", QStringLiteral("ktouch/profiles.db"));
if (!QFile(dbPath).exists() && !oldDbPath.isEmpty())
{
......
......@@ -26,33 +26,33 @@ StringFormatter::StringFormatter(QObject* parent) :
QString StringFormatter::formatTime(const QTime& time)
{
return time.toString("mm:ss.zzz").left(7);
return time.toString(QStringLiteral("mm:ss.zzz")).left(7);
}
QString StringFormatter::formatTimeDiff(const QTime& from, const QTime& to)
{
const int diff = from.msecsTo(to);
const QTime diffTime = QTime(0, 0).addMSecs(diff > 0? diff: -diff);
return QString("%1 %2").arg(formatSign(diff), formatTime(diffTime));
return QStringLiteral("%1 %2").arg(formatSign(diff), formatTime(diffTime));
}
QString StringFormatter::formatAccuracy(qreal accuracy)
{
return QString("%1%").arg(100 * accuracy, 0, 'f', 1);
return QStringLiteral("%1%").arg(100 * accuracy, 0, 'f', 1);
}
QString StringFormatter::formatAccuracyDiff(qreal from, qreal to)
{
const qreal diff = to - from;
const QString accuracy = formatAccuracy(diff > 0? diff: -diff);
return QString("%1 %2").arg(formatSign(diff), accuracy);
return QStringLiteral("%1 %2").arg(formatSign(diff), accuracy);
}
QString StringFormatter::formatSign(qreal value)
{
if (value > 0)
return "+";
return QStringLiteral("+");
if (value < 0)
return "-";
return QStringLiteral("-");
return QString::fromUtf8("\u00B1");
}
......@@ -27,9 +27,9 @@ Utils::Utils(QObject* parent):
{
}
QUrl Utils::findImage(QString name)
QUrl Utils::findImage(const QString &name)
{
const QString relPath = QString("images/") + name;
const QString relPath = QStringLiteral("images/") + name;
const QString path = QStandardPaths::locate(QStandardPaths::DataLocation, relPath);
if (path.isNull())
......
......@@ -27,7 +27,7 @@ class Utils : public QObject
Q_OBJECT
public:
explicit Utils(QObject* parent = 0);
Q_INVOKABLE QUrl findImage(QString name);
Q_INVOKABLE QUrl findImage(const QString &name);
Q_INVOKABLE int getMinutesOfQTime(const QTime& time);
Q_INVOKABLE int getSecondsOfQTime(const QTime& time);
Q_INVOKABLE QString uuid();
......
......@@ -85,7 +85,7 @@ void AbstractKey::setHeight(int height)
QString AbstractKey::keyType() const
{
return "abstractKey";
return QStringLiteral("abstractKey");
}
void AbstractKey::copyFrom(AbstractKey* source)
......
......@@ -183,7 +183,7 @@ void Course::updateLessonCharacters(int firstIndex)
if (!m_doSyncLessonCharacters)
return;
QString characters = firstIndex > 0? lesson(firstIndex - 1)->characters(): "";
QString characters = firstIndex > 0? lesson(firstIndex - 1)->characters(): QLatin1String("");
for (int i = firstIndex; i < lessonCount(); i++)
{
......
......@@ -48,8 +48,8 @@ QSqlDatabase DbAccess::database()
{
dataDir.mkpath(dataDir.path());
}
QString dbPath = dataDir.filePath("profiles.db");
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
QString dbPath = dataDir.filePath(QStringLiteral("profiles.db"));
QSqlDatabase db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"));
db.setDatabaseName(dbPath);
if (!db.open())
{
......@@ -71,7 +71,7 @@ QSqlDatabase DbAccess::database()
void DbAccess::raiseError(const QSqlError& error)
{
m_errorMessage = QString("%1: %2").arg(error.driverText(), error.databaseText());
m_errorMessage = QStringLiteral("%1: %2").arg(error.driverText(), error.databaseText());
emit errorMessageChanged();
}
......@@ -91,7 +91,7 @@ bool DbAccess::checkDbSchema()
return false;
}
QSqlQuery versionQuery = db.exec("SELECT value FROM metadata WHERE key = 'version'");
QSqlQuery versionQuery = db.exec(QStringLiteral("SELECT value FROM metadata WHERE key = 'version'"));
if (db.lastError().isValid())
{
......@@ -106,12 +106,12 @@ bool DbAccess::checkDbSchema()
versionQuery.clear();
if (version == "1.0")
if (version == QLatin1String("1.0"))
{
return migrateFrom1_0To1_1();
}
if (version != "1.1")
if (version != QLatin1String("1.1"))
{
m_errorMessage = i18n("Invalid database version '%1'.", version);
emit errorMessageChanged();
......@@ -126,7 +126,7 @@ bool DbAccess::checkDbSchema()
raiseError(db.lastError());
return false;
}
db.exec("INSERT INTO metadata (key, value) VALUES ('version', '1.1')");
db.exec(QStringLiteral("INSERT INTO metadata (key, value) VALUES ('version', '1.1')"));
if (db.lastError().isValid())
{
qWarning() << db.lastError().text();
......@@ -351,7 +351,7 @@ bool DbAccess::migrateFrom1_0To1_1()
return false;
}
db.exec("DROP TABLE course_lessons_backup");
db.exec(QStringLiteral("DROP TABLE course_lessons_backup"));
if (db.lastError().isValid())
{
......@@ -363,7 +363,7 @@ bool DbAccess::migrateFrom1_0To1_1()
// generate new UUIDs for lessons
QSqlQuery idsQuery = db.exec("SELECT id FROM course_lessons");
QSqlQuery idsQuery = db.exec(QStringLiteral("SELECT id FROM course_lessons"));
if (db.lastError().isValid())
{
......@@ -382,7 +382,7 @@ bool DbAccess::migrateFrom1_0To1_1()
QSqlQuery updateIdQuery(db);
updateIdQuery.prepare("UPDATE course_lessons SET id = ? WHERE id = ?");
updateIdQuery.prepare(QStringLiteral("UPDATE course_lessons SET id = ? WHERE id = ?"));
foreach (const QString& id, ids)
{
......@@ -400,7 +400,7 @@ bool DbAccess::migrateFrom1_0To1_1()
}
}
db.exec("UPDATE metadata SET value = '1.1' WHERE key = 'version'");
db.exec(QStringLiteral("UPDATE metadata SET value = '1.1' WHERE key = 'version'"));
if (db.lastError().isValid())
{
......
......@@ -28,7 +28,7 @@ Key::Key(QObject* parent) :
QString Key::keyType() const
{
return "key";
return QStringLiteral("key");
}
int Key::fingerIndex() const
......
......@@ -35,8 +35,8 @@
KeyboardLayout::KeyboardLayout(QObject *parent) :
KeyboardLayoutBase(parent),
m_associatedDataIndexKeyboardLayout(0),
m_title(""),
m_name(""),
m_title(QLatin1String("")),
m_name(QLatin1String("")),
m_width(0),
m_height(0),
m_keys(QList<AbstractKey*>()),
......
......@@ -29,34 +29,34 @@ QString KeyChar::positionStr() const
switch (m_position)
{
case KeyChar::TopLeft:
return "topLeft";
return QStringLiteral("topLeft");
case KeyChar::TopRight:
return "topRight";
return QStringLiteral("topRight");
case KeyChar::BottomLeft:
return "bottomLeft";
return QStringLiteral("bottomLeft");
case KeyChar::BottomRight:
return "bottomRight";
return QStringLiteral("bottomRight");
case KeyChar::Hidden:
default:
return "hidden";
return QStringLiteral("hidden");
}
}
void KeyChar::setPositionStr(const QString &position)
{
if (position == "topLeft")
if (position == QLatin1String("topLeft"))
{
m_position = KeyChar::TopLeft;
}
else if (position == "topRight")
else if (position == QLatin1String("topRight"))
{
m_position = KeyChar::TopRight;
}
else if (position == "bottomLeft")
else if (position == QLatin1String("bottomLeft"))
{
m_position = KeyChar::BottomLeft;
}
else if (position == "bottomRight")
else if (position == QLatin1String("bottomRight"))
{
m_position = KeyChar::BottomRight;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -25,7 +25,7 @@ SpecialKey::SpecialKey(QObject *parent) :
QString SpecialKey::keyType() const
{
return "specialKey";
return QStringLiteral("specialKey");
}
QString SpecialKey::typeStr() const
......@@ -33,46 +33,46 @@ QString SpecialKey::typeStr() const
switch(m_type)
{
case SpecialKey::Tab:
return "tab";
return QStringLiteral("tab");
case SpecialKey::Capslock:
return "capslock";
return QStringLiteral("capslock");
case SpecialKey::Shift:
return "shift";
return QStringLiteral("shift");
case SpecialKey::Backspace:
return "backspace";
return QStringLiteral("backspace");
case SpecialKey::Return:
return "return";
return QStringLiteral("return");
case SpecialKey::Space:
return "space";
return QStringLiteral("space");
case SpecialKey::Other:
default:
return "other";
return QStringLiteral("other");
}
}
void SpecialKey::setTypeStr(const QString &typeStr)
{
if (typeStr == "tab")
if (typeStr == QLatin1String("tab"))
{
m_type = SpecialKey::Tab;
}
else if (typeStr == "capslock")
else if (typeStr == QLatin1String("capslock"))
{
m_type = SpecialKey::Capslock;
}
else if (typeStr == "shift")
else if (typeStr == QLatin1String("shift"))
{
m_type = SpecialKey::Shift;
}
else if (typeStr == "backspace")
else if (typeStr == QLatin1String("backspace"))
{
m_type = SpecialKey::Backspace;
}
else if (typeStr == "return")
else if (typeStr == QLatin1String("return"))
{
m_type = SpecialKey::Return;
}
else if (typeStr == "space")
else if (typeStr == QLatin1String("space"))
{
m_type = SpecialKey::Space;
}
......
......@@ -30,7 +30,7 @@ TrainingStats::TrainingStats(QObject* parent) :
m_startTime(0),
m_updateTimer(new QTimer(this))
{
connect(m_updateTimer, SIGNAL(timeout()), SLOT(update()));
connect(m_updateTimer, &QTimer::timeout, this, &TrainingStats::update);
}
int TrainingStats::charactesTyped() const
......
This diff is collapsed.
......@@ -33,8 +33,8 @@ CustomLessonEditorDialog::CustomLessonEditorDialog(QWidget* parent) :
{
this->setupUi(this);
connect(m_titleLineEdit, SIGNAL(textChanged(QString)), SLOT(onTitleChanged()));
connect(m_lessonTextEditor->textEdit(), SIGNAL(textChanged()), SLOT(onTextChanged()));
connect(m_titleLineEdit, &QLineEdit::textChanged, this, &CustomLessonEditorDialog::onTitleChanged);
connect(m_lessonTextEditor->textEdit(), &QTextEdit::textChanged, this, &CustomLessonEditorDialog::onTextChanged);
connect(this, &CustomLessonEditorDialog::validChanged, m_buttonBox->button(QDialogButtonBox::Ok), &QPushButton::setEnabled);
}
......@@ -59,8 +59,8 @@ void CustomLessonEditorDialog::setLesson(Lesson* lesson)
updateTitle();
updateText();
connect(lesson, SIGNAL(titleChanged()), SLOT(updateTitle()));
connect(lesson, SIGNAL(textChanged()), SLOT(updateText()));
connect(lesson, &Lesson::titleChanged, this, &CustomLessonEditorDialog::updateTitle);
connect(lesson, &Lesson::textChanged, this, &CustomLessonEditorDialog::updateText);
}
}
}
......@@ -84,7 +84,7 @@ void CustomLessonEditorDialog::setKeyboardLayout(KeyboardLayout* keyboardLayout)
if (m_keyboardLayout)
{
connect(m_keyboardLayout, SIGNAL(isValidChanged()), SLOT(updateAllowedCharacters()));
connect(m_keyboardLayout, &Resource::isValidChanged, this, &CustomLessonEditorDialog::updateAllowedCharacters);
}
}
}
......
......@@ -34,7 +34,7 @@ struct LessonPainterPrivate
{
blockFormat.setLineHeight(200, QTextBlockFormat::ProportionalHeight);
textCharFormat.setFontFamily("monospace");
textCharFormat.setFontFamily(QStringLiteral("monospace"));
textCharFormat.setFontPointSize(10);
textCharFormat.setForeground(QColor("#000"));
textCharFormat.setFontHintingPreference(QFont::PreferVerticalHinting);
......@@ -50,7 +50,7 @@ struct LessonPainterPrivate
preeditCharFromat.setBackground(QColor("#d0d0d0"));
titleCharFormat = textCharFormat;
titleCharFormat.setFontFamily("sans-serif");
titleCharFormat.setFontFamily(QStringLiteral("sans-serif"));
titleCharFormat.setFontPointSize(15);
}
......@@ -101,8 +101,8 @@ void LessonPainter::setLesson(Lesson* lesson)
if (m_lesson)
{
connect(m_lesson, SIGNAL(titleChanged()), SLOT(reset()));
connect(m_lesson, SIGNAL(textChanged()), SLOT(reset()));
connect(m_lesson.data(), &Lesson::titleChanged, this, &LessonPainter::reset);
connect(m_lesson.data(), &Lesson::textChanged, this, &LessonPainter::reset);
}
reset();
......@@ -160,9 +160,9 @@ void LessonPainter::setTrainingLineCore(TrainingLineCore* trainingLineCore)
if (m_trainingLineCore)
{
connect(m_trainingLineCore, SIGNAL(actualLineChanged()), SLOT(updateTrainingStatus()));
connect(m_trainingLineCore, SIGNAL(preeditStringChanged()), SLOT(updateTrainingStatus()));
connect(m_trainingLineCore, SIGNAL(done()), SLOT(advanceToNextTrainingLine()));
connect(m_trainingLineCore, &TrainingLineCore::actualLineChanged, this, &LessonPainter::updateTrainingStatus);
connect(m_trainingLineCore, &TrainingLineCore::preeditStringChanged, this, &LessonPainter::updateTrainingStatus);
connect(m_trainingLineCore, &TrainingLineCore::done, this, &LessonPainter::advanceToNextTrainingLine);
}
}
}
......
......@@ -23,7 +23,7 @@ PreferencesProxy::PreferencesProxy(QObject* parent):
QObject(parent)
{
connect(Preferences::self(), SIGNAL(configChanged()), SIGNAL(configChanged()));
connect(Preferences::self(), &KCoreConfigSkeleton::configChanged, this, &PreferencesProxy::configChanged);
}
bool PreferencesProxy::showKeyboard() const
......
......@@ -85,7 +85,7 @@ void TrainingLineCore::setReferenceLine(const QString& referenceLine)
if (referenceLine != m_referenceLine)
{
m_referenceLine = referenceLine;
m_actualLine = "";
m_actualLine = QLatin1String("");
clearKeyHint();
emit referenceLineChanged();
emit actualLineChanged();
......@@ -129,8 +129,8 @@ int TrainingLineCore::hintKey() const
void TrainingLineCore::reset()
{
m_referenceLine = "";
m_actualLine = "";
m_referenceLine = QLatin1String("");
m_actualLine = QLatin1String("");
clearKeyHint();
emit referenceLineChanged();
emit actualLineChanged();
......@@ -308,7 +308,7 @@ void TrainingLineCore::add(const QString& text)
}
}
m_actualLine += text.left(maxLength - actualLength);
m_actualLine += text.leftRef(maxLength - actualLength);
emit actualLineChanged();
}
......@@ -346,7 +346,7 @@ void TrainingLineCore::deleteStartOfWord()
void TrainingLineCore::clearActualLine()
{
m_actualLine = "";
m_actualLine = QLatin1String("");
emit actualLineChanged();
}
......
......@@ -48,25 +48,25 @@ CourseEditor::CourseEditor(QWidget* parent):
m_lessonModel->setCourse(m_course);
m_lessonView->setModel(m_lessonModel);
connect(m_course, SIGNAL(titleChanged()), SLOT(updateTitle()));
connect(m_course, SIGNAL(keyboardLayoutNameChanged()), SLOT(updateKeyboardLayoutName()));
connect(m_course, SIGNAL(descriptionChanged()), SLOT(updateDescription()));
connect(m_course, &CourseBase::titleChanged, this, &CourseEditor::updateTitle);
connect(m_course, &CourseBase::keyboardLayoutNameChanged, this, &CourseEditor::updateKeyboardLayoutName);
connect(m_course, &CourseBase::descriptionChanged, this, &CourseEditor::updateDescription);
connect(m_titleLineEdit, SIGNAL(textEdited(QString)), SLOT(setTitle(QString)));
connect(m_titleLineEdit, &QLineEdit::textEdited, this, &CourseEditor::setTitle);
connect(m_keyboardLayoutComboBox, SIGNAL(activated(int)), SLOT(onKeyboardLayoutChosen()));
connect(m_descriptionTextEdit, SIGNAL(textChanged()), SLOT(onDescriptionChanged()));
connect(m_descriptionTextEdit, &QTextEdit::textChanged, this, &CourseEditor::onDescriptionChanged);
connect(m_lessonModel, SIGNAL(lessonChanged(int)), SLOT(selectLesson(int)));
connect(m_lessonView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(onLessonSelected()));
connect(m_lessonModel, &LessonModel::lessonChanged, this, &CourseEditor::selectLesson);
connect(m_lessonView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &CourseEditor::onLessonSelected);
connect(m_addLessonButton, SIGNAL(clicked(bool)), SLOT(addLesson()));
connect(m_removeLessonButton, SIGNAL(clicked(bool)), SLOT(removeLesson()));
connect(m_moveLessonUpButton, SIGNAL(clicked(bool)), SLOT(moveLessonUp()));
connect(m_moveLessonDownButton, SIGNAL(clicked(bool)), SLOT(moveLessonDown()));
connect(m_addLessonButton, &QAbstractButton::clicked, this, &CourseEditor::addLesson);
connect(m_removeLessonButton, &QAbstractButton::clicked, this, &CourseEditor::removeLesson);
connect(m_moveLessonUpButton, &QAbstractButton::clicked, this, &CourseEditor::moveLessonUp);
connect(m_moveLessonDownButton, &QAbstractButton::clicked, this, &CourseEditor::moveLessonDown);
connect(m_lessonTitleLineEdit, SIGNAL(textEdited(QString)), SLOT(setLessonTitle(QString)));
connect(m_newCharactersLineEdit, SIGNAL(textEdited(QString)), SLOT(setLessonNewCharacters(QString)));
connect(m_lessonTextEditor->textEdit(), SIGNAL(textChanged()), SLOT(onLessonTextChanged()));
connect(m_lessonTitleLineEdit, &QLineEdit::textEdited, this, &CourseEditor::setLessonTitle);
connect(m_newCharactersLineEdit, &QLineEdit::textEdited, this, &CourseEditor::setLessonNewCharacters);
connect(m_lessonTextEditor->textEdit(), &QTextEdit::textChanged, this, &CourseEditor::onLessonTextChanged);
}
void CourseEditor::setResourceModel(ResourceModel* model)
......@@ -80,7 +80,7 @@ void CourseEditor::openCourse(DataIndexCourse* dataIndexCourse)
m_dataIndexCourse = dataIndexCourse;
initUndoStack(QString("course-%1").arg(dataIndexCourse->id()));
initUndoStack(QStringLiteral("course-%1").arg(dataIndexCourse->id()));
m_currentLessonIndex = -1;
m_currentLesson = 0;
......@@ -376,10 +376,10 @@ void CourseEditor::onLessonSelected()
m_moveLessonUpButton->setEnabled(!m_readOnly && m_currentLessonIndex > 0);
m_moveLessonDownButton->setEnabled(!m_readOnly && m_currentLessonIndex < m_course->lessonCount() - 1);
connect(m_currentLesson, SIGNAL(titleChanged()), SLOT(updateLessonTitle()));
connect(m_currentLesson, SIGNAL(newCharactersChanged()), SLOT(updateLessonNewCharacters()));
connect(m_currentLesson, SIGNAL(textChanged()), SLOT(updateLessonText()));
connect(m_currentLesson, SIGNAL(charactersChanged()), SLOT(updateLessonCharacters()));
connect(m_currentLesson, &Lesson::titleChanged, this, &CourseEditor::updateLessonTitle);
connect(m_currentLesson, &Lesson::newCharactersChanged, this, &CourseEditor::updateLessonNewCharacters);
connect(m_currentLesson, &Lesson::textChanged, this, &CourseEditor::updateLessonText);
connect(m_currentLesson, &Lesson::charactersChanged, this, &CourseEditor::updateLessonCharacters);
}
else
{
......@@ -387,9 +387,9 @@ void CourseEditor::onLessonSelected()
m_currentLesson = 0;
m_lessonTitleLineEdit->setEnabled(false);
m_lessonTitleLineEdit->setText("");
m_lessonTitleLineEdit->setText(QLatin1String(""));
m_newCharactersLineEdit->setEnabled(false);
m_newCharactersLineEdit->setText("");
m_newCharactersLineEdit->setText(QLatin1String(""));
m_lessonTextEditor->setEnabled(false);
m_lessonTextEditor->textEdit()->clear();
......
......@@ -51,14 +51,14 @@ KeyboardLayoutEditor::KeyboardLayoutEditor(QWidget* parent):
Application::setupDeclarativeBindings(m_view->engine());
m_view->rootContext()->setContextProperty("keyboardLayoutEditor", this);
m_view->setSource(QUrl("qrc:/qml/keyboard/KeyboardLayoutEditor.qml"));
m_view->rootContext()->setContextProperty(QStringLiteral("keyboardLayoutEditor"), this);
m_view->setSource(QUrl(QStringLiteral("qrc:/qml/keyboard/KeyboardLayoutEditor.qml")));
connect(m_newKeyToolButton, SIGNAL(clicked()), SLOT(createNewKey()));
connect(m_newSpecialKeyToolButton, SIGNAL(clicked()), SLOT(createNewSpecialKey()));
connect(m_zoomSlider, SIGNAL(valueChanged(int)), SLOT(setZoomLevel(int)));
connect(m_deleteKeyToolButton, SIGNAL(clicked(bool)), SLOT(deleteSelectedKey()));
connect(m_view, SIGNAL(clicked()), SLOT(clearSelection()));
connect(m_newKeyToolButton, &QAbstractButton::clicked, this, &KeyboardLayoutEditor::createNewKey);
connect(m_newSpecialKeyToolButton, &QAbstractButton::clicked, this, &KeyboardLayoutEditor::createNewSpecialKey);
connect(m_zoomSlider, &QAbstractSlider::valueChanged, this, &KeyboardLayoutEditor::setZoomLevel);
connect(m_deleteKeyToolButton, &QAbstractButton::clicked, this, &KeyboardLayoutEditor::deleteSelectedKey);
connect(m_view, &KeyboardLayoutEditorView::clicked, this, &KeyboardLayoutEditor::clearSelection);
connect(m_zoomOutToolButton, &QToolButton::clicked, [=](){
m_zoomSlider->setValue(m_zoomSlider->value() - 1);
......@@ -87,10 +87,10 @@ void KeyboardLayoutEditor::openKeyboardLayout(DataIndexKeyboardLayout* dataIndex
currentUndoStack()->disconnect(this, SLOT(validateSelection()));
}
initUndoStack(QString("keyboard-layout-%1").arg(dataIndexKeyboardLayout->id()));
initUndoStack(QStringLiteral("keyboard-layout-%1").arg(dataIndexKeyboardLayout->id()));
m_propertiesWidget->setUndoStack(currentUndoStack());
setSelectedKey(0);
connect(currentUndoStack(), SIGNAL(indexChanged(int)), SLOT(validateSelection()));
connect(currentUndoStack(), &QUndoStack::indexChanged, this, &KeyboardLayoutEditor::validateSelection);
m_keyboardLayout->setAssociatedDataIndexKeyboardLayout(m_dataIndexKeyboardLayout);
......
......@@ -47,9 +47,9 @@ KeyboardLayoutPropertiesWidget::KeyboardLayoutPropertiesWidget(QWidget* parent)
m_charactersView->setItemDelegate(m_charactersViewDelegate);
m_charactersView->verticalHeader()->setDefaultSectionSize(m_charactersView->verticalHeader()->minimumSectionSize() + 6);
connect(m_charactersView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(onCharacterSelected()));
connect(m_keyboardLayoutTitleLineEdit, SIGNAL(textEdited(QString)), SLOT(setKeyboardLayoutTitle(QString)));
connect(m_keyboardLayoutNameEdit, SIGNAL(textEdited(QString)), SLOT(setKeyboardLayoutName(QString)));
connect(m_charactersView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &KeyboardLayoutPropertiesWidget::onCharacterSelected);
connect(m_keyboardLayoutTitleLineEdit, &QLineEdit::textEdited, this, &KeyboardLayoutPropertiesWidget::setKeyboardLayoutTitle);
connect(m_keyboardLayoutNameEdit, &QLineEdit::textEdited, this, &KeyboardLayoutPropertiesWidget::setKeyboardLayoutName);
connect(m_keyboardLayoutWidthSpinBox, SIGNAL(valueChanged(int)), SLOT(onKeyboardLayoutWidthChanged(int)));
connect(m_keyboardLayoutHeightSpinBox, SIGNAL(valueChanged(int)), SLOT(onKeyboardLayoutHeightChanged(int)));
connect(m_keyLeftSpinBox, SIGNAL(valueChanged(int)), SLOT(onKeyLeftChanged(int)));
......@@ -57,12 +57,12 @@ KeyboardLayoutPropertiesWidget::KeyboardLayoutPropertiesWidget(QWidget* parent)
connect(m_keyWidthSpinBox, SIGNAL(valueChanged(int)), SLOT(onKeyWidthChanged(int)));
connect(m_keyHeightSpinBox, SIGNAL(valueChanged(int)), SLOT(onKeyHeightChanged(int)));
connect(m_keyFingerComboBox, SIGNAL(currentIndexChanged(int)), SLOT(onFingerIndexChanged(int)));
connect(m_keyHapticMarkerCheckBox, SIGNAL(clicked(bool)), SLOT(setKeyHasHapticMarker(bool)));
connect(m_addCharacterButton, SIGNAL(clicked()), SLOT(addCharacter()));
connect(m_removeCharacterButton, SIGNAL(clicked()), SLOT(removeCharacter()));
connect(m_keyHapticMarkerCheckBox, &QAbstractButton::clicked, this, &KeyboardLayoutPropertiesWidget::setKeyHasHapticMarker);
connect(m_addCharacterButton, &QAbstractButton::clicked, this, &KeyboardLayoutPropertiesWidget::addCharacter);
connect(m_removeCharacterButton, &QAbstractButton::clicked, this, &KeyboardLayoutPropertiesWidget::removeCharacter);
connect(m_specialKeyTypeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(onSpecialKeyTypeChanged(int)));
connect(m_specialKeyLabelLineEdit, SIGNAL(textEdited(QString)), SLOT(setSpecialKeyLabel(QString)));
connect(m_specialKeyModifierIdLineEdit, SIGNAL(textEdited(QString)), SLOT(setSpecialKeyModifierId(QString)));
connect(m_specialKeyLabelLineEdit, &QLineEdit::textEdited, this, &KeyboardLayoutPropertiesWidget::setSpecialKeyLabel);
connect(m_specialKeyModifierIdLineEdit, &QLineEdit::textEdited, this, &KeyboardLayoutPropertiesWidget::setSpecialKeyModifierId);
}
void KeyboardLayoutPropertiesWidget::setKeyboardLayout(KeyboardLayout* layout)
......@@ -77,10 +77,10 @@ void KeyboardLayoutPropertiesWidget::setKeyboardLayout(KeyboardLayout* layout)
m_charactersModel->setKeyboardLayout(layout);
m_charactersViewDelegate->setKeyboardLayout(layout);
connect(m_keyboardLayout, SIGNAL(titleChanged()), SLOT(updateKeyboardLayoutTitle()));
connect(m_keyboardLayout, SIGNAL(nameChanged()), SLOT(updateKeyboardLayoutName()));
connect(m_keyboardLayout, SIGNAL(widthChanged()), SLOT(updateKeyboardLayoutWidth()));
connect(m_keyboardLayout, SIGNAL(heightChanged()), SLOT(updateKeyboardLayoutHeight()));
connect(m_keyboardLayout, &KeyboardLayoutBase::titleChanged, this, &KeyboardLayoutPropertiesWidget::updateKeyboardLayoutTitle);
connect(m_keyboardLayout, &KeyboardLayoutBase::nameChanged, this, &KeyboardLayoutPropertiesWidget::updateKeyboardLayoutName);
connect(m_keyboardLayout, &KeyboardLayout::widthChanged, this, &KeyboardLayoutPropertiesWidget::updateKeyboardLayoutWidth);
connect(m_keyboardLayout, &KeyboardLayout::heightChanged, this, &KeyboardLayoutPropertiesWidget::updateKeyboardLayoutHeight);
}
void KeyboardLayoutPropertiesWidget::setUndoStack(QUndoStack* undoStack)
......@@ -114,10 +114,10 @@ void KeyboardLayoutPropertiesWidget::setSelectedKey(int index)
m_stackedWidget->setCurrentWidget(m_keyProperties);
connect(m_selectedKey, SIGNAL(leftChanged()), SLOT(updateKeyLeft()));
connect(m_selectedKey, SIGNAL(topChanged()), SLOT(updateKeyTop()));
connect(m_selectedKey, SIGNAL(widthChanged()), SLOT(updateKeyWidth()));
connect(m_selectedKey, SIGNAL(heightChanged()), SLOT(updateKeyHeight()));