Move out Qt webkit related code into separate internal class AlkWebPage
AbandonedPublic

Authored by habacker on Nov 18 2018, 11:00 AM.

Diff Detail

Repository
R471 Alkimia Library
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5824
Build 5842: arc lint + arc unit
habacker requested review of this revision.Nov 18 2018, 11:00 AM
habacker created this revision.
tbaumgart requested changes to this revision.Nov 24 2018, 7:39 PM

Running AlkOnlineQuoteTest fails with a crash.

src/alkonlinequotesource.cpp
330 ↗(On Diff #45716)

It crashes here, because d->m_profile == nullptr.

src/alkonlinequotesprofile.cpp
122 ↗(On Diff #45716)

This creates an AlkOnlineQuoteSource default entry with no profile.

187 ↗(On Diff #45716)

Using this ctor creates an AlkOnlineQuoteSource where d->m_profile is a nullptr.

This revision now requires changes to proceed.Nov 24 2018, 7:39 PM
habacker updated this revision to Diff 46196.Nov 25 2018, 12:56 PM

Qt5 variant

  • fix crash in alkonlinequotetest
  • fix not finding Qt5QuickCompiler

KDE4 variant

  • fix missing libraries on compiling onlinequoteseditor
habacker marked 3 inline comments as done.Nov 25 2018, 12:57 PM
habacker updated this revision to Diff 46672.Dec 2 2018, 9:27 AM
  • Add cmake option for Qt4 builds
  • Add WebPriceQuote related class from KMyMoney
  • Add command line app 'onlinequoteseditor'
  • add todo
  • Add application profile group box
  • Rewrite AlkOnlineQuoteSource
  • Move out AlkFinanceQuoteProcess
  • We need to install the generated ui file
  • Add AlkOnlineQuotesProfile and AlkOnlineQuotesProfileManager
  • Use AlkOnlineQuotesProfile and AlkOnlineQuotesProfileManager in client code
  • Use colored status messages
  • Add page preview and web inspector
  • ui fixup
  • preview fixup
  • profiles manager fixup
  • alkvalue fixup
  • preview fixup
  • add more profiles
  • use wrebkit by default, add '.kio' postfix to use KIO
  • add local knsrc
  • webview fixup
  • fix signal
  • Use external QWebView instance
  • readd missing vertical spacer ibn profile block
  • Refactor mainwindows to use two columns: editor left and browser right
  • fix not exiting AlkOnlineQuote event loop
  • Use AlkOnlineQuotesProfile::Type camel case enum value 'KMyMoney'
  • Fix order of initialization
  • Fix profile selection
  • Set build default to Qt4 for now
  • Load profile only on 'select' button click
  • Removed unused slot
  • Fix online quote test
  • Disable update button on default
  • Do no load specific page by default
  • Move 'select' button to top of profile view
  • Code reformatted using kde-dev-scripts/uncrustify-kf5
  • Add UML design
  • Add qt5 build support
  • Disable show Button for now
  • Fix debug area in class AlkOnlineQuote
  • In native mode show html code in integrated browser
  • Move private implementation of AlkOnlineQuote into Private class
  • Make AlkOnlineQuote::Errors non inlined
  • Add language box
  • crash fix
  • onlinequoteseditor: Only show install button if profile supports GHNS
  • Add copyright
  • Add QDate date format support required by skrooge GHNS files
  • Skrooge GHNS files always require to skip html stripping
  • Initiate profile on dialog load
  • Wrap dynmic values in message with ''
  • Enable skrooge profile to be able to check GHNS support
  • Limit height of quotes list to left debug output more vertical room
  • Add plasma applet example
  • Add configuration settings to plasma applet
  • Fix crash in case webkit widget is not configured
  • Revert launch method to kio by default
  • Only search for GHNS updates in case GHNS profile is used
  • fixup initial fetching and redraw
  • fix warnings
  • fix debug messages
  • Make header constant unique
  • Add profile selection to plasma applet
  • Use the same icon as kmymoney for online quote plasma applet
  • Refactor to always use a profile
  • Fix bug not loading profile in constructor of plasma applet
  • Add KF5 support to plasma applet
  • Removed unused include
  • Add qml test app for alkonlinequote with qt5
  • Add qml plugin for AlkOnlineQuote
  • Add Qt4 support for qml plugin
  • Fix qml plugin test app for Qt4
  • Add copy of foreign currency plasma5 plugin as starting point
  • Replace online quote fetch with Alkimia
  • Fix loading sources from GHNS profile
  • Add GHNS upload support
  • Read knsrc 'targetDir' attribute from file on creating profile
  • Keep applet name in sync with desktop file
  • Add missing cmake file
  • Move skrooge related knsrc file into alkimia name space
  • Do not export AlkOnlineQuotesWidget for now
  • Move internal api from AlkOnlineQuotesWidget into related Private class
  • Readd changing profile by selecting on profile entry
  • Do not export generated file from AlkOnlineQuotesWidget UI
  • Clean build cmake fix
  • Add support to migrate AlkOnlineSource from KMyMoney storage to GHNS storage and vice versa
  • Use redirected knewstuff url to fix not getting new stuff provider.
  • Install all header files in alkimia subdir
  • Compile fix
  • Fix usage of BUILD_QT4=ON in LibAlkimiaConfig.cmake
  • Compile fix
  • Make showing profile list and upload button optional with class AlkOnlineQuotesWidget constructor
  • Do not export privatly used libraries
  • Add translation support
  • Fix crash in qt5 variant of alkonlinequotestest
  • Add missing libraries to Qt4 variant of onlinequoteseditor
  • Add missing Qt5 module for finding qt5 quick compiler
  • Do not depend test cases on Qt 5.11
tbaumgart requested changes to this revision.Dec 2 2018, 9:31 AM

I still have not figured out how the signal/slot stuff works for the private objects, but that is just a matter of time.

src/alkexception.cpp
2 ↗(On Diff #46196)

Same here

src/alkexception.h
2 ↗(On Diff #46196)

It was me who wrote this. This must be a copy/paste problem

src/alkonlinequoteswidget.cpp
99

Why not

profilesGroupBox->setVisible(showProfiles);
101

Why not

profilesGroupBox->setVisible(showUpload);
263

Suggestion for code simplicity

// the next line replaces all of the setEnabled calls in this method
// (except the very last)
detailsGroupBox->setEnabled(item != nullptr);

m_editURL->clear();    // better and faster than  ->setText(QString())
m_editSymbol->clear();
:
:
if(item) {
   :
   m_editURL->setText( ... );
   :
}
m_updateButton->setEnabled(false);
src/alkquotereceiver.h
55 ↗(On Diff #46672)

Why don't you use AlkValue here and encapsulate a double into a new object?

This revision now requires changes to proceed.Dec 2 2018, 9:31 AM
habacker updated this revision to Diff 46675.Dec 2 2018, 10:00 AM
  • Remove obsolate qrc file
  • Fix cmake warning
  • Fix copyright header
  • Simplify widget initialization
  • Use AlkValue instead of AlkMoney
This revision was not accepted when it landed; it landed in state Needs Review.Dec 2 2018, 10:06 AM
This revision was automatically updated to reflect the committed changes.
habacker reopened this revision.Dec 5 2018, 9:50 AM
habacker updated this revision to Diff 46885.Dec 5 2018, 9:53 AM
  • refactor webkit support into separate class
habacker marked 3 inline comments as done.Dec 5 2018, 9:54 AM
tbaumgart requested changes to this revision.Dec 7 2018, 10:26 PM

The testcase somehow fails:

********* Start testing of AlkOnlineQuoteTest *********
Config: Using QtTest library 5.9.4, Qt 5.9.4 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.3.1 20180323 [gcc-7-branch revision 258812])
PASS   : AlkOnlineQuoteTest::initTestCase()
QDEBUG : AlkOnlineQuoteTest::testQuoteSources() using profile "alkimia"
QDEBUG : AlkOnlineQuoteTest::testQuoteSources() ("", "Alkimia Currency")
PASS   : AlkOnlineQuoteTest::testQuoteSources()
QDEBUG : AlkOnlineQuoteTest::testLaunch() using profile "alkimia"
QDEBUG : AlkOnlineQuoteTest::testLaunch() test::AlkQuoteReceiver::slotStatus(  "(Debug) symbol=EUR USD id=EUR USD..."  )
QDEBUG : AlkOnlineQuoteTest::testLaunch() using profile "alkimia"
QDEBUG : AlkOnlineQuoteTest::testLaunch() test::AlkQuoteReceiver::slotError(  "Source <placeholder>KMyMoney Currency</placeholder> does not exist."  )
FAIL!  : AlkOnlineQuoteTest::testLaunch() 'quote.launch("EUR USD", "EUR USD", m_profile->quoteSources().first())' returned FALSE. ()
   Loc: [/home/thb/devel/alkimia/autotests/alkonlinequotetest.cpp(54)]
PASS   : AlkOnlineQuoteTest::cleanupTestCase()
Totals: 3 passed, 1 failed, 0 skipped, 0 blacklisted, 4ms
********* Finished testing of AlkOnlineQuoteTest *********

but I don't know if this is related. Is it the right testcase anyway?

src/alkwebpage.cpp
2

Header with license is missing

24

I would change this to

AlkWebPage::AlkWebPage(QWidget* parent)
  : QWebView(parent)
  , d(new Private)
{
}

and adjust signature in the header file to

AlkWebPage(QWidget* parent = nullptr);
30

Don't you need a

delete d;

here?

55

I would name the parameter enable

58

I would move that into the private class e.g.

d->enableWebInspector(enable, page());

and then

AlkWebPage::Private::enableWebInspector(bool enable, QWebPage* page)
{
  delete inspector;
  inspector = nullptr;
  if (enable) {
    inspector = new QWebInspector();
    inspector->setPage(page);
  }
}

Your solution has a problem if enableWebInspector is called twice in a row with enable true. This would leave a QWebInspector object dangling.

src/alkwebpage.h
1

Header with license is missing

This revision now requires changes to proceed.Dec 7 2018, 10:26 PM
habacker updated this revision to Diff 47095.Dec 8 2018, 11:32 AM
habacker retitled this revision from Add online quote support to Move out Qt webkit related code into separate internal class AlkWebPage.
  • rebased
  • fixed mentioned issue
  • made AlkWebPage an internal class because it is used only in the implementation
habacker marked 4 inline comments as done.Dec 8 2018, 11:35 AM
habacker updated this revision to Diff 47097.Dec 8 2018, 12:29 PM
  • rebased
habacker updated this revision to Diff 47098.Dec 8 2018, 12:35 PM
  • kf5 compile fix
  • indention fixed
tbaumgart requested changes to this revision.Dec 8 2018, 2:54 PM
tbaumgart added inline comments.
src/alkwebpage.cpp
49

In case you have the following user code

enableWebInspector(true);
enableWebInspector(false);

the attribute will not be set to false.

This revision now requires changes to proceed.Dec 8 2018, 2:54 PM
habacker updated this revision to Diff 47121.Dec 8 2018, 4:05 PM

fix crash in alkonlinequotetest

habacker updated this revision to Diff 47124.Dec 8 2018, 4:12 PM
  • fix setting of QWebPage settings relatd to WebInspector
  • rename web inspector enable method to setWebInspectorEnabled() to keep in sync with other getters
  • add getter webInspectorEnabled()
habacker marked 3 inline comments as done.Dec 8 2018, 4:14 PM
habacker abandoned this revision.Dec 10 2018, 3:11 PM