[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-frameworks-devel
Subject: Re: Review Request 115485: Porting KTranscript from KJS to QtScript
From: "Alex Merry" <kde () randomguy3 ! me ! uk>
Date: 2014-02-22 13:52:27
Message-ID: 20140222135227.7230.36339 () probe ! kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On Feb. 22, 2014, 1:35 p.m., Chusslove Illich wrote:
> > I tried to run a standalone non-GUI program using ki18n:
> >
> > #include <QDebug>
> > #include <KLocalizedString>
> >
> > int main (int argc, char *argv[])
> > {
> > setlocale (LC_ALL, "");
> > KLocalizedString::setApplicationDomain("test-ki18n-01");
> > qDebug() << i18n("Delete %1?", i18n("file"));
> > return 0;
> > }
> >
> > and got abort with this message:
> >
> > QScriptEngine: Must construct a Q(Core)Application before a QScriptEngine
> >
> > It does work when I add only
> >
> > #include <QCoreApplication>
> > ...
> > QCoreApplication a(argc, argv);
> >
> > What is the reason that this is necessary? If one does want to use ki18n in
> > non-Qt-UI program, would it be inappropriate (in whatever way) to
> > nevertheless require creation of QCoreApplication?
> >
>
> Kevin Krammer wrote:
> QCoreApplication is for non-UI Qt applications, QGuiApplication and its subclass QApplication \
> are the ones for UI programs. I was under the impression that translations always require the \
> presence of a QCoreApplication (or derived) instance. Qt's own tr() does.
And, indeed, there are a lot of other things in QtCore that break if you do not have a \
QCoreApplication instance. In short, if you are making a Qt application (GUI or not), you need \
to create an instance of QCoreApplication (or one of its subclasses).
- Alex
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115485/#review50522
-----------------------------------------------------------
On Feb. 21, 2014, 4:30 p.m., Kevin Krammer wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/115485/
> -----------------------------------------------------------
>
> (Updated Feb. 21, 2014, 4:30 p.m.)
>
>
> Review request for KDE Frameworks and Chusslove Illich.
>
>
> Repository: ki18n
>
>
> Description
> -------
>
> Attempt at replacing the KJS dependency with a QtScript, i.e. making ki18n a tier1 framework.
> Needs more testing and likely fixing
>
>
> Diffs
> -----
>
> CMakeLists.txt 3e099d5
> src/CMakeLists.txt 9e3ce9f
> src/ktranscript.cpp c922e91
>
> Diff: https://git.reviewboard.kde.org/r/115485/diff/
>
>
> Testing
> -------
>
> Unittest runs, but the test script is very minimal and would need to be extendedb by someone \
> who understands the scripting requirements. There is also a weird crash at test shutdown, in \
> QThreadStorage. As far as I can tell I did not change anything related to threads though.
>
> Thanks,
>
> Kevin Krammer
>
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/115485/">https://git.reviewboard.kde.org/r/115485/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On February 22nd, 2014, 1:35 p.m. UTC, <b>Chusslove Illich</b> \
wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; \
white-space: -o-pre-wrap; word-wrap: break-word;">I tried to run a standalone non-GUI program \
using ki18n:
#include <QDebug>
#include <KLocalizedString>
int main (int argc, char *argv[])
{
setlocale (LC_ALL, "");
KLocalizedString::setApplicationDomain("test-ki18n-01");
qDebug() << i18n("Delete %1?", i18n("file"));
return 0;
}
and got abort with this message:
QScriptEngine: Must construct a Q(Core)Application before a QScriptEngine
It does work when I add only
#include <QCoreApplication>
...
QCoreApplication a(argc, argv);
What is the reason that this is necessary? If one does want to use ki18n in
non-Qt-UI program, would it be inappropriate (in whatever way) to
nevertheless require creation of QCoreApplication?
</pre>
</blockquote>
<p>On February 22nd, 2014, 1:47 p.m. UTC, <b>Kevin Krammer</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; \
white-space: -o-pre-wrap; word-wrap: break-word;">QCoreApplication is for non-UI Qt \
applications, QGuiApplication and its subclass QApplication are the ones for UI programs. I was \
under the impression that translations always require the presence of a QCoreApplication (or \
derived) instance. Qt's own tr() does.</pre> </blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; \
white-space: -o-pre-wrap; word-wrap: break-word;">And, indeed, there are a lot of other things \
in QtCore that break if you do not have a QCoreApplication instance. In short, if you are \
making a Qt application (GUI or not), you need to create an instance of QCoreApplication (or \
one of its subclasses).</pre> <br />
<p>- Alex</p>
<br />
<p>On February 21st, 2014, 4:30 p.m. UTC, Kevin Krammer wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: \
url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black solid;"> <tr>
<td>
<div>Review request for KDE Frameworks and Chusslove Illich.</div>
<div>By Kevin Krammer.</div>
<p style="color: grey;"><i>Updated Feb. 21, 2014, 4:30 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
ki18n
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px \
solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Attempt at replacing \
the KJS dependency with a QtScript, i.e. making ki18n a tier1 framework. Needs more testing and \
likely fixing</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid \
#b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Unittest runs, but \
the test script is very minimal and would need to be extendedb by someone who understands the \
scripting requirements. There is also a weird crash at test shutdown, in QThreadStorage. As far \
as I can tell I did not change anything related to threads though.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>CMakeLists.txt <span style="color: grey">(3e099d5)</span></li>
<li>src/CMakeLists.txt <span style="color: grey">(9e3ce9f)</span></li>
<li>src/ktranscript.cpp <span style="color: grey">(c922e91)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/115485/diff/" style="margin-left: 3em;">View \
Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic