Skip to content

Commit eb68d71

Browse files
committed
minor changes
1 parent 0ee5963 commit eb68d71

File tree

4 files changed

+47
-45
lines changed

4 files changed

+47
-45
lines changed

sdk/compactor.pl

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
use File::Basename qw (basename);
1010
use File::Copy;
1111
use File::Spec;
12-
use FindBin qw($Bin);
13-
use File::Spec::Functions qw(catdir);
14-
use lib catdir($Bin, "lib");
12+
use File::Spec::Functions qw (catdir);
13+
use FindBin qw ($Bin);
14+
use lib catdir ($Bin, "lib");
1515

1616
# Non-core CPAN modules:
1717
# File::Copy::Recursive and Module::ScanDeps are loaded from
@@ -23,31 +23,31 @@
2323

2424
# Directory paths:
2525
my $root = getcwd;
26-
my $app_directory = catdir($root, "resources", "app");
27-
my $perl_directory = catdir($root, "perl");
28-
my $bin_original = catdir($perl_directory, "bin");
29-
my $bin_compacted = catdir($perl_directory, "bin-compacted");
30-
my $lib_original = catdir($perl_directory, "lib");
31-
my $lib_compacted = catdir($perl_directory, "lib-compacted");
26+
my $app_directory = catdir ($root, "resources", "app");
27+
my $perl_directory = catdir ($root, "perl");
28+
my $bin_original = catdir ($perl_directory, "bin");
29+
my $bin_compacted = catdir ($perl_directory, "bin-compacted");
30+
my $lib_original = catdir ($perl_directory, "lib");
31+
my $lib_compacted = catdir ($perl_directory, "lib-compacted");
3232

3333
# Copying the Perl interpreter:
3434
if ($Config{osname} !~ "MSWin32") {
35-
fcopy (catdir($bin_original, "perl"), catdir($bin_compacted, "perl"));
35+
fcopy (catdir($bin_original, "perl"), catdir ($bin_compacted, "perl"));
3636
} else {
37-
fcopy (catdir($bin_original, "perl.exe"), catdir($bin_compacted, "perl.exe"));
37+
fcopy (catdir($bin_original, "perl.exe"), catdir ($bin_compacted, "perl.exe"));
3838

39-
my @libraries = traverse_directory($bin_original, ".dll");
39+
my @libraries = traverse_directory ($bin_original, ".dll");
4040
foreach my $library (@libraries) {
41-
my $filename = basename($library, ".dll");
42-
fcopy ($library, catdir($bin_compacted, $filename));
41+
my $filename = basename ($library, ".dll");
42+
fcopy ($library, catdir ($bin_compacted, $filename));
4343
}
4444
}
4545

4646
print "Perl interpreter copied.\n\n";
4747

4848
# Subroutine invocation to
4949
# get recursively all Perl scripts in the 'resources/app' subdirectory:
50-
my @scripts = traverse_directory($app_directory, ".pl");
50+
my @scripts = traverse_directory ($app_directory, ".pl");
5151

5252
# Get all dependencies from all Perl scripts:
5353
my $script_counter;
@@ -56,17 +56,17 @@
5656
print "Script Nr. $script_counter: $script\n";
5757

5858
my $dependencies_hashref =
59-
scan_deps(files => [$script], recurse => 3, compile => 'true');
59+
scan_deps (files => [$script], recurse => 3, compile => 'true');
6060

6161
my $module_counter;
6262
while (my($partial_path, $module_name) = each(%{$dependencies_hashref})) {
6363
foreach my $include_path (@INC) {
64-
my $module_full_path = catdir($include_path, $partial_path);
64+
my $module_full_path = catdir ($include_path, $partial_path);
6565
if (-e $module_full_path) {
6666
$module_counter++;
6767
print "Dependency Nr. $module_counter: $module_full_path";
6868

69-
fcopy ($module_full_path, catdir($lib_compacted, $partial_path));
69+
fcopy ($module_full_path, catdir ($lib_compacted, $partial_path));
7070
print " ... copied.\n";
7171
}
7272
}
@@ -76,11 +76,11 @@
7676
}
7777

7878
# Rename Perl directories:
79-
rename $bin_original, catdir($perl_directory, "bin-original");
80-
rename $bin_compacted, catdir($perl_directory, "bin");
79+
rename $bin_original, catdir ($perl_directory, "bin-original");
80+
rename $bin_compacted, catdir ($perl_directory, "bin");
8181

82-
rename $lib_original, catdir($perl_directory, "lib-original");
83-
rename $lib_compacted, catdir($perl_directory, "lib");
82+
rename $lib_original, catdir ($perl_directory, "lib-original");
83+
rename $lib_compacted, catdir ($perl_directory, "lib");
8484

8585
# Perl scripts recursive lister subroutine:
8686
sub traverse_directory {
@@ -91,7 +91,7 @@ sub traverse_directory {
9191
opendir (my $directory_handle, $entry) or die $!;
9292
while (my $subentry = readdir $directory_handle) {
9393
next if $subentry eq '.' or $subentry eq '..';
94-
my $full_path = catdir($entry, $subentry);
94+
my $full_path = catdir ($entry, $subentry);
9595
if (-f $full_path and $full_path =~ $file_extension) {
9696
push @files, $full_path;
9797
} else {

src/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <QDebug>
3232
#include <QJsonArray>
3333
#include <QTextCodec>
34+
#include <QtWidgets>
3435

3536
#include "main-window.h"
3637
#include "exit-handler.h"

src/page.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,5 @@ QPage::QPage()
136136
QObject::connect(this, SIGNAL(loadFinished(bool)),
137137
this, SLOT(qPageLoadedSlot(bool)));
138138

139-
// Signal and slot for injection of browser-specific JavaScript:
140-
QObject::connect(this, SIGNAL(frameCreated(QWebFrame *)),
141-
this, SLOT(qFrameCustomizerSlot(QWebFrame *)));
142-
143139
windowCloseRequested = false;
144140
}

src/page.h

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@ public slots:
107107
}
108108
}
109109

110-
void qDisplayScriptOutputSlot(QString output, QString stdoutTarget)
110+
void qDisplayScriptOutputSlot(QString output,
111+
QString targetElement)
111112
{
112-
if (stdoutTarget.length() > 0) {
113-
qOutputInserter(output, stdoutTarget);
113+
if (targetElement.length() > 0) {
114+
qOutputInserter(currentFrame(), targetElement, output);
114115
} else {
115116
currentFrame()->setHtml(output,
116117
QUrl(qApp->property("pseudoDomain")
@@ -122,7 +123,7 @@ public slots:
122123
QString scriptAccumulatedErrors,
123124
QString scriptId,
124125
QString scriptFullFilePath,
125-
QString scriptStdoutTarget)
126+
QString scriptTargetElement)
126127
{
127128
runningScripts.remove(scriptId);
128129

@@ -131,13 +132,14 @@ public slots:
131132
// no STDOUT target:
132133
if (scriptAccumulatedOutput.length() > 0 and
133134
scriptAccumulatedErrors.length() == 0 and
134-
scriptStdoutTarget.length() == 0) {
135-
qDisplayScriptOutputSlot(scriptAccumulatedOutput, emptyString);
135+
scriptTargetElement.length() == 0) {
136+
qDisplayScriptOutputSlot(scriptAccumulatedOutput,
137+
emptyString);
136138
}
137139

138140
if (scriptAccumulatedErrors.length() > 0) {
139141
if (scriptAccumulatedOutput.length() == 0) {
140-
if (scriptStdoutTarget.length() == 0) {
142+
if (scriptTargetElement.length() == 0) {
141143
// If script has no output and
142144
// only errors and
143145
// no STDOUT target is defined,
@@ -163,8 +165,8 @@ public slots:
163165
qFormatScriptErrors(scriptAccumulatedErrors,
164166
scriptFullFilePath,
165167
true);
166-
qDisplayScriptOutputSlot(scriptAccumulatedOutput,
167-
emptyString);
168+
qDisplayScriptOutputSlot(emptyString,
169+
scriptAccumulatedOutput);
168170
}
169171
}
170172
}
@@ -174,18 +176,20 @@ public slots:
174176
}
175177
}
176178

177-
void qOutputInserter(QString stdoutData, QString stdoutTarget)
179+
void qOutputInserter(QWebFrame *targetFrame,
180+
QString targetElement,
181+
QString data)
178182
{
179-
qJavaScriptInjector(currentFrame());
183+
qJavaScriptInjector(targetFrame);
180184

181185
QString outputInsertionJavaScript =
182186
"pebOutputInsertion(\"" +
183-
stdoutData +
187+
data +
184188
"\" , \"" +
185-
stdoutTarget +
189+
targetElement +
186190
"\"); null";
187191

188-
currentFrame()->evaluateJavaScript(outputInsertionJavaScript);
192+
targetFrame->evaluateJavaScript(outputInsertionJavaScript);
189193
}
190194

191195
void qFormatScriptErrors(QString errors,
@@ -211,7 +215,8 @@ public slots:
211215
scriptFormattedErrors.replace("ERROR_MESSAGE", scriptError);
212216

213217
if (newWindow == false) {
214-
qDisplayScriptOutputSlot(scriptFormattedErrors, emptyString);
218+
qDisplayScriptOutputSlot(emptyString,
219+
scriptFormattedErrors);
215220
}
216221

217222
if (newWindow == true) {
@@ -382,19 +387,19 @@ public slots:
382387
{
383388
if (mainFrame()->childFrames().length() > 0) {
384389
foreach (QWebFrame *frame, mainFrame()->childFrames()) {
385-
qFrameIterator(frame);
390+
qUserInputFrameIterator(frame);
386391
}
387392
} else {
388393
qCheckUserInputBeforeClose(mainFrame());
389394
}
390395
}
391396

392-
void qFrameIterator(QWebFrame *frame)
397+
void qUserInputFrameIterator(QWebFrame *frame)
393398
{
394399
if (frame->childFrames().length() > 0) {
395400
qCheckUserInputBeforeClose(frame);
396401
foreach (QWebFrame *frame, frame->childFrames()) {
397-
qFrameIterator(frame);
402+
qUserInputFrameIterator(frame);
398403
}
399404
} else {
400405
qCheckUserInputBeforeClose(frame);

0 commit comments

Comments
 (0)