Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
da129b68
Kaydet (Commit)
da129b68
authored
Tem 07, 2015
tarafından
Pranav Kant
Kaydeden (comit)
Miklos Vajna
Tem 28, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lokdocview: Emit load-changed signal showing load progress
Change-Id: I69b4c05d12c0c0b2ca6b7d1ad76ed74cc1f4346a
üst
645f0054
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
13 deletions
+49
-13
gtktiledviewer.cxx
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+17
-0
lokdocview.cxx
libreofficekit/source/gtk/lokdocview.cxx
+32
-13
No files found.
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
Dosyayı görüntüle @
da129b68
...
...
@@ -30,6 +30,7 @@ static int help()
}
static
GtkWidget
*
pDocView
;
static
GtkWidget
*
pStatusBar
;
static
GtkToolItem
*
pEnableEditing
;
static
GtkToolItem
*
pBold
;
static
GtkToolItem
*
pItalic
;
...
...
@@ -286,6 +287,12 @@ static void signalCommand(LOKDocView* /*pLOKDocView*/, char* pPayload, gpointer
}
}
static
void
loadChanged
(
LOKDocView
*
/*pLOKDocView*/
,
gdouble
fValue
,
gpointer
pData
)
{
GtkWidget
*
pProgressBar
=
GTK_WIDGET
(
pData
);
gtk_progress_bar_set_fraction
(
GTK_PROGRESS_BAR
(
pProgressBar
),
fValue
);
}
/// LOKDocView found no search matches -> set the search label accordingly.
static
void
signalSearch
(
LOKDocView
*
/*pLOKDocView*/
,
char
*
/*pPayload*/
,
gpointer
/*pData*/
)
{
...
...
@@ -403,6 +410,8 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo
focusChain
=
g_list_append
(
focusChain
,
pDocView1
);
gtk_container_set_focus_chain
(
GTK_CONTAINER
(
pVBox
),
focusChain
);
gtk_widget_hide
(
pStatusBar
);
}
int
main
(
int
argc
,
char
*
argv
[]
)
...
...
@@ -555,6 +564,7 @@ int main( int argc, char* argv[] )
g_signal_connect
(
pDocView
,
"part-changed"
,
G_CALLBACK
(
signalPart
),
NULL
);
g_signal_connect
(
pDocView
,
"hyperlink-clicked"
,
G_CALLBACK
(
signalHyperlink
),
NULL
);
// Scrolled window for DocView
pScrolledWindow
=
gtk_scrolled_window_new
(
0
,
0
);
gtk_widget_set_hexpand
(
pScrolledWindow
,
TRUE
);
...
...
@@ -563,6 +573,13 @@ int main( int argc, char* argv[] )
gtk_container_add
(
GTK_CONTAINER
(
pScrolledWindow
),
pDocView
);
GtkWidget
*
pProgressBar
=
gtk_progress_bar_new
();
g_signal_connect
(
pDocView
,
"load-changed"
,
G_CALLBACK
(
loadChanged
),
pProgressBar
);
pStatusBar
=
gtk_statusbar_new
();
gtk_container_add
(
GTK_CONTAINER
(
pVBox
),
pStatusBar
);
gtk_container_add
(
GTK_CONTAINER
(
pStatusBar
),
pProgressBar
);
gtk_widget_show_all
(
pWindow
);
// Hide the findbar by default.
gtk_widget_hide
(
pFindbar
);
...
...
libreofficekit/source/gtk/lokdocview.cxx
Dosyayı görüntüle @
da129b68
...
...
@@ -40,7 +40,7 @@ struct _LOKDocViewPrivate
{
gchar
*
m_aLOPath
;
gchar
*
m_aDocPath
;
g
uint
m_nLoadProgress
;
g
double
m_nLoadProgress
;
gboolean
m_bIsLoading
;
gboolean
m_bCanZoomIn
;
gboolean
m_bCanZoomOut
;
...
...
@@ -108,6 +108,7 @@ struct _LOKDocViewPrivate
enum
{
LOAD_CHANGED
,
EDIT_CHANGED
,
COMMAND_CHANGED
,
SEARCH_NOT_FOUND
,
...
...
@@ -341,17 +342,20 @@ globalCallback (gpointer pData)
{
case
LOK_CALLBACK_STATUS_INDICATOR_START
:
{
priv
->
m_nLoadProgress
=
0
;
priv
->
m_nLoadProgress
=
0.0
;
g_signal_emit
(
pCallback
->
m_pDocView
,
doc_view_signals
[
LOAD_CHANGED
],
0
,
0.0
);
}
break
;
case
LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE
:
{
priv
->
m_nLoadProgress
=
std
::
stoi
(
pCallback
->
m_aPayload
);
priv
->
m_nLoadProgress
=
static_cast
<
gdouble
>
(
std
::
stoi
(
pCallback
->
m_aPayload
)
/
100.0
);
g_signal_emit
(
pCallback
->
m_pDocView
,
doc_view_signals
[
LOAD_CHANGED
],
0
,
priv
->
m_nLoadProgress
);
}
break
;
case
LOK_CALLBACK_STATUS_INDICATOR_FINISH
:
{
priv
->
m_nLoadProgress
=
100
;
priv
->
m_nLoadProgress
=
1.0
;
g_signal_emit
(
pCallback
->
m_pDocView
,
doc_view_signals
[
LOAD_CHANGED
],
0
,
1.0
);
}
break
;
default:
...
...
@@ -1069,7 +1073,7 @@ static void lok_doc_view_get_property (GObject* object, guint propId, GValue *va
g_value_set_boolean
(
value
,
priv
->
m_bEdit
);
break
;
case
PROP_LOAD_PROGRESS
:
g_value_set_
uint
(
value
,
priv
->
m_nLoadProgress
);
g_value_set_
double
(
value
,
priv
->
m_nLoadProgress
);
break
;
case
PROP_ZOOM
:
g_value_set_float
(
value
,
priv
->
m_fZoom
);
...
...
@@ -1210,11 +1214,11 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
*/
g_object_class_install_property
(
pGObjectClass
,
PROP_LOAD_PROGRESS
,
g_param_spec_
int
(
"load-progress"
,
"Estimated Load Progress"
,
"Whether the content is in edit mode or not
"
,
0
,
100
,
0
,
G_PARAM_READABLE
));
g_param_spec_
double
(
"load-progress"
,
"Estimated Load Progress"
,
"Shows the progress of the document load operation
"
,
0.0
,
1.0
,
0.
0
,
G_PARAM_READABLE
));
/**
* LOKDocView:zoom-level:
...
...
@@ -1299,6 +1303,21 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
static_cast
<
GParamFlags
>
(
G_PARAM_READABLE
|
G_PARAM_STATIC_STRINGS
)));
/**
* LOKDocView::load-changed:
* @pDocView: the #LOKDocView on which the signal is emitted
* @fLoadProgress: the new progress value
*/
doc_view_signals
[
LOAD_CHANGED
]
=
g_signal_new
(
"load-changed"
,
G_TYPE_FROM_CLASS
(
pGObjectClass
),
G_SIGNAL_RUN_FIRST
,
0
,
NULL
,
NULL
,
g_cclosure_marshal_VOID__DOUBLE
,
G_TYPE_NONE
,
1
,
G_TYPE_DOUBLE
);
/**
* LOKDocView::edit-changed:
* @pDocView: the #LOKDocView on which the signal is emitted
...
...
@@ -1403,16 +1422,16 @@ lok_doc_view_open_document_finish (LOKDocView* pDocView, GAsyncResult* res, GErr
{
GTask
*
task
=
G_TASK
(
res
);
g_return_val_if_fail
(
g_task_is_valid
(
res
,
pDocView
),
NULL
);
g_return_val_if_fail
(
g_task_is_valid
(
res
,
pDocView
),
false
);
//FIXME: make source_tag workx
//g_return_val_if_fail(g_task_get_source_tag(task) == lok_doc_view_open_document, NULL);
g_return_val_if_fail
(
error
==
NULL
||
*
error
==
NULL
,
NULL
);
g_return_val_if_fail
(
error
==
NULL
||
*
error
==
NULL
,
false
);
return
g_task_propagate_boolean
(
task
,
error
);
}
static
void
lok_doc_view_open_document_func
(
GTask
*
task
,
gpointer
source_object
,
gpointer
task_data
,
GCancellable
*
cancellable
)
lok_doc_view_open_document_func
(
GTask
*
task
,
gpointer
source_object
,
gpointer
/*task_data*/
,
GCancellable
*
/*cancellable*/
)
{
LOKDocView
*
pDocView
=
LOK_DOC_VIEW
(
source_object
);
LOKDocViewPrivate
*
priv
=
static_cast
<
LOKDocViewPrivate
*>
(
lok_doc_view_get_instance_private
(
pDocView
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment