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 1f6a4342 authored by Laurent Montel's avatar Laurent Montel 😁

Add parent widget

parent 624a44f6
......@@ -39,6 +39,11 @@ GoogleTranslator::~GoogleTranslator()
{
}
void GoogleTranslator::setParentWidget(QWidget *parent)
{
mParentWidget = parent;
}
void GoogleTranslator::setInputText(const QString &text)
{
mInputText = text;
......@@ -213,7 +218,7 @@ void GoogleTranslator::slotTranslateFinished(QNetworkReply *reply)
void GoogleTranslator::debug()
{
#if !defined(NDEBUG)
QPointer<TranslatorDebugDialog> dlg = new TranslatorDebugDialog;
QPointer<TranslatorDebugDialog> dlg = new TranslatorDebugDialog(mParentWidget);
dlg->setDebug(mJsonDebug);
dlg->exec();
delete dlg;
......
......@@ -32,6 +32,8 @@ public:
explicit GoogleTranslator(QObject *parent = nullptr);
~GoogleTranslator();
void setParentWidget(QWidget *parent);
QMap<QString, QMap<QString, QString> > initListLanguage(KComboBox *from);
void translate();
void debug();
......@@ -58,6 +60,7 @@ private:
QString mJsonData;
QString mJsonDebug;
QNetworkAccessManager *mNetworkAccessManager = nullptr;
QWidget *mParentWidget = nullptr;
};
}
......
......@@ -51,9 +51,6 @@ class Q_DECL_HIDDEN TranslatorWidget::TranslatorWidgetPrivate
{
public:
TranslatorWidgetPrivate()
: abstractTranslator(nullptr)
, languageSettingsChanged(false)
, standalone(true)
{
}
......@@ -79,7 +76,7 @@ public:
QPushButton *invert = nullptr;
QSplitter *splitter = nullptr;
bool languageSettingsChanged = false;
bool standalone = false;
bool standalone = true;
};
void TranslatorWidget::TranslatorWidgetPrivate::fillToCombobox(const QString &lang)
......@@ -214,6 +211,7 @@ void TranslatorWidget::readConfig()
void TranslatorWidget::init()
{
d->abstractTranslator = new GoogleTranslator();
d->abstractTranslator->setParentWidget(this);
connect(d->abstractTranslator, &PimCommon::GoogleTranslator::translateDone, this, &TranslatorWidget::slotTranslateDone);
connect(d->abstractTranslator, &PimCommon::GoogleTranslator::translateFailed, this, &TranslatorWidget::slotTranslateFailed);
......
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