help: Add an about EDI screen.
Refactor code a little to help organise these support screens
This commit is contained in:
parent
9d513c2ed5
commit
d648b31713
|
@ -7,6 +7,7 @@ AM_CPPFLAGS = \
|
|||
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
|
||||
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
|
||||
-DPACKAGE_DOC_DIR=\"$(docdir)\" \
|
||||
-DLOCALEDIR=\"$(datadir)/locale\" \
|
||||
-I$(top_srcdir)/src/lib \
|
||||
-I$(top_srcdir)/src/bin \
|
||||
|
@ -19,7 +20,7 @@ noinst_HEADERS = \
|
|||
edi_config.h \
|
||||
editor/edi_editor.h \
|
||||
edi_content_provider.h \
|
||||
welcome/edi_welcome.h \
|
||||
screens/edi_screens.h \
|
||||
edi_filepanel.h \
|
||||
edi_logpanel.h \
|
||||
edi_consolepanel.h \
|
||||
|
@ -31,7 +32,8 @@ edi_config.c \
|
|||
editor/edi_editor_search.c \
|
||||
editor/edi_editor.c \
|
||||
edi_content_provider.c \
|
||||
welcome/edi_welcome.c \
|
||||
screens/edi_welcome.c \
|
||||
screens/edi_about.c \
|
||||
edi_filepanel.c \
|
||||
edi_logpanel.c \
|
||||
edi_consolepanel.c \
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "edi_logpanel.h"
|
||||
#include "edi_consolepanel.h"
|
||||
#include "mainview/edi_mainview.h"
|
||||
#include "welcome/edi_welcome.h"
|
||||
#include "screens/edi_screens.h"
|
||||
|
||||
#include "edi_private.h"
|
||||
|
||||
|
@ -639,6 +639,12 @@ _tb_clean_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNU
|
|||
edi_builder_clean();
|
||||
}
|
||||
|
||||
static void
|
||||
_tb_about_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
edi_about_show();
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
edi_toolbar_setup(Evas_Object *win)
|
||||
{
|
||||
|
@ -680,6 +686,11 @@ edi_toolbar_setup(Evas_Object *win)
|
|||
// tb_it = elm_toolbar_item_append(tb, "player-play", "Run", _tb_run_cb, NULL);
|
||||
tb_it = elm_toolbar_item_append(tb, "edit-clear", "Clean", _tb_clean_cb, NULL);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, "separator", "", NULL, NULL);
|
||||
elm_toolbar_item_separator_set(tb_it, EINA_TRUE);
|
||||
|
||||
tb_it = elm_toolbar_item_append(tb, "help-about", "About", _tb_about_cb, NULL);
|
||||
|
||||
evas_object_show(tb);
|
||||
return tb;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,145 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <Elementary.h>
|
||||
#include <Ecore.h>
|
||||
|
||||
#include "edi_private.h"
|
||||
|
||||
static void
|
||||
_edi_about_exit(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
evas_object_del(data);
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_about_url_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
const char *url, *format;
|
||||
char *cmd;
|
||||
|
||||
url = (const char *)data;
|
||||
format = "xdg-open \"%s\"";
|
||||
|
||||
cmd = malloc(sizeof(char) * (strlen(format) + strlen(url) - 1));
|
||||
sprintf(cmd, format, url);
|
||||
ecore_exe_run(cmd, NULL);
|
||||
|
||||
free(cmd);
|
||||
}
|
||||
|
||||
Evas_Object *edi_about_show()
|
||||
{
|
||||
Evas_Object *win, *vbox, *box, *table, *bg;
|
||||
Evas_Object *text, *title, *authors, *buttonbox, *button, *space;
|
||||
int alpha, r, g, b;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
win = elm_win_util_standard_add("about", "About Edi");
|
||||
if (!win) return NULL;
|
||||
|
||||
elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
|
||||
evas_object_smart_callback_add(win, "delete,request", _edi_about_exit, win);
|
||||
|
||||
table = elm_table_add(win);
|
||||
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_win_resize_object_add(win, table);
|
||||
evas_object_show(table);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/images/welcome.png", elm_app_data_dir_get());
|
||||
bg = elm_bg_add(win);
|
||||
elm_bg_option_set(bg, ELM_BG_OPTION_CENTER);
|
||||
elm_bg_file_set(bg, buf, NULL);
|
||||
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_table_pack(table, bg, 0, 0, 1, 1);
|
||||
evas_object_show(bg);
|
||||
|
||||
evas_object_color_get(bg, &r, &g, &b, &alpha);
|
||||
evas_color_argb_unpremul(alpha, &r, &g, &b);
|
||||
alpha = 64;
|
||||
|
||||
evas_color_argb_premul(alpha, &r, &g, &b);
|
||||
evas_object_color_set(bg, r, g, b, alpha);
|
||||
|
||||
vbox = elm_box_add(win);
|
||||
elm_box_padding_set(vbox, 25, 0);
|
||||
elm_box_horizontal_set(vbox, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_table_pack(table, vbox, 0, 0, 1, 1);
|
||||
evas_object_show(vbox);
|
||||
|
||||
elm_box_pack_end(vbox, elm_box_add(vbox));
|
||||
box = elm_box_add(win);
|
||||
elm_box_padding_set(box, 10, 0);
|
||||
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(vbox, box);
|
||||
evas_object_show(box);
|
||||
elm_box_pack_end(vbox, elm_box_add(vbox));
|
||||
|
||||
text = elm_label_add(box);
|
||||
elm_object_text_set(text, "<br>EDI is an IDE designed to get people into coding for Linux.<br>" \
|
||||
"It's based on the <b>EFL</b> and written completely natively<br>" \
|
||||
"to provide a <i>reponsive</i> and <i>beautiful</i> UI.<br>");
|
||||
evas_object_size_hint_weight_set(text, EVAS_HINT_EXPAND, 0.0);
|
||||
evas_object_size_hint_align_set(text, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(box, text);
|
||||
evas_object_show(text);
|
||||
|
||||
title = elm_entry_add(box);
|
||||
elm_object_text_set(title, "<hilight><align=center>EDI's lovely authors</align></hilight>");
|
||||
elm_entry_editable_set(title, EINA_FALSE);
|
||||
elm_object_focus_allow_set(title, EINA_FALSE);
|
||||
evas_object_size_hint_weight_set(title, EVAS_HINT_EXPAND, 0.0);
|
||||
evas_object_size_hint_align_set(title, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(box, title);
|
||||
evas_object_show(title);
|
||||
|
||||
/* Authors screen */
|
||||
authors = elm_entry_add(box);
|
||||
elm_entry_file_set(authors, PACKAGE_DOC_DIR "/AUTHORS", ELM_TEXT_FORMAT_PLAIN_UTF8);
|
||||
elm_entry_editable_set(authors, EINA_FALSE);
|
||||
elm_object_focus_allow_set(authors, EINA_FALSE);
|
||||
evas_object_size_hint_weight_set(authors, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(authors, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_resize(authors, 320 * elm_config_scale_get(), 160 * elm_config_scale_get());
|
||||
elm_box_pack_end(box, authors);
|
||||
evas_object_show(authors);
|
||||
|
||||
buttonbox = elm_box_add(box);
|
||||
elm_box_horizontal_set(buttonbox, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
|
||||
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_box_pack_end(box, buttonbox);
|
||||
evas_object_show(buttonbox);
|
||||
|
||||
button = elm_button_add(box);
|
||||
elm_object_text_set(button, "Visit Website");
|
||||
evas_object_smart_callback_add(button, "clicked", _edi_about_url_cb,
|
||||
"http://edi-ide.com");
|
||||
elm_box_pack_end(buttonbox, button);
|
||||
evas_object_show(button);
|
||||
|
||||
space = elm_box_add(box);
|
||||
evas_object_size_hint_min_set(space, 20 * elm_config_scale_get(), 0.0);
|
||||
elm_box_pack_end(buttonbox, space);
|
||||
evas_object_show(space);
|
||||
|
||||
button = elm_button_add(box);
|
||||
elm_object_text_set(button, "Report Issue");
|
||||
evas_object_smart_callback_add(button, "clicked", _edi_about_url_cb,
|
||||
"https://phab.enlightenment.org/maniphest/task/create/?projects=PHID-PROJ-geg2fyscqgjjxt3fider");
|
||||
elm_box_pack_end(buttonbox, button);
|
||||
evas_object_show(button);
|
||||
|
||||
|
||||
evas_object_resize(table, 360 * elm_config_scale_get(), 220 * elm_config_scale_get());
|
||||
evas_object_resize(win, 360 * elm_config_scale_get(), 220 * elm_config_scale_get());
|
||||
evas_object_show(win);
|
||||
|
||||
return win;
|
||||
}
|
|
@ -11,12 +11,12 @@ extern "C" {
|
|||
|
||||
/**
|
||||
* @file
|
||||
* @brief These routines control the intro wizard for Edi.
|
||||
* @brief These routines control the intro wizard and other supporting UI for Edi.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief UI management functions.
|
||||
* @defgroup UI Initialisation and management of the welcome UI
|
||||
* @defgroup UI Initialisation and management of the supporting Edi screens
|
||||
*
|
||||
* @{
|
||||
*
|
||||
|
@ -30,6 +30,15 @@ extern "C" {
|
|||
*/
|
||||
Evas_Object *edi_welcome_show();
|
||||
|
||||
|
||||
/**
|
||||
* Initialize a new Edi about window and display it.
|
||||
*
|
||||
* @return The about window that is created
|
||||
* * @ingroup UI
|
||||
*/
|
||||
Evas_Object *edi_about_show();
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <Elementary.h>
|
||||
|
||||
#include "edi_welcome.h"
|
||||
#include "edi_screens.h"
|
||||
#include "edi_config.h"
|
||||
|
||||
#include "edi_private.h"
|
Loading…
Reference in New Issue