| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
5
|
|
|
5
|
|
1927072
|
use Renard::Incunabula::Common::Setup; |
|
|
5
|
|
|
|
|
13
|
|
|
|
5
|
|
|
|
|
36
|
|
|
2
|
|
|
|
|
|
|
package Renard::Curie::App; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: A document viewing application |
|
4
|
|
|
|
|
|
|
$Renard::Curie::App::VERSION = '0.003'; |
|
5
|
5
|
|
|
5
|
|
44726
|
use Moo 2.001001; |
|
|
5
|
|
|
|
|
34648
|
|
|
|
5
|
|
|
|
|
80
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
8376
|
use Renard::Incunabula::Frontend::Gtk3::Helper; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use File::Spec; |
|
10
|
|
|
|
|
|
|
use File::Basename; |
|
11
|
|
|
|
|
|
|
use Module::Util qw(:all); |
|
12
|
|
|
|
|
|
|
use Renard::Incunabula::Common::Types qw(InstanceOf Str DocumentModel); |
|
13
|
|
|
|
|
|
|
use Getopt::Long::Descriptive; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use MooX::Role::Logger (); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Renard::Curie::Component::MainWindow; |
|
18
|
|
|
|
|
|
|
use Renard::Curie::ViewModel::ViewManager; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has main_window => ( |
|
21
|
|
|
|
|
|
|
is => 'ro', |
|
22
|
|
|
|
|
|
|
required => 1, |
|
23
|
|
|
|
|
|
|
isa => InstanceOf['Renard::Curie::Component::MainWindow'], |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has view_manager => ( |
|
27
|
|
|
|
|
|
|
is => 'ro', |
|
28
|
|
|
|
|
|
|
required => 1, |
|
29
|
|
|
|
|
|
|
isa => InstanceOf['Renard::Curie::ViewModel::ViewManager'], |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
method process_arguments() { |
|
33
|
|
|
|
|
|
|
my ($opt, $usage) = describe_options( |
|
34
|
|
|
|
|
|
|
"%c %o <filename>", |
|
35
|
|
|
|
|
|
|
[ 'version', "print version and exit" ], |
|
36
|
|
|
|
|
|
|
[ 'short-version', "print just the version number (if exists) and exit" ], |
|
37
|
|
|
|
|
|
|
[ 'help', "print usage message and exit" ], |
|
38
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
print($usage->text), exit if $opt->help; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
if($opt->version) { |
|
43
|
|
|
|
|
|
|
say("Project Renard Curie @{[ _get_version() ]}"); |
|
44
|
|
|
|
|
|
|
say("Distributed under the same terms as Perl 5."); |
|
45
|
|
|
|
|
|
|
exit; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
if($opt->short_version) { |
|
49
|
|
|
|
|
|
|
say(_get_version()), exit |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $pdf_filename = shift @ARGV; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
if( $pdf_filename ) { |
|
55
|
|
|
|
|
|
|
$self->_logger->infof("opening the file %s", $pdf_filename); |
|
56
|
|
|
|
|
|
|
$self->view_manager->open_pdf_document( $pdf_filename ); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
method main() { |
|
61
|
|
|
|
|
|
|
$self = __PACKAGE__->new unless ref $self; |
|
62
|
|
|
|
|
|
|
$self->process_arguments; |
|
63
|
|
|
|
|
|
|
$self->main_window->show_all; |
|
64
|
|
|
|
|
|
|
$self->run; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
method run() { |
|
68
|
|
|
|
|
|
|
$self->_logger->info("starting the Gtk main event loop"); |
|
69
|
|
|
|
|
|
|
Gtk3::main; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
fun _get_version() :ReturnType(Str) { |
|
73
|
|
|
|
|
|
|
return $Renard::Curie::App::VERSION // 'dev' |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
with qw( |
|
77
|
|
|
|
|
|
|
MooX::Role::Logger |
|
78
|
|
|
|
|
|
|
); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=pod |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=encoding UTF-8 |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 NAME |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Renard::Curie::App - A document viewing application |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 VERSION |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
version 0.003 |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 EXTENDS |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over 4 |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * L<Moo::Object> |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=back |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 CONSUMES |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=over 4 |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * L<MooX::Role::Logger> |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=back |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 main |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
fun main() |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Application entry point. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 _get_version |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
fun _get_version() :ReturnType(Str) |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Returns the version of the application if there is one. |
|
125
|
|
|
|
|
|
|
Otherwise returns the C<Str> C<'dev'> to indicate that this is a |
|
126
|
|
|
|
|
|
|
development version. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 main_window |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
The toplevel L<Renard::Curie::Component::MainWindow> component for this application. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 view_manager |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
The view manager model for this application. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 METHODS |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 process_arguments |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
method process_arguments() |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Processes arguments given in C<@ARGV>. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 run |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
method run() |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Displays L</window> and starts the L<Gtk3> event loop. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 AUTHOR |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Project Renard |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Project Renard. |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
161
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |