Verified Commit 7da73486 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Remove dead code

This has been commented out for years and QWidgets Plasmoids
do not even exist in KF5 anymore.
parent fa6df3e1
......@@ -44,7 +44,6 @@ find_package(KF5 ${KF5_MIN_VERSION} MODULE REQUIRED COMPONENTS
KCMUtils
XmlGui
Notifications
#Plasma
)
find_package(LibKEduVocDocument)
......@@ -67,13 +66,6 @@ set_package_properties(LibXml2 PROPERTIES
PURPOSE "Required to build HTML export for Parley."
)
#@todo frameworks restore Xattica
# find_package(LibAttica)
# macro_log_feature(LIBATTICA_FOUND "libattica" "A library to access Open Collaboration Service providers" "https://kde.org" FALSE "" "Required to access OCS providers in get hot new stuff.")
# at the end, output the configuration
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config-parley.h.cmake
......@@ -89,9 +81,7 @@ include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR})
set( parley_LINK_LIBS
LibKEduVocDocumentImport__KEduVocDocument
KF5::KrossCore
# KF5::ConfigCore
Qt5::Core
# Qt5::Qml
Qt5::Svg
KF5::I18n
KF5::NewStuff
......@@ -135,15 +125,6 @@ else(X11_Xrender_FOUND)
message(STATUS "X11 Xrender not found, but not required")
endif(X11_Xrender_FOUND)
#define the include libraries for both the parley executable and the autotests
# set( parley_INCLUDE_DIRS
# # ${LIBATTICA_INCLUDE_DIR}
# # libkdeedu/keduvocdocument contains the library for reading and writing vocabulary files
# ${LIBKDEEDU_INCLUDE_DIR}
# )
if(BUILD_TESTING)
add_subdirectory( autotests )
add_subdirectory( tests )
......@@ -160,13 +141,6 @@ if(HAVE_LIBXSLT)
add_subdirectory( xslt )
endif(HAVE_LIBXSLT)
#@todo unused This seems unused delete December 2014
#add_subdirectory( scripts_test )
#@todo frameworks restore/rewrite the plasmoid
#add_subdirectory(plasmoid)
ki18n_install(po)
if (KF5DocTools_FOUND)
kdoctools_install(po)
......
project(plasma-parley)
add_subdirectory( engine )
# include_directories( ${LIBKDEEDU_INCLUDE_DIR} )
set(parley_plasma_SRCS
parley_plasma.cpp
)
ki18n_wrap_ui(parley_plasma_SRCS config.ui)
add_library(plasma_applet_parley ${parley_plasma_SRCS})
target_link_libraries(plasma_applet_parley
Qt5::Widgets
KF5::Completion
KF5::CoreAddons #for KRandomSequence
KF5::Plasma
# KF5::KIOCore
# KF5::KIOWidgets
LibKdeEduImport__KEduVocDocument
#todo frameworks remove KDELibs4Support
KF5::KDELibs4Support
)
install(
TARGETS plasma_applet_parley
DESTINATION ${KDE_INSTALL_PLUGINDIR}
)
install(
FILES plasma_parley.desktop
DESTINATION ${KDE_INSTALL_KSERVICES5DIR}
)
install(
FILES parley_plasma_card.svg
DESTINATION ${KDE_INSTALL_DATADIR}/desktoptheme/default/widgets/
)
Parley plasmoid
-----------------
* Option to configure languages
* Passive learning option - display translation after a certain amount of time (without hovering)
<ui version="4.0" >
<class>config</class>
<widget class="QWidget" name="config" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>460</width>
<height>368</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Vocabulary collection:</string>
</property>
</widget>
</item>
<item>
<widget class="KUrlRequester" name="filechooser" />
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<string>Language Selection</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Top:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Bottom:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="KComboBox" name="language1" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="KComboBox" name="language2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Solution</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3" >
<item>
<widget class="QRadioButton" name="solutionOnHover" >
<property name="text" >
<string>Reveal solution when mouse cursor is over the widget</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="solutionAlways" >
<property name="text" >
<string>Always show the solution</string>
</property>
<property name="checked" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>Update interval:</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="KIntSpinBox" name="updateIntervalSpinBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum" >
<number>1</number>
</property>
<property name="maximum" >
<number>1000</number>
</property>
<property name="value" >
<number>10</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="KPushButton" name="fontSelectButton" >
<property name="text" >
<string>Select Font...</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>440</width>
<height>91</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntSpinBox</class>
<extends>QSpinBox</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
set(parley_engine_SRCS
parley_engine.cpp
)
include_directories( ${LIBKDEEDU_INCLUDE_DIR} )
add_library(plasma_engine_parley ${parley_engine_SRCS})
target_link_libraries(plasma_engine_parley
KF5::Completion
KF5::Plasma
LibKdeEduImport__KEduVocDocument
#todo frameworks remove KDELibs4Support
KF5::KDELibs4Support
)
install(TARGETS plasma_engine_parley DESTINATION ${KDE_INSTALL_PLUGINDIR})
install(FILES plasma-dataengine-parley.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
/*
SPDX-FileCopyrightText: 2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "parley_engine.h"
#include <QStringList>
#include <QDebug>
#include <KConfigGroup>
#include <KEduVocDocument>
#include <KEduVocLesson>
#include <KEduVocExpression>
//@todo frameworks KGlobal
#include <KGlobal>
#include "plasma/datacontainer.h"
ParleyEngine::ParleyEngine(QObject* parent, const QVariantList& args)
: Plasma::DataEngine(parent)
{
Q_UNUSED(args)
KGlobal::locale()->insertCatalog("parley");
setMinimumPollingInterval(1000);
qDebug() << "ParleyEngine::ParleyEngine";
m_random = new KRandomSequence(QDateTime::currentDateTime().toTime_t());
}
ParleyEngine::~ParleyEngine()
{
delete m_random;
}
void ParleyEngine::openDocument(const QString& file)
{
qDebug() << "Open vocabulary file: '" << file << "'";
if (!file.isEmpty()) {
KEduVocDocument *doc = new KEduVocDocument(this);
doc->open(QUrl::fromLocalFile(file));
// check that there is at least one identifier, otherwise this won't work...
if (doc->identifierCount() > 0) {
m_docs.insert(file, doc);
// vocabularyCount = doc->lesson()->entries(KEduVocContainer::Recursive).count();
} else {
delete doc;
}
}
}
QStringList ParleyEngine::sources() const
{
return m_docs.keys();
}
bool ParleyEngine::sourceRequestEvent(const QString &source)
{
if (!m_docs.contains(source)) {
qDebug() << "open file: " << source;
openDocument(source);
}
if (!m_docs.contains(source)) {
qDebug() << "Could not open source file: " << source;
return false;
}
return updateSourceEvent(source);
}
bool ParleyEngine::updateSourceEvent(const QString &source)
{
KEduVocDocument* doc = m_docs.value(source);
if (!doc) {
return false;
}
int vocabularyCount = doc->lesson()->entries(KEduVocContainer::Recursive).count();
if (!vocabularyCount) {
setData(source, QVariant());
return false;
}
ulong current = m_random->getLong(vocabularyCount);
KEduVocExpression *expression = doc->lesson()->entries(KEduVocContainer::Recursive).value(current);
QHash<QString, QVariant> data;
for (int i = 0; i < doc->identifierCount(); i++) {
data[doc->identifier(i).name()] = expression->translation(i)->text();
}
setData(source, data);
return true;
}
/*
SPDX-FileCopyrightText: 2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef PARLEYENGINE_H
#define PARLEYENGINE_H
#include <KCoreAddons/KRandomSequence>
#include "plasma/dataengine.h"
class KEduVocDocument;
class ParleyEngine : public Plasma::DataEngine
{
Q_OBJECT
public:
ParleyEngine(QObject* parent, const QVariantList& args);
~ParleyEngine();
QStringList sources() const;
protected:
bool sourceRequestEvent(const QString& name);
bool updateSourceEvent(const QString& source);
private:
void openDocument(const QString& file);
QHash<QString, KEduVocDocument*> m_docs;
KRandomSequence *m_random;
};
K_EXPORT_PLASMA_DATAENGINE(parley, ParleyEngine)
#endif
[Desktop Entry]
Name=Parley
Name[bg]=Parley
Name[bs]=Parley
Name[ca]=Parley
Name[ca@valencia]=Parley
Name[cs]=Parley
Name[csb]=Parley
Name[da]=Parley
Name[de]=Parley
Name[el]=Parley
Name[en_GB]=Parley
Name[eo]=Parley
Name[es]=Parley
Name[et]=Parley
Name[eu]=Berba egin
Name[fi]=Parley
Name[fr]=Parley
Name[ga]=Parley
Name[gl]=Parley
Name[gu]=પારેલે
Name[he]=Parley
Name[hi]=पारले
Name[hne]=पारले
Name[hr]=Parley
Name[hu]=Parley
Name[ia]=Parley
Name[is]=Parley
Name[it]=Parley
Name[ja]=Parley
Name[kk]=Parley
Name[km]=Parley
Name[ko]=Parley
Name[lt]=Parley
Name[lv]=Parley
Name[ml]=പാര്‍ലി
Name[mr]=पारले
Name[nb]=Parley
Name[nds]=Parley
Name[ne]=पार्ली
Name[nl]=Parley
Name[nn]=Parley
Name[pl]=Parley
Name[pt]=Parley
Name[pt_BR]=Parley
Name[ro]=Parley
Name[ru]=Parley
Name[sk]=Parley
Name[sl]=Parely
Name[sv]=Parley
Name[tr]=Parley
Name[ug]=Parley
Name[uk]=Parley
Name[x-test]=xxParleyxx
Name[zh_CN]=Parley
Name[zh_TW]=語言_Parley
Comment=Vocabulary data for Plasmoids
Comment[bg]=Речникови данни за плазмоиди
Comment[bs]=Rječnički podaci za plazmoide
Comment[ca]=Dades de vocabulari per als plasmoides
Comment[ca@valencia]=Dades de vocabulari per als plasmoides
Comment[cs]=Slovní zásoba pro plasmoidy
Comment[da]=Ordforrådsdata til plasmoider
Comment[de]=Vokabulardaten für Plasmoide
Comment[el]=Δεδομένα λεξιλογίου για πλασμοειδή
Comment[en_GB]=Vocabulary data for Plasmoids
Comment[es]=Datos de vocabulario para los plasmoides
Comment[et]=Sõnavaraandmed plasmoididele
Comment[eu]=Hiztearen datuak plasmoid-eentzako
Comment[fi]=Sanastodata plasmoideille
Comment[fr]=Données de vocabulaire pour les composants graphiques
Comment[ga]=Sonraí Stóir Focal le haghaidh Plasmóidí
Comment[gl]=Datos de vocabulario para Plasmoides
Comment[gu]=પ્લાઝમોઇડ માટે શબ્દયાદી માહિતી
Comment[hne]=प्लाज्माइड्स बर सब्द डाटा
Comment[hu]=Szótárfüzet-plazmoid
Comment[is]=Orðaforðagögn fyrir Plasmadót
Comment[it]=Dati di vocabolari per oggetti di Plasma
Comment[ja]=プラズモイド用の語彙データ
Comment[kk]=Plasmoid-терге арналған сөздік дерегі
Comment[km]=ទិន្នន័យ​វាក្យសព្ទ​សម្រាប់ Plasmoids
Comment[ko]=Plasmoid용 어휘 데이터
Comment[lt]=Žodyno duomenys, skirti plazmoidams
Comment[lv]=Vārdnīcas dati plazmoīdiem
Comment[ml]=പ്ലാസ്മോയിഡ്സിനായുള്ള വാക്പട്ടിക ഡാറ്റ
Comment[mr]=प्लाज्मोइड करिता शब्दावली डेटा
Comment[nb]=Ordlistedata for Plasmoider
Comment[nds]=Vokavel-Daten för Plasma-Lüttprogrammen
Comment[nl]=Woordenschatgegevens voor plasmoids
Comment[nn]=Orddata for plasmoidar
Comment[pl]=Dane słownikowe dla plazmoidów
Comment[pt]=Dados de vocabulário dos Plasmóides
Comment[pt_BR]=Dados de vocabulário para plasmoides
Comment[ro]=Vocabular pentru plasmoizi
Comment[ru]=Словарные данные для плазмоидов
Comment[sk]=Dáta slovnej zásoby pre Plazmoidy
Comment[sl]=Podatki besedišča za Plasmoide
Comment[sv]=Ordförrådsdata för plasmoider
Comment[tr]=Plazmidler için sözcük hazinesi verileri
Comment[ug]=Plasmoids ئۈچۈن سۆزلۈكلەر
Comment[uk]=Словникові дані для Плазмоїдів
Comment[x-test]=xxVocabulary data for Plasmoidsxx
Comment[zh_CN]=Plasmoids 单词数据
Comment[zh_TW]=Plasmoids 字彙資料
X-KDE-ServiceTypes=Plasma/DataEngine
Type=Service
Icon=parley
X-KDE-Library=plasma_engine_parley
X-KDE-PluginInfo-Author=
X-KDE-PluginInfo-Email=
X-KDE-PluginInfo-Name=parley
X-KDE-PluginInfo-Version=
X-KDE-PluginInfo-Website=
X-KDE-PluginInfo-Category=
/*
SPDX-FileCopyrightText: 2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "parley_plasma.h"
//@todo frameworks KDialog -> QDialog
#include <KDialog>
#include <KConfigGroup>
#include <KConfigDialog>
#include <KFontDialog>
#include <KColorDialog>
#include <QDebug>
//@todo frameworks KGlobal
#include <KGlobal>
ParleyPlasma::ParleyPlasma(QObject *parent, const QVariantList &args)
: Plasma::Applet(parent, args),
m_label1(0),
m_label2(0),
m_font(QFont())
{
KGlobal::locale()->insertCatalog("parley");
resize(256, 160);
setHasConfigurationInterface(true);
setAcceptDrops(false);
setAcceptsHoverEvents(true);
setAspectRatioMode(Plasma::KeepAspectRatio);
setBackgroundHints(NoBackground);
m_theme = new Plasma::Svg(this);
m_theme->setImagePath("widgets/parley_plasma_card");
m_theme->setContainsMultipleImages(false);
m_theme->resize(size());
setAssociatedApplication("parley");
}
void ParleyPlasma::init()
{
m_theme->size().height();
configChanged();
m_engine = dataEngine("parley");
m_label1 = new QGraphicsTextItem(this);
m_label2 = new QGraphicsTextItem(this);
m_label1->setPos(m_theme->elementRect("translation1").topLeft());
m_label2->setPos(m_theme->elementRect("translation2").topLeft());
m_label1->setFont(m_font);
m_label2->setFont(m_font);
m_engine->connectSource(m_sourceFile.toLocalFile(), this, m_updateInterval);
}
void ParleyPlasma::configChanged()