diff --git a/CMakeLists.txt b/CMakeLists.txt index 658db2b..340eafd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,108 +1,108 @@ project(kimagemapeditor) cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR) set (QT_MIN_VERSION "5.7.0") set (KF5_MIN_VERSION "5.15.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) add_compile_definitions(QURL_NO_CAST_FROM_STRING) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Gui Widgets + WebEngineWidgets ) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Config ConfigWidgets CoreAddons Crash DBusAddons DocTools GuiAddons IconThemes - KHtml Parts I18n WidgetsAddons XmlGui ) include(FeatureSummary) include(ECMInstallIcons) include(KDEInstallDirs) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(ECMOptionalAddSubdirectory) include(ECMQtDeclareLoggingCategory) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ) add_subdirectory( pics ) ecm_optional_add_subdirectory(doc) set(libkimagemapeditorcommon_SRC areacreator.cpp kimearea.cpp kimecommands.cpp kimedialogs.cpp kimagemapeditor.cpp drawzone.cpp arealistview.cpp imageslistview.cpp mapslistview.cpp imagemapchoosedialog.cpp ) qt5_add_resources(libkimagemapeditorcommon_SRC kimagemapeditor.qrc) ecm_qt_declare_logging_category(libkimagemapeditorcommon_SRC HEADER kimagemapeditor_debug.h IDENTIFIER KIMAGEMAPEDITOR_LOG CATEGORY_NAME org.kde.kimagemapeditor DEFAULT_SEVERITY Warning ) ########### next target ############### set(kimagemapeditor_bin_SRCS main.cpp kimeshell.cpp ${libkimagemapeditorcommon_SRC}) add_executable(kimagemapeditor_bin ${kimagemapeditor_bin_SRCS}) set_target_properties(kimagemapeditor_bin PROPERTIES OUTPUT_NAME kimagemapeditor) -target_link_libraries(kimagemapeditor_bin KF5::KHtml KF5::IconThemes) +target_link_libraries(kimagemapeditor_bin KF5::CoreAddons KF5::I18n KF5::ConfigCore KF5::IconThemes KF5::Parts Qt5::WebEngineWidgets) install(TARGETS kimagemapeditor_bin ${INSTALL_TARGETS_DEFAULT_ARGS} ) ########### next target ############### set(kimagemapeditor_PART_SRCS ${libkimagemapeditorcommon_SRC}) add_library(kimagemapeditor MODULE ${kimagemapeditor_PART_SRCS}) -target_link_libraries(kimagemapeditor KF5::KHtml KF5::IconThemes) +target_link_libraries(kimagemapeditor KF5::CoreAddons KF5::IconThemes KF5::I18n KF5::ConfigCore KF5::Parts Qt5::WebEngineWidgets) install(TARGETS kimagemapeditor DESTINATION ${PLUGIN_INSTALL_DIR}) ########### next target ############### ########### install files ############### install( FILES org.kde.kimagemapeditor.desktop DESTINATION ${KDE_INSTALL_APPDIR}) install( FILES org.kde.kimagemapeditor.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) install( FILES kimagemapeditorpart.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) if (NOT ECM_VERSION VERSION_LESS "5.59.0") install( FILES kimagemapeditor.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR} ) else() install( FILES kimagemapeditor.categories DESTINATION ${KDE_INSTALL_CONFDIR} ) endif() feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/kimedialogs.cpp b/kimedialogs.cpp index 20fecb2..5f87f3c 100644 --- a/kimedialogs.cpp +++ b/kimedialogs.cpp @@ -1,635 +1,632 @@ /*************************************************************************** kimedialogs.cpp - description ------------------- begin : Tue Apr 17 2001 copyright : (C) 2001 by Jan Schäfer email : j_schaef@informatik.uni-kl.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ // LOCAL #include "kimedialogs.h" // Qt #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // KDE Frameworks #include "kimagemapeditor_debug.h" #include -#include -#include #include #include #include CoordsEdit::CoordsEdit(QWidget *parent, Area* a) : QWidget(parent) { area=a; } void CoordsEdit::applyChanges() { return; } void CoordsEdit::slotTriggerUpdate() { applyChanges(); emit update(); } CoordsEdit::~CoordsEdit() { } RectCoordsEdit::RectCoordsEdit(QWidget *parent, Area* a) : CoordsEdit(parent,a) { QFormLayout *layout= new QFormLayout(this); topXSpin = new QSpinBox(this); topXSpin->setMaximum(INT_MAX); topXSpin->setMinimum(0); topXSpin->setValue(a->rect().left()); connect( topXSpin, SIGNAL(valueChanged(QString)), this, SLOT(slotTriggerUpdate())); layout->addRow(i18n("Top &X:"), topXSpin); topYSpin = new QSpinBox(this); topYSpin->setMaximum(INT_MAX); topYSpin->setMinimum(0); topYSpin->setValue(a->rect().top()); connect( topYSpin, SIGNAL(valueChanged(QString)), this, SLOT(slotTriggerUpdate())); layout->addRow(i18n("Top &Y:"), topYSpin); widthSpin = new QSpinBox(this); widthSpin->setMaximum(INT_MAX); widthSpin->setMinimum(0); widthSpin->setValue(a->rect().width()); connect( widthSpin, SIGNAL(valueChanged(QString)), this, SLOT(slotTriggerUpdate())); layout->addRow(i18n("&Width:"), widthSpin); heightSpin = new QSpinBox(this); heightSpin->setMaximum(INT_MAX); heightSpin->setMinimum(0); heightSpin->setValue(a->rect().height()); connect( heightSpin, SIGNAL(valueChanged(QString)), this, SLOT(slotTriggerUpdate())); layout->addRow(i18n("Hei&ght:"), heightSpin); } void RectCoordsEdit::applyChanges() { QRect r; r.setLeft(topXSpin->text().toInt()); r.setTop(topYSpin->text().toInt()); r.setWidth(widthSpin->text().toInt()); r.setHeight(heightSpin->text().toInt()); area->setRect(r); } CircleCoordsEdit::CircleCoordsEdit(QWidget *parent, Area* a) : CoordsEdit(parent,a) { QFormLayout *layout = new QFormLayout(this); centerXSpin = new QSpinBox(this); centerXSpin->setMaximum(INT_MAX); centerXSpin->setMinimum(0); centerXSpin->setValue(a->rect().center().x()); connect( centerXSpin, SIGNAL(valueChanged(QString)), this, SLOT(slotTriggerUpdate())); layout->addRow(i18n("Center &X:"), centerXSpin); centerYSpin = new QSpinBox(this); centerYSpin->setMaximum(INT_MAX); centerYSpin->setMinimum(0); centerYSpin->setValue(a->rect().center().y()); connect( centerYSpin, SIGNAL(valueChanged(QString)), this, SLOT(slotTriggerUpdate())); layout->addRow(i18n("Center &Y:"), centerYSpin); radiusSpin = new QSpinBox(this); radiusSpin->setMaximum(INT_MAX); radiusSpin->setMinimum(0); radiusSpin->setValue(a->rect().width()/2); connect( radiusSpin, SIGNAL(valueChanged(QString)), this, SLOT(slotTriggerUpdate())); layout->addRow(i18n("&Radius:"), radiusSpin); } void CircleCoordsEdit::applyChanges() { QRect r; r.setWidth(radiusSpin->text().toInt()*2); r.setHeight(radiusSpin->text().toInt()*2); r.moveCenter(QPoint(centerXSpin->text().toInt(), centerYSpin->text().toInt())); area->setRect(r); } PolyCoordsEdit::PolyCoordsEdit(QWidget *parent, Area* a) : CoordsEdit(parent,a) { if (!a) return; QVBoxLayout *layout = new QVBoxLayout(this); coordsTable = new QTableWidget(0, 2); coordsTable->verticalHeader()->hide(); coordsTable->setSelectionMode( QTableWidget::SingleSelection ); connect( coordsTable, SIGNAL(currentChanged(int,int)), this, SLOT(slotHighlightPoint(int))); updatePoints(); // coordsTable->setMinimumHeight(50); // coordsTable->setMaximumHeight(400); // coordsTable->resizeContents(100,100); coordsTable->resize(coordsTable->width(), 100); layout->addWidget(coordsTable); layout->setStretchFactor(coordsTable, -1); QHBoxLayout *hbox = new QHBoxLayout; QPushButton *addBtn = new QPushButton(i18n("Add")); hbox->addWidget(addBtn); connect( addBtn, SIGNAL(pressed()), this, SLOT(slotAddPoint())); QPushButton *removeBtn = new QPushButton(i18n("Remove")); hbox->addWidget(removeBtn); connect( removeBtn, SIGNAL(pressed()), this, SLOT(slotRemovePoint())); layout->addLayout(hbox); slotHighlightPoint(1); } PolyCoordsEdit::~PolyCoordsEdit() { } void PolyCoordsEdit::slotHighlightPoint(int row) { if (!area) return; area->highlightSelectionPoint(row); emit update(); } void PolyCoordsEdit::updatePoints() { coordsTable->clear(); int count=area->coords().size(); coordsTable->setHorizontalHeaderLabels(QStringList() << "X" << "Y"); coordsTable->setRowCount(count); for (int i=0;isetItem(i,0, new QTableWidgetItem(QString::number(area->coords().point(i).x()) )); coordsTable->setItem(i,1, new QTableWidgetItem(QString::number(area->coords().point(i).y()) )); } emit update(); } void PolyCoordsEdit::slotAddPoint() { int newPos= coordsTable->currentRow(); if (newPos < 0 || newPos >= area->coords().size()) newPos = area->coords().size(); QPoint currentPoint=area->coords().point(newPos); area->insertCoord(newPos,currentPoint); updatePoints(); } void PolyCoordsEdit::slotRemovePoint() { int currentPos= coordsTable->currentRow(); if (currentPos < 0 || currentPos >= area->coords().size()) return; area->removeCoord(currentPos); updatePoints(); } void PolyCoordsEdit::applyChanges() { int count=coordsTable->rowCount(); for (int i=0;iitem(i,0)->text().toInt(), coordsTable->item(i,1)->text().toInt()); area->moveCoord(i,newPoint); } } SelectionCoordsEdit::SelectionCoordsEdit(QWidget *parent, Area* a) : CoordsEdit(parent,a) { QFormLayout *layout = new QFormLayout(this); topXSpin = new QSpinBox(this); topXSpin->setMaximum(INT_MAX); topXSpin->setMinimum(0); topXSpin->setValue(a->rect().left()); connect( topXSpin, SIGNAL(valueChanged(QString)), this, SLOT(slotTriggerUpdate())); layout->addRow(i18n("Top &X"), topXSpin); topYSpin = new QSpinBox(this); topYSpin->setMaximum(INT_MAX); topYSpin->setMinimum(0); topYSpin->setValue(a->rect().top()); connect( topYSpin, SIGNAL(valueChanged(QString)), this, SLOT(slotTriggerUpdate())); layout->addRow(i18n("Top &Y"), topYSpin); } void SelectionCoordsEdit::applyChanges() { area->moveTo(topXSpin->text().toInt(), topYSpin->text().toInt()); } QLineEdit* AreaDialog::createLineEdit(QFormLayout *layout, const QString &value, const QString &name) { QLineEdit *edit = new QLineEdit(value); layout->addRow(name, edit); return edit; } QWidget* AreaDialog::createGeneralPage() { QFrame *page = new QFrame(this); QFormLayout *layout = new QFormLayout(page); // A separate widget, not just a layout, is needed so that // the accelerator for the row is working QWidget *hbox = new QWidget; QHBoxLayout *hboxLayout = new QHBoxLayout(hbox); hboxLayout->setMargin(0); hrefEdit = new QLineEdit(area->attribute("href")); hboxLayout->addWidget(hrefEdit); QPushButton *btn = new QPushButton; btn->setIcon(SmallIcon("document-open")); connect( btn, SIGNAL(pressed()), this, SLOT(slotChooseHref())); hboxLayout->addWidget(btn); QLabel *lblHREF = new QLabel(i18n("&HREF:")); lblHREF->setBuddy(hrefEdit); layout->addRow(lblHREF, hbox); altEdit = createLineEdit(layout, area->attribute("alt"), i18n("Alt. &Text:")); targetEdit = createLineEdit(layout, area->attribute("target"), i18n("Tar&get:")); titleEdit = createLineEdit(layout, area->attribute("title"), i18n("Tit&le:")); if (area->type() == Area::Default) { defaultAreaChk = new QCheckBox(i18n("On")); if (area->finished()) { defaultAreaChk->setChecked(true); } layout->addRow(i18n("Enable default map"), defaultAreaChk); } return page; } QWidget* AreaDialog::createCoordsPage() { QFrame* page = new QFrame(this); QVBoxLayout *layout = new QVBoxLayout(page); layout->setMargin(5); coordsEdit = createCoordsEdit(page, area); layout->addWidget(coordsEdit); connect( coordsEdit, SIGNAL(update()), this, SLOT(slotUpdateArea())); return page; } QWidget* AreaDialog::createJavascriptPage() { QFrame *page = new QFrame(this); QFormLayout *layout = new QFormLayout(page); onClickEdit = createLineEdit(layout, area->attribute("onClick"), i18n("OnClick:")); onDblClickEdit = createLineEdit(layout, area->attribute("onDblClick"), i18n("OnDblClick:")); onMouseDownEdit = createLineEdit(layout, area->attribute("onMouseDown"), i18n("OnMouseDown:")); onMouseUpEdit = createLineEdit(layout, area->attribute("onMouseUp"), i18n("OnMouseUp:")); onMouseOverEdit = createLineEdit(layout, area->attribute("onMouseOver"), i18n("OnMouseOver:")); onMouseMoveEdit = createLineEdit(layout, area->attribute("onMouseMove"), i18n("OnMouseMove:")); onMouseOutEdit = createLineEdit(layout, area->attribute("onMouseOut"), i18n("OnMouseOut:")); return page; } AreaDialog::AreaDialog(KImageMapEditor* parent, Area* a) : QDialog(parent->widget()) { setWindowTitle(i18n("Area Tag Editor")); // setFaceType( KPageDialog::Tabbed ); setObjectName( "Area Tag Editor" ); setModal(true); _document = parent; if (!a) { slotCancel(); return; } area = a; QString shape("Default"); areaCopy = a->clone(); oldArea = new Area(); oldArea->setRect( a->rect() ); switch (a->type()) { case Area::Rectangle: shape = i18n("Rectangle"); break; case Area::Circle: shape = i18n("Circle"); break; case Area::Polygon: shape = i18n("Polygon"); break; case Area::Selection: shape = i18n("Selection"); break; default: break; } QVBoxLayout *layout = new QVBoxLayout(this); // To get a margin around everything layout->setMargin(5); QLabel *lbl = new QLabel(""+shape+""); lbl->setTextFormat(Qt::RichText); layout->addWidget(lbl); QFrame *line = new QFrame; line->setFrameStyle(QFrame::HLine | QFrame::Sunken); line->setFixedHeight(10); layout->addWidget(line); QTabWidget *tab = new QTabWidget; tab->addTab(createGeneralPage(), i18n("&General")); layout->addWidget(tab); if (a->type() == Area::Default) { // FIXME? Why this useless assignment? shape = i18n("Default"); } else { tab->addTab(createCoordsPage(), i18n("Coor&dinates")); } tab->addTab(createJavascriptPage(), i18n("&JavaScript")); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); layout->addWidget(buttonBox); connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotOk())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotCancel())); connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(slotApply())); setMinimumHeight(360); setMinimumWidth(327); resize(327,360); } AreaDialog::~AreaDialog() { delete areaCopy; delete oldArea; } CoordsEdit* AreaDialog::createCoordsEdit(QWidget *parent, Area *a) { if (!a) return 0; switch (a->type()) { case Area::Rectangle : return new RectCoordsEdit(parent,a); break; case Area::Circle : return new CircleCoordsEdit(parent,a); break; case Area::Polygon : return new PolyCoordsEdit(parent,a); break; case Area::Selection : return new SelectionCoordsEdit(parent,a); break; case Area::Default : return new CoordsEdit(parent,a); break; default : return new CoordsEdit(parent,a);break; } } void AreaDialog::slotChooseHref() { QUrl url = QFileDialog::getOpenFileUrl(this, i18n("Choose File"), QUrl(), i18n("All Files (*)")); if (!url.isEmpty()) { hrefEdit->setText(url.url()); } } void AreaDialog::slotOk() { if (area) { area->highlightSelectionPoint(-1); if (area->type()==Area::Default) area->setFinished(defaultAreaChk->isChecked()); } slotApply(); accept(); } void AreaDialog::slotApply() { if (area) { if (area->type()!=Area::Default) coordsEdit->applyChanges(); area->setAttribute("href",hrefEdit->text()); area->setAttribute("alt",altEdit->text()); area->setAttribute("target",targetEdit->text()); area->setAttribute("title",titleEdit->text()); area->setAttribute("onclick",onClickEdit->text()); area->setAttribute("ondblclick",onDblClickEdit->text()); area->setAttribute("onmousedown",onMouseDownEdit->text()); area->setAttribute("onmouseup",onMouseUpEdit->text()); area->setAttribute("onmousemove",onMouseMoveEdit->text()); area->setAttribute("onmouseover",onMouseOverEdit->text()); area->setAttribute("onmouseout",onMouseOutEdit->text()); // redraw old area to get rid of it emit areaChanged(oldArea); // draw new area emit areaChanged(area); oldArea->setRect(area->rect()); } } void AreaDialog::slotCancel() { if (area) { AreaSelection *selection=0L; if ( (selection=dynamic_cast(areaCopy)) ) area->setArea(*selection); else area->setArea(*areaCopy); area->highlightSelectionPoint(-1); emit areaChanged(oldArea); emit areaChanged(area); } reject(); } void AreaDialog::slotUpdateArea() { emit areaChanged(oldArea); // draw new area emit areaChanged(area); oldArea->setRect(area->rect()); } PreferencesDialog::PreferencesDialog(QWidget *parent, KConfig* conf) : QDialog(parent) { config = conf; setWindowTitle(i18n("Preferences")); setModal(true); QVBoxLayout *mainLayout = new QVBoxLayout(this); QFormLayout *optionsLayout = new QFormLayout; mainLayout->addLayout(optionsLayout); rowHeightSpinBox = new QSpinBox; int maxPrevHeight = config->group("Appearance").readEntry("maximum-preview-height",50); rowHeightSpinBox->setMaximum(1000); rowHeightSpinBox->setMinimum(15); rowHeightSpinBox->setFixedWidth(60); rowHeightSpinBox->setValue(maxPrevHeight); optionsLayout->addRow(i18n("&Maximum image preview height:"), rowHeightSpinBox); KConfigGroup general = config->group("General"); undoSpinBox = new QSpinBox; undoSpinBox->setFixedWidth(60); undoSpinBox->setMaximum(100); undoSpinBox->setMinimum(1); undoSpinBox->setValue(general.readEntry("undo-level",20)); optionsLayout->addRow(i18n("&Undo limit:"), undoSpinBox); redoSpinBox = new QSpinBox; redoSpinBox->setFixedWidth(60); redoSpinBox->setMaximum(100); redoSpinBox->setMinimum(1); redoSpinBox->setValue(general.readEntry("redo-level",20)); optionsLayout->addRow(i18n("&Redo limit:"), redoSpinBox); startWithCheck = new QCheckBox(i18n("On")); startWithCheck->setChecked(general.readEntry("start-with-last-used-document",true)); optionsLayout->addRow(i18n("&Start with last used document"), startWithCheck); /* colorizeAreaChk = new QCheckBox(i18n("On")); colorizeAreaChk->setFixedWidth(60); colorizeAreaChk->setChecked(KSharedConfig::openConfig()->readEntry("highlightareas",true)); optionsLayout->addRow(i18n("Highlight Areas"), colorizeAreaChk); showAltChk = new QCheckBox(i18n("On")); showAltChk->setFixedWidth(60); showAltChk->setChecked(KSharedConfig::openConfig()->readEntry("showalt",true)); optionsLayout->addRow(i18n("Show alternative text"), showAltChk); */ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply); mainLayout->addWidget(buttonBox); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotOk())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(buttonBox->button(QDialogButtonBox::Apply),SIGNAL(clicked()),this,SLOT(slotApply())); } PreferencesDialog::~PreferencesDialog() { } void PreferencesDialog::slotDefault( void ) { rowHeightSpinBox->setValue(50); } void PreferencesDialog::slotOk( void ) { slotApply(); accept(); } void PreferencesDialog::slotApply( void ) { KConfigGroup group = config->group("Appearance"); group.writeEntry("maximum-preview-height",rowHeightSpinBox->cleanText().toInt()); group = config->group("General Options"); group.writeEntry("undo-level",undoSpinBox->cleanText().toInt()); group.writeEntry("redo-level",redoSpinBox->cleanText().toInt()); group.writeEntry("start-with-last-used-document", startWithCheck->isChecked()); config->sync(); emit preferencesChanged(); } HTMLPreviewDialog::HTMLPreviewDialog(QWidget* parent, const QString & htmlCode) : QDialog(parent) { tempFile = new QTemporaryFile(QDir::tempPath() + QLatin1String("/kime_preview_XXXXXX.html")); tempFile->open(); setWindowTitle(i18n("Preview")); setModal(true); QTextStream stream(tempFile); stream << htmlCode; qCDebug(KIMAGEMAPEDITOR_LOG) << "HTMLPreviewDialog: TempFile : " << tempFile->fileName(); stream.flush(); QVBoxLayout *mainLayout = new QVBoxLayout(this); - htmlPart = new KHTMLPart; - mainLayout->addWidget(htmlPart->widget()); + htmlPart = new QWebEngineView; + mainLayout->addWidget(htmlPart); // htmlView = new KHTMLView(htmlPart, page); // mainLayout->addWidget(htmlView); // htmlView->setVScrollBarMode(QScrollView::Auto); // htmlView->setHScrollBarMode(QScrollView::Auto); // dialog->resize(dialog->calculateSize(edit->maxLineWidth(),edit->numLines()*)); // dialog->adjustSize(); - htmlPart->openUrl(QUrl::fromLocalFile(tempFile->fileName())); + htmlPart->load(QUrl::fromLocalFile(tempFile->fileName())); QLabel *lbl = new QLabel; lbl->setObjectName( "urllabel" ); mainLayout->addWidget(lbl); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); mainLayout->addWidget(buttonBox); - connect( htmlPart, SIGNAL(onURL(QString)), lbl, SLOT(setText(QString))); + connect( htmlPart->page(), &QWebEnginePage::linkHovered, lbl, &QLabel::setText); resize(800,600); } HTMLPreviewDialog::~HTMLPreviewDialog() { delete tempFile; - delete htmlPart; } diff --git a/kimedialogs.h b/kimedialogs.h index 760485d..1b82281 100644 --- a/kimedialogs.h +++ b/kimedialogs.h @@ -1,180 +1,181 @@ /*************************************************************************** kimedialogs.h - description ------------------- begin : Tue Apr 17 2001 copyright : (C) 2001 by Jan Schäfer email : janschaefer@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef KIMEDIALOGS_H #define KIMEDIALOGS_H #include #include #include #include +#include #include "kimagemapeditor.h" class QLineEdit; class QSpinBox; class CoordsEdit : public QWidget { Q_OBJECT public : CoordsEdit(QWidget *parent, Area* a); virtual ~CoordsEdit(); virtual void applyChanges(); protected: Area *area; // The working area protected slots: void slotTriggerUpdate(); signals: void update(); }; class RectCoordsEdit : public CoordsEdit { public: RectCoordsEdit(QWidget *parent, Area* a); virtual void applyChanges(); private: QSpinBox *topXSpin; QSpinBox *topYSpin; QSpinBox *widthSpin; QSpinBox *heightSpin; }; class CircleCoordsEdit : public CoordsEdit { public: CircleCoordsEdit(QWidget *parent, Area* a); virtual void applyChanges(); private: QSpinBox *centerXSpin; QSpinBox *centerYSpin; QSpinBox *radiusSpin; }; class QTableWidget; class PolyCoordsEdit : public CoordsEdit { Q_OBJECT public: PolyCoordsEdit(QWidget *parent, Area* a); ~PolyCoordsEdit(); virtual void applyChanges(); private: QTableWidget *coordsTable; void updatePoints(); protected slots: void slotAddPoint(); void slotRemovePoint(); void slotHighlightPoint(int); }; class SelectionCoordsEdit : public CoordsEdit { Q_OBJECT public: SelectionCoordsEdit(QWidget *parent, Area* a); virtual void applyChanges(); private: QSpinBox *topXSpin; QSpinBox *topYSpin; }; class QCheckBox; class AreaDialog : public QDialog { Q_OBJECT private: Area *area; Area *oldArea; // Only for drawing reasons Area *areaCopy; // A copy for restoring the original area if user press cancel QLineEdit *hrefEdit; QLineEdit *altEdit; QLineEdit *targetEdit; QLineEdit *titleEdit; QLineEdit *onClickEdit; QLineEdit *onDblClickEdit; QLineEdit *onMouseDownEdit; QLineEdit *onMouseUpEdit; QLineEdit *onMouseOverEdit; QLineEdit *onMouseMoveEdit; QLineEdit *onMouseOutEdit; CoordsEdit *coordsEdit; CoordsEdit* createCoordsEdit(QWidget *parent, Area *a); QCheckBox *defaultAreaChk; KImageMapEditor *_document; public: AreaDialog(KImageMapEditor* parent,Area * a); ~AreaDialog(); protected slots: virtual void slotOk(); virtual void slotApply(); virtual void slotCancel(); void slotChooseHref(); void slotUpdateArea(); QLineEdit* createLineEdit(QFormLayout *layout, const QString &value, const QString &name); QWidget* createGeneralPage(); QWidget* createCoordsPage(); QWidget* createJavascriptPage(); signals: void areaChanged(Area* a); }; class KConfig; class PreferencesDialog : public QDialog { Q_OBJECT public: PreferencesDialog(QWidget *parent,KConfig*); ~PreferencesDialog(); protected slots: virtual void slotDefault( void ); virtual void slotOk( void ); virtual void slotApply( void ); private: QSpinBox *rowHeightSpinBox; QSpinBox *undoSpinBox; QSpinBox *redoSpinBox; // QCheckBox *colorizeAreaChk; // QCheckBox *showAltChk; QCheckBox *startWithCheck; KConfig *config; signals: void preferencesChanged(); }; class KHTMLPart; class QTemporaryFile; class HTMLPreviewDialog : public QDialog{ public: HTMLPreviewDialog(QWidget *, const QString &); ~HTMLPreviewDialog(); private: - KHTMLPart* htmlPart; + QWebEngineView* htmlPart; QTemporaryFile* tempFile; }; #endif