Commit 047512ee authored by Rémi BERTHO's avatar Rémi BERTHO

Add ip info for html version

parent 4954a460
......@@ -56,6 +56,10 @@ HtmlPreferences::HtmlPreferences(BaseObjectType* cobject, const RefPtr<Builder>&
refGlade->get_widget("preferences_html_autostart_label", autostart_label_);
refGlade->get_widget("preferences_html_autostart_switch", autostart_switch_);
refGlade->get_widget("preferences_html_info_label", info_label_);
refGlade->get_widget("preferences_html_ip_label", ip_label_);
refGlade->get_widget("preferences_html_firewall_label", firewall_label_);
autostart_switch_->property_active().signal_changed().connect(mem_fun(*(app()->preferencesWindow()), &PreferencesWindow::hasChange));
}
......@@ -64,7 +68,8 @@ ustring HtmlPreferences::getAutostartFilename()
#ifdef G_OS_UNIX
return build_filename(get_home_dir(), ".config", "autostart", "csuper-html.desktop");
#elif defined G_OS_WIN32
return build_filename(get_home_dir(), "AppData", "Roaming", "Microsoft", "Windows", "Start Menu", "Programs","Startup","csuper-html.vbs");
return build_filename(
get_home_dir(), "AppData", "Roaming", "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "csuper-html.vbs");
#endif
}
......@@ -76,6 +81,22 @@ void HtmlPreferences::update()
last_autostart_ = autostart_file->query_exists();
autostart_switch_->set_active(last_autostart_);
// Get local IP
auto ip_resolver = Resolver::get_default();
auto ip_addresses = ip_resolver->lookup_by_name(g_get_host_name());
RefPtr<InetAddress> local_ip;
for (const auto& ip : ip_addresses)
{
if (ip->get_family() == SocketFamily::SOCKET_FAMILY_IPV4)
{
local_ip = ip;
break;
}
}
ip_label_->set_markup(ustring::compose(
_("The HTML will be available on all your LAN (local Area Network) at the address <a href=\"http://%1:52721\">http://%1:52721</a>."),
local_ip->to_string()));
}
bool HtmlPreferences::hasChanged()
......@@ -117,13 +138,13 @@ void HtmlPreferences::applyChanges()
<< "StartupNotify=false" << endl
<< "Terminal=true" << endl
<< "Name[fr_FR]=Csuper";
#elif defined G_OS_WIN32
autostart_file << "Set WshShell = CreateObject(\"WScript.Shell\")" << endl
#elif defined G_OS_WIN32
autostart_file << "Set WshShell = CreateObject(\"WScript.Shell\")" << endl
<< "WshShell.RUN \"\"\"C:\\Program Files\\Csuper\\csuper-html-autostart.bat\"\"\", 0, True";
#endif
autostart_file.close();
#endif
autostart_file.close();
g_debug("Csuper-HTML autostart enable");
}
......@@ -143,4 +164,4 @@ void HtmlPreferences::applyChanges()
}
g_debug("Csuper-HTML autostart disable");
}
}
}
......@@ -49,9 +49,14 @@ protected:
Gtk::Grid* main_grid_; /*!< The main grid */
Gtk::Viewport* viewport_; /*!< The viewport */
Gtk::Label* start_label_; /*!< The title bar label */
Gtk::Label* autostart_label_; /*!< The title bar decoration label */
Gtk::Switch* autostart_switch_; /*!< The title bar decoration switch */
Gtk::Label* start_label_; /*!< The start label */
Gtk::Label* autostart_label_; /*!< The autostart label */
Gtk::Switch* autostart_switch_; /*!< The autostart switch */
Gtk::Label* info_label_; /*!< The info label */
Gtk::Label* ip_label_; /*!< The ip label */
Gtk::Label* firewall_label_; /*!< The firewall label */
bool last_autostart_; /*!< The last autostart value */
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-06 17:56+0200\n"
"POT-Creation-Date: 2017-08-09 22:08+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Csuper - 4.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-06 17:56+0200\n"
"PO-Revision-Date: 2017-08-06 19:13+0200\n"
"POT-Creation-Date: 2017-08-09 22:08+0200\n"
"PO-Revision-Date: 2017-08-09 22:10+0200\n"
"Last-Translator: Rémi BERTHO <remi.bertho@openmailbox.org>\n"
"Language-Team: français <>\n"
"Language: fr\n"
......@@ -79,7 +79,7 @@ msgstr "Vérifier les mises à jour"
msgid "Quit"
msgstr "Quitter"
#: Sources/csuper-gtk/csu_application.cpp:269
#: Sources/csuper-gtk/csu_application.cpp:270
msgid ""
"Do you really want to quit Csuper HTML ?\n"
"You will need to restart Csuper-HTML before running it again."
......@@ -87,7 +87,7 @@ msgstr ""
"Voulez-vous vraiment quitter Csuper HTML ?\n"
"Vous devrez relancer Csuper HTML pour pouvoir y accéder de nouveau."
#: Sources/csuper-gtk/csu_application.cpp:308
#: Sources/csuper-gtk/csu_application.cpp:313
msgid ""
"A update is available: you use the version %1 of Csuper whereas the version "
"%2 is available.\n"
......@@ -98,7 +98,7 @@ msgstr ""
"Vous pouvez télécharger la nouvelle version sur ce site internet : https://"
"www.dalan.fr."
#: Sources/csuper-gtk/csu_application.cpp:315
#: Sources/csuper-gtk/csu_application.cpp:320
msgid "You use the version %1 of Csuper which is the latest version."
msgstr ""
"Vous utilisez la version %1 de Csuper qui est la dernière version disponible."
......@@ -180,9 +180,17 @@ msgstr "Il n'y a pas de distributeur dans ce jeu"
msgid "There is %1 points in the game"
msgstr "Il y a %1 points dans le jeu"
#: Sources/csuper-gtk/html_preferences.cpp:98
msgid ""
"The HTML will be available on all your LAN (local Area Network) at the "
"address <a href=\"http://%1:52721\">http://%1:52721</a>."
msgstr ""
"La version HTML sera accessible sur votre réseau local à l'adresse <a href="
"\"http://%1:52721\">http://%1:52721</a>."
#: Sources/csuper-gtk/import_export_game_configuration_dialog.cpp:54
#: UI/csuper-gtk.glade:455 UI/csuper-gtk.glade:993 UI/csuper-gtk.glade:1265
#: UI/csuper-gtk.glade:1339 UI/csuper-gtk.glade:1847 UI/csuper-gtk.glade:2889
#: UI/csuper-gtk.glade:1339 UI/csuper-gtk.glade:1847 UI/csuper-gtk.glade:2940
msgid "Validate"
msgstr "Valider"
......@@ -569,11 +577,11 @@ msgstr "Ajouter une configuration de jeu"
msgid "Import"
msgstr "Importer"
#: UI/csuper-gtk.glade:1156 UI/csuper-gtk.glade:2904
#: UI/csuper-gtk.glade:1156 UI/csuper-gtk.glade:2955
msgid "Close"
msgstr "Fermer"
#: UI/csuper-gtk.glade:1160 UI/csuper-gtk.glade:2908
#: UI/csuper-gtk.glade:1160 UI/csuper-gtk.glade:2959
msgid "Close the game preferences window"
msgstr "Fermer la fenêtre des configurations de jeu"
......@@ -1031,10 +1039,14 @@ msgid "Add title"
msgstr "Ajouter le titre"
#: UI/csuper-gtk.glade:2794
msgid "<span font_weight=\"bold\" size=\"large\">Informations</span>"
msgstr "<span font_weight=\"bold\" size=\"large\">Informations</span>"
#: UI/csuper-gtk.glade:2812
msgid "<span font_weight=\"bold\" size=\"large\">Start</span>"
msgstr "<span font_weight=\"bold\" size=\"large\">Démarrage</span>"
#: UI/csuper-gtk.glade:2807
#: UI/csuper-gtk.glade:2825 UI/csuper-gtk.glade:2853 UI/csuper-gtk.glade:2869
msgid ""
"It will allow you to connect to csuper with any device on your local network "
"(for example tablet) when your computer is up.\n"
......@@ -1044,19 +1056,31 @@ msgstr ""
"réseau local (par exemple une tablette) quand votre ordinateur est allumé.\n"
"Merci de NE PAS l'utiliser sur un réseau public."
#: UI/csuper-gtk.glade:2810
msgid "Start Csuper HTML with the computer"
msgstr "Lancer Csuper HTML au démarrage de l'ordinateur"
#: UI/csuper-gtk.glade:2828
msgid "Start Csuper HTML with the computer for the current user"
msgstr ""
"Lancer Csuper HTML au démarrage de l'ordinateur pour l'utilisateur courant"
#: UI/csuper-gtk.glade:2872
msgid ""
"If you can't acces to the HTML version from another devic, it may be your "
"firewall that block it.\n"
"You can tell it to unblock the Csuper port (52721)."
msgstr ""
"Si vous ne pouvez pas accéder à la version HTML depuis un autre appareil, "
"cela peut-être votre pare-feu qui vous bloque.\n"
"Vous pouvez lui dire de faire une exception pour Csuper en débloquant le "
"port de Csuper (52721)."
#: UI/csuper-gtk.glade:2850
#: UI/csuper-gtk.glade:2901
msgid "HTML version"
msgstr "Version HTML"
#: UI/csuper-gtk.glade:2874
#: UI/csuper-gtk.glade:2925
msgid "Apply"
msgstr "Appliquer"
#: UI/csuper-gtk.glade:2878 UI/csuper-gtk.glade:2893
#: UI/csuper-gtk.glade:2929 UI/csuper-gtk.glade:2944
msgid "Apply the new preferences for the new toolbar button displayed"
msgstr ""
"Appliquer les nouvelles préférences sur l'affichage des boutons de la barre "
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-06 17:56+0200\n"
"POT-Creation-Date: 2017-08-09 22:08+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -75,20 +75,20 @@ msgstr ""
msgid "Quit"
msgstr ""
#: Sources/csuper-gtk/csu_application.cpp:269
#: Sources/csuper-gtk/csu_application.cpp:270
msgid ""
"Do you really want to quit Csuper HTML ?\n"
"You will need to restart Csuper-HTML before running it again."
msgstr ""
#: Sources/csuper-gtk/csu_application.cpp:308
#: Sources/csuper-gtk/csu_application.cpp:313
msgid ""
"A update is available: you use the version %1 of Csuper whereas the version "
"%2 is available.\n"
"You can download the new version on this website: https://www.dalan.fr/"
msgstr ""
#: Sources/csuper-gtk/csu_application.cpp:315
#: Sources/csuper-gtk/csu_application.cpp:320
msgid "You use the version %1 of Csuper which is the latest version."
msgstr ""
......@@ -167,9 +167,15 @@ msgstr ""
msgid "There is %1 points in the game"
msgstr ""
#: Sources/csuper-gtk/html_preferences.cpp:98
msgid ""
"The HTML will be available on all your LAN (local Area Network) at the "
"address <a href=\"http://%1:52721\">http://%1:52721</a>."
msgstr ""
#: Sources/csuper-gtk/import_export_game_configuration_dialog.cpp:54
#: UI/csuper-gtk.glade:455 UI/csuper-gtk.glade:993 UI/csuper-gtk.glade:1265
#: UI/csuper-gtk.glade:1339 UI/csuper-gtk.glade:1847 UI/csuper-gtk.glade:2889
#: UI/csuper-gtk.glade:1339 UI/csuper-gtk.glade:1847 UI/csuper-gtk.glade:2940
msgid "Validate"
msgstr ""
......@@ -550,11 +556,11 @@ msgstr ""
msgid "Import"
msgstr ""
#: UI/csuper-gtk.glade:1156 UI/csuper-gtk.glade:2904
#: UI/csuper-gtk.glade:1156 UI/csuper-gtk.glade:2955
msgid "Close"
msgstr ""
#: UI/csuper-gtk.glade:1160 UI/csuper-gtk.glade:2908
#: UI/csuper-gtk.glade:1160 UI/csuper-gtk.glade:2959
msgid "Close the game preferences window"
msgstr ""
......@@ -983,28 +989,39 @@ msgid "Add title"
msgstr ""
#: UI/csuper-gtk.glade:2794
msgid "<span font_weight=\"bold\" size=\"large\">Informations</span>"
msgstr ""
#: UI/csuper-gtk.glade:2812
msgid "<span font_weight=\"bold\" size=\"large\">Start</span>"
msgstr ""
#: UI/csuper-gtk.glade:2807
#: UI/csuper-gtk.glade:2825 UI/csuper-gtk.glade:2853 UI/csuper-gtk.glade:2869
msgid ""
"It will allow you to connect to csuper with any device on your local network "
"(for example tablet) when your computer is up.\n"
"Please DO NOT USE it on public network."
msgstr ""
#: UI/csuper-gtk.glade:2810
msgid "Start Csuper HTML with the computer"
#: UI/csuper-gtk.glade:2828
msgid "Start Csuper HTML with the computer for the current user"
msgstr ""
#: UI/csuper-gtk.glade:2872
msgid ""
"If you can't acces to the HTML version from another devic, it may be your "
"firewall that block it.\n"
"You can tell it to unblock the Csuper port (52721)."
msgstr ""
#: UI/csuper-gtk.glade:2850
#: UI/csuper-gtk.glade:2901
msgid "HTML version"
msgstr ""
#: UI/csuper-gtk.glade:2874
#: UI/csuper-gtk.glade:2925
msgid "Apply"
msgstr ""
#: UI/csuper-gtk.glade:2878 UI/csuper-gtk.glade:2893
#: UI/csuper-gtk.glade:2929 UI/csuper-gtk.glade:2944
msgid "Apply the new preferences for the new toolbar button displayed"
msgstr ""
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-06 17:56+0200\n"
"POT-Creation-Date: 2017-08-09 22:08+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......
......@@ -2782,6 +2782,24 @@ Be careful, if the font does'nt exist the PDF file will be unreadable.</property
<property name="can_focus">False</property>
<property name="row_spacing">10</property>
<property name="column_spacing">10</property>
<child>
<object class="GtkLabel" id="preferences_html_info_label">
<property name="width_request">400</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">&lt;span font_weight="bold" size="large"&gt;Informations&lt;/span&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="preferences_html_start_label">
<property name="width_request">400</property>
......@@ -2796,7 +2814,7 @@ Be careful, if the font does'nt exist the PDF file will be unreadable.</property
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="top_attach">3</property>
<property name="width">4</property>
</packing>
</child>
......@@ -2807,12 +2825,12 @@ Be careful, if the font does'nt exist the PDF file will be unreadable.</property
<property name="tooltip_text" translatable="yes">It will allow you to connect to csuper with any device on your local network (for example tablet) when your computer is up.
Please DO NOT USE it on public network.</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Start Csuper HTML with the computer</property>
<property name="label" translatable="yes">Start Csuper HTML with the computer for the current user</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
......@@ -2825,7 +2843,40 @@ Please DO NOT USE it on public network.</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="preferences_html_ip_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">It will allow you to connect to csuper with any device on your local network (for example tablet) when your computer is up.
Please DO NOT USE it on public network.</property>
<property name="hexpand">True</property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="preferences_html_firewall_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">It will allow you to connect to csuper with any device on your local network (for example tablet) when your computer is up.
Please DO NOT USE it on public network.</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">If you can't acces to the HTML version from another devic, it may be your firewall that block it.
You can tell it to unblock the Csuper port (52721).</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">4</property>
</packing>
</child>
<child>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment