Adjust UI
This commit is contained in:
parent
bac367f9ed
commit
ab1c88fc10
|
@ -26,6 +26,7 @@ set(SOURCES src/main.cc src/MyWin.cc src/MyDialog.cc
|
||||||
|
|
||||||
#Compile resources with GCR_CMake
|
#Compile resources with GCR_CMake
|
||||||
set(RESOURCE_LIST
|
set(RESOURCE_LIST
|
||||||
|
style.css
|
||||||
STRIPBLANKS menubar.xml
|
STRIPBLANKS menubar.xml
|
||||||
STRIPBLANKS prefs.ui
|
STRIPBLANKS prefs.ui
|
||||||
icons/16x16/actions/open-menu.png
|
icons/16x16/actions/open-menu.png
|
||||||
|
|
|
@ -2,7 +2,213 @@
|
||||||
<!-- Generated with glade 3.38.2 -->
|
<!-- Generated with glade 3.38.2 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.24"/>
|
<requires lib="gtk+" version="3.24"/>
|
||||||
<object class="GtkDialog" id="prefs">
|
<object class="GtkBox" id="prefs">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">10</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-start">5</property>
|
||||||
|
<property name="margin-end">5</property>
|
||||||
|
<property name="margin-top">5</property>
|
||||||
|
<property name="margin-bottom">5</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label_conf">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Release Configs:</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<!-- n-columns=2 n-rows=4 -->
|
||||||
|
<object class="GtkGrid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label_lts">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="label" translatable="yes">LongTerm:</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label_stable">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="label" translatable="yes">Stable:</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label_dev">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="label" translatable="yes">Development:</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="entry_lts">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="text" translatable="yes">default_config</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="entry_stable">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="text" translatable="yes">default_config</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="entry_dev">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="vexpand">True</property>
|
||||||
|
<property name="text" translatable="yes">default_config</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="label" translatable="yes">Path:</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="entry_path">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="text" translatable="yes">./</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<property name="spacing">5</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="btnpath">
|
||||||
|
<property name="label" translatable="yes">Custom Path</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="btn_ok">
|
||||||
|
<property name="label" translatable="yes">OK</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="btn_cancel">
|
||||||
|
<property name="label" translatable="yes">Cancel</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<object class="GtkDialog" id="prefs1">
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="margin-end">10</property>
|
<property name="margin-end">10</property>
|
||||||
<property name="type-hint">dialog</property>
|
<property name="type-hint">dialog</property>
|
||||||
|
@ -16,43 +222,13 @@
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="layout-style">end</property>
|
<property name="layout-style">end</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="btnpath">
|
<placeholder/>
|
||||||
<property name="label" translatable="yes">Custom Path</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="receives-default">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="btn_ok">
|
<placeholder/>
|
||||||
<property name="label" translatable="yes">OK</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="receives-default">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="btn_cancel">
|
<placeholder/>
|
||||||
<property name="label" translatable="yes">Cancel</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="receives-default">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -62,156 +238,9 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<placeholder/>
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="margin-start">5</property>
|
|
||||||
<property name="margin-end">5</property>
|
|
||||||
<property name="margin-top">5</property>
|
|
||||||
<property name="margin-bottom">5</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<property name="vexpand">True</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="label_conf">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="label" translatable="yes">Release Configs:</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<!-- n-columns=2 n-rows=4 -->
|
|
||||||
<object class="GtkGrid">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="label_lts">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<property name="vexpand">True</property>
|
|
||||||
<property name="label" translatable="yes">LongTerm:</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="label_stable">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<property name="vexpand">True</property>
|
|
||||||
<property name="label" translatable="yes">Stable:</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="label_dev">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<property name="vexpand">True</property>
|
|
||||||
<property name="label" translatable="yes">Development:</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkEntry" id="entry_lts">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<property name="vexpand">True</property>
|
|
||||||
<property name="text" translatable="yes">default_config</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">1</property>
|
|
||||||
<property name="top-attach">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkEntry" id="entry_stable">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<property name="vexpand">True</property>
|
|
||||||
<property name="text" translatable="yes">default_config</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">1</property>
|
|
||||||
<property name="top-attach">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkEntry" id="entry_dev">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<property name="vexpand">True</property>
|
|
||||||
<property name="text" translatable="yes">default_config</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">1</property>
|
|
||||||
<property name="top-attach">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
<property name="label" translatable="yes">Path:</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">3</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkEntry" id="entry_path">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">True</property>
|
|
||||||
<property name="text" translatable="yes">./</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">1</property>
|
|
||||||
<property name="top-attach">3</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<action-widgets>
|
|
||||||
<action-widget response="-5">btn_ok</action-widget>
|
|
||||||
<action-widget response="-6">btn_cancel</action-widget>
|
|
||||||
</action-widgets>
|
|
||||||
</object>
|
</object>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
您可以在这里输入任何 GTK+ 可识别的 CSS 规则。
|
||||||
|
您可以点击上面的“暂停”按钮来暂时停用这个自定义 CSS。
|
||||||
|
|
||||||
|
变更会立即应用到全局,影响整个应用程序。
|
||||||
|
*/
|
||||||
|
|
||||||
|
box{
|
||||||
|
background-color:rgba(255,255,255,0.5);
|
||||||
|
}
|
|
@ -1,17 +1,18 @@
|
||||||
#include "MyDialog.hh"
|
#include "MyDialog.hh"
|
||||||
|
|
||||||
MyDialog::MyDialog(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_builder)
|
MyPrefs::MyPrefs(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_builder)
|
||||||
: Gtk::Dialog(cobject),
|
: Gtk::Box(cobject),
|
||||||
ref_Glade(ref_builder)
|
ref_Glade(ref_builder)
|
||||||
{
|
{
|
||||||
// Initalize
|
// // Initalize
|
||||||
set_icon_name("XeRelease");
|
// set_icon_name("XeRelease");
|
||||||
// Get Widgets
|
// Get Widgets
|
||||||
ref_builder->get_widget("entry_lts", entry_lts);
|
ref_builder->get_widget("entry_lts", entry_lts);
|
||||||
ref_builder->get_widget("entry_stable", entry_stable);
|
ref_builder->get_widget("entry_stable", entry_stable);
|
||||||
ref_builder->get_widget("entry_dev", entry_dev);
|
ref_builder->get_widget("entry_dev", entry_dev);
|
||||||
ref_builder->get_widget("entry_path", entry_path);
|
ref_builder->get_widget("entry_path", entry_path);
|
||||||
ref_builder->get_widget("btnpath", btnpath);
|
ref_builder->get_widget("btnpath", btnpath);
|
||||||
|
ref_builder->get_widget("btn_ok", btnok);
|
||||||
|
|
||||||
// json_file.close();
|
// json_file.close();
|
||||||
|
|
||||||
|
@ -29,41 +30,40 @@ MyDialog::MyDialog(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &re
|
||||||
// readCfgFile("xe_config","Release_Path_Win32",config_win32);
|
// readCfgFile("xe_config","Release_Path_Win32",config_win32);
|
||||||
|
|
||||||
// Connect Signal
|
// Connect Signal
|
||||||
btnpath->signal_clicked().connect(sigc::mem_fun(*this, &MyDialog::btnpath_clicked));
|
btnpath->signal_clicked().connect(sigc::mem_fun(*this, &MyPrefs::btnpath_clicked));
|
||||||
|
btnok->signal_clicked().connect(sigc::mem_fun(*this, &MyPrefs::btnok_clicked));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyDialog::on_response(int response_id)
|
void MyPrefs::btnok_clicked()
|
||||||
{
|
{
|
||||||
// Save Configs to a file
|
// Save Configs to a file
|
||||||
if (response_id == Gtk::RESPONSE_OK)
|
Glib::ustring config;
|
||||||
|
std::fstream outfile;
|
||||||
|
|
||||||
|
// Initalize Config for path
|
||||||
|
if (unix_file_system_detected())
|
||||||
|
{
|
||||||
|
config_unix = entry_path->get_text();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Glib::ustring config;
|
|
||||||
std::fstream outfile;
|
|
||||||
|
|
||||||
// Initalize Config for path
|
config_win32 = entry_path->get_text();
|
||||||
if (unix_file_system_detected())
|
}
|
||||||
{
|
// Open the config file
|
||||||
config_unix = entry_path->get_text();
|
outfile.open("xe_config.json", std::ios_base::out);
|
||||||
}
|
/*OutPut contents to the file
|
||||||
else
|
Simple Contents of xe_config:
|
||||||
{
|
Longterm=x.x
|
||||||
|
Stable=x.x
|
||||||
config_win32 = entry_path->get_text();
|
Develop=x.x
|
||||||
}
|
Release_Path_Unix=/xxx/xxx
|
||||||
// Open the config file
|
Release_Path_Win32=X:\xxx\xxx
|
||||||
outfile.open("xe_config.json", std::ios_base::out);
|
*/
|
||||||
/*OutPut contents to the file
|
if (outfile.is_open())
|
||||||
Simple Contents of xe_config:
|
{
|
||||||
Longterm=x.x
|
// Create json object
|
||||||
Stable=x.x
|
json out_data = json::parse(R"(
|
||||||
Develop=x.x
|
|
||||||
Release_Path_Unix=/xxx/xxx
|
|
||||||
Release_Path_Win32=X:\xxx\xxx
|
|
||||||
*/
|
|
||||||
if (outfile.is_open())
|
|
||||||
{
|
|
||||||
// Create json object
|
|
||||||
json out_data = json::parse(R"(
|
|
||||||
{
|
{
|
||||||
"Longterm":"",
|
"Longterm":"",
|
||||||
"Stable":"",
|
"Stable":"",
|
||||||
|
@ -73,31 +73,29 @@ void MyDialog::on_response(int response_id)
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
|
|
||||||
// Load config to json file
|
// Load config to json file
|
||||||
out_data["Longterm"] = entry_lts->get_text();
|
out_data["Longterm"] = entry_lts->get_text();
|
||||||
out_data["Stable"] = entry_stable->get_text();
|
out_data["Stable"] = entry_stable->get_text();
|
||||||
out_data["Develop"] = entry_dev->get_text();
|
out_data["Develop"] = entry_dev->get_text();
|
||||||
out_data["Release_Path_Unix"] = config_unix;
|
out_data["Release_Path_Unix"] = config_unix;
|
||||||
out_data["Release_Path_Win32"] = config_win32;
|
out_data["Release_Path_Win32"] = config_win32;
|
||||||
outfile << out_data;
|
outfile << out_data;
|
||||||
// outfile<<"This is the config file of Xe Release"<<std::endl;
|
// outfile<<"This is the config file of Xe Release"<<std::endl;
|
||||||
// outfile<<"See more on github.com/daleclack/Xe-Release"<<std::endl;
|
// outfile<<"See more on github.com/daleclack/Xe-Release"<<std::endl;
|
||||||
// outfile<<std::endl;
|
// outfile<<std::endl;
|
||||||
// config=entry_lts->get_text();
|
// config=entry_lts->get_text();
|
||||||
// outfile<<"Longterm="<<config<<std::endl;
|
// outfile<<"Longterm="<<config<<std::endl;
|
||||||
// config=entry_stable->get_text();
|
// config=entry_stable->get_text();
|
||||||
// outfile<<"Stable="<<config<<std::endl;
|
// outfile<<"Stable="<<config<<std::endl;
|
||||||
// config=entry_dev->get_text();
|
// config=entry_dev->get_text();
|
||||||
// outfile<<"Develop="<<config<<std::endl;
|
// outfile<<"Develop="<<config<<std::endl;
|
||||||
// outfile<<"Release_Path_Unix="<<config_unix<<std::endl;
|
// outfile<<"Release_Path_Unix="<<config_unix<<std::endl;
|
||||||
// outfile<<"Release_Path_Win32="<<config_win32<<std::endl;
|
// outfile<<"Release_Path_Win32="<<config_win32<<std::endl;
|
||||||
}
|
|
||||||
outfile.close();
|
|
||||||
}
|
}
|
||||||
hide();
|
outfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyDialog::init_json_data(json &data1)
|
void MyPrefs::init_json_data(json &data1)
|
||||||
{
|
{
|
||||||
// Read Configs
|
// Read Configs
|
||||||
std::string config_longterm, config_stable, config_devel;
|
std::string config_longterm, config_stable, config_devel;
|
||||||
|
@ -129,30 +127,33 @@ void MyDialog::init_json_data(json &data1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyDialog *MyDialog::create(Gtk::Window &parent)
|
MyPrefs *MyPrefs::create()
|
||||||
{
|
{
|
||||||
// Create a dialog
|
// Create the config widget
|
||||||
auto builder = Gtk::Builder::create_from_resource("/org/gtk/daleclack/prefs.ui");
|
auto builder = Gtk::Builder::create_from_resource("/org/gtk/daleclack/prefs.ui");
|
||||||
|
|
||||||
MyDialog *dialog = nullptr;
|
MyPrefs *box = nullptr;
|
||||||
builder->get_widget_derived("prefs", dialog);
|
builder->get_widget_derived("prefs", box);
|
||||||
dialog->set_transient_for(parent);
|
|
||||||
|
|
||||||
return dialog;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyDialog::btnpath_clicked()
|
void MyPrefs::set_parent_win(Gtk::Window *parent){
|
||||||
|
parent_win = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyPrefs::btnpath_clicked()
|
||||||
{
|
{
|
||||||
// Create a Dialog
|
// Create a Dialog
|
||||||
dialog = Gtk::FileChooserNative::create("Select a folder", *this,
|
dialog = Gtk::FileChooserNative::create("Select a folder", *parent_win,
|
||||||
Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER, "OK", "Cancel");
|
Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER, "OK", "Cancel");
|
||||||
|
|
||||||
dialog->signal_response().connect(sigc::mem_fun(*this, &MyDialog::dialog_response));
|
dialog->signal_response().connect(sigc::mem_fun(*this, &MyPrefs::dialog_response));
|
||||||
|
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyDialog::dialog_response(int response_id)
|
void MyPrefs::dialog_response(int response_id)
|
||||||
{
|
{
|
||||||
if (response_id == Gtk::RESPONSE_ACCEPT)
|
if (response_id == Gtk::RESPONSE_ACCEPT)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,43 +6,52 @@
|
||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
class MyDialog : public Gtk::Dialog{
|
class MyPrefs : public Gtk::Box
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
MyDialog(BaseObjectType* cobject,const Glib::RefPtr<Gtk::Builder>& ref_builder);
|
MyPrefs(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &ref_builder);
|
||||||
static MyDialog * create(Gtk::Window& parent);
|
static MyPrefs *create();
|
||||||
|
void set_parent_win(Gtk::Window *parent);
|
||||||
void init_json_data(json &data1);
|
void init_json_data(json &data1);
|
||||||
protected:
|
|
||||||
void on_response(int response_id) override;
|
|
||||||
private:
|
private:
|
||||||
Glib::RefPtr<Gtk::Builder> ref_Glade;
|
Glib::RefPtr<Gtk::Builder> ref_Glade;
|
||||||
//Child widgets
|
// Parent Window
|
||||||
Gtk::Entry * entry_lts,* entry_stable,* entry_dev,* entry_path;
|
Gtk::Window *parent_win;
|
||||||
Gtk::Button * btnpath;
|
|
||||||
|
|
||||||
//Strings to store path on Windows and Unix-Like systems
|
// Child widgets
|
||||||
std::string config_win32,config_unix;
|
Gtk::Entry *entry_lts, *entry_stable, *entry_dev, *entry_path;
|
||||||
|
Gtk::Button *btnpath, *btnok;
|
||||||
|
|
||||||
//Signal Handlers
|
// Strings to store path on Windows and Unix-Like systems
|
||||||
|
std::string config_win32, config_unix;
|
||||||
|
|
||||||
|
// Signal Handlers
|
||||||
Glib::RefPtr<Gtk::FileChooserNative> dialog;
|
Glib::RefPtr<Gtk::FileChooserNative> dialog;
|
||||||
void btnpath_clicked();
|
void btnpath_clicked();
|
||||||
void dialog_response(int response_id);
|
void dialog_response(int response_id);
|
||||||
|
void btnok_clicked();
|
||||||
};
|
};
|
||||||
|
|
||||||
class MsgBox : public Gtk::Dialog{
|
class MsgBox : public Gtk::Dialog
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
MsgBox(Gtk::Window &parent);
|
MsgBox(Gtk::Window &parent);
|
||||||
void Init(Glib::ustring msg);
|
void Init(Glib::ustring msg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//Signal Handler
|
// Signal Handler
|
||||||
void on_response(int response_id) override;
|
void on_response(int response_id) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//Child Widgets
|
// Child Widgets
|
||||||
Gtk::Image image;
|
Gtk::Image image;
|
||||||
Gtk::Label msg_label;
|
Gtk::Label msg_label;
|
||||||
Gtk::Box *vbox,hbox;
|
Gtk::Box *vbox, hbox;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool unix_file_system_detected(){
|
static inline bool unix_file_system_detected()
|
||||||
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -16,6 +16,7 @@ enum Releases
|
||||||
MyWin::MyWin()
|
MyWin::MyWin()
|
||||||
: btn_box(Gtk::ORIENTATION_VERTICAL, 5),
|
: btn_box(Gtk::ORIENTATION_VERTICAL, 5),
|
||||||
btn_ver("Xe-Ver"),
|
btn_ver("Xe-Ver"),
|
||||||
|
cfg_box(Gtk::ORIENTATION_HORIZONTAL, 5),
|
||||||
msg_dialog(*this)
|
msg_dialog(*this)
|
||||||
{
|
{
|
||||||
// Initalize window
|
// Initalize window
|
||||||
|
@ -27,7 +28,7 @@ MyWin::MyWin()
|
||||||
auto pixbuf = Gdk::Pixbuf::create_from_xpm_data(fly);
|
auto pixbuf = Gdk::Pixbuf::create_from_xpm_data(fly);
|
||||||
auto sized = pixbuf->scale_simple(640, 360, Gdk::INTERP_BILINEAR);
|
auto sized = pixbuf->scale_simple(640, 360, Gdk::INTERP_BILINEAR);
|
||||||
gtk_image_set_from_pixbuf(background.gobj(), sized->gobj());
|
gtk_image_set_from_pixbuf(background.gobj(), sized->gobj());
|
||||||
overlay.add(background);
|
back_overlay.add(background);
|
||||||
|
|
||||||
// Get Local time
|
// Get Local time
|
||||||
time_t t;
|
time_t t;
|
||||||
|
@ -55,8 +56,27 @@ MyWin::MyWin()
|
||||||
btn_ver.signal_clicked().connect(sigc::mem_fun(*this, &MyWin::main_releases));
|
btn_ver.signal_clicked().connect(sigc::mem_fun(*this, &MyWin::main_releases));
|
||||||
|
|
||||||
// Show everything
|
// Show everything
|
||||||
add(stack1);
|
add(back_overlay);
|
||||||
|
back_overlay.add_overlay(stack1);
|
||||||
stack1.add(overlay, "main_page", "WelCome");
|
stack1.add(overlay, "main_page", "WelCome");
|
||||||
|
|
||||||
|
//Add Config Page
|
||||||
|
prefs = MyPrefs::create();
|
||||||
|
prefs->set_parent_win(this);
|
||||||
|
load_config();
|
||||||
|
prefs->init_json_data(data);
|
||||||
|
cfg_box.pack_start(*prefs, Gtk::PACK_SHRINK);
|
||||||
|
cfg_box.set_opacity(0.7);
|
||||||
|
stack1.add(cfg_box, "config_page", "Config");
|
||||||
|
|
||||||
|
// Create Style for widgets
|
||||||
|
provider = Gtk::CssProvider::create();
|
||||||
|
provider->load_from_resource("/org/gtk/daleclack/style.css");
|
||||||
|
auto style1 = btn_box.get_style_context();
|
||||||
|
style1->add_provider(provider, 1);
|
||||||
|
auto style2 = prefs->get_style_context();
|
||||||
|
style2->add_provider(provider, 1);
|
||||||
|
|
||||||
switcher.set_stack(stack1);
|
switcher.set_stack(stack1);
|
||||||
show_all_children();
|
show_all_children();
|
||||||
|
|
||||||
|
@ -135,10 +155,8 @@ void MyWin::background3()
|
||||||
void MyWin::config_dialog()
|
void MyWin::config_dialog()
|
||||||
{
|
{
|
||||||
load_config();
|
load_config();
|
||||||
auto dialog = MyDialog::create(*this);
|
prefs->init_json_data(data);
|
||||||
dialog->init_json_data(data);
|
stack1.set_visible_child(cfg_box);
|
||||||
dialog->signal_hide().connect(sigc::bind(sigc::mem_fun(*this, &MyWin::on_window_hide), dialog));
|
|
||||||
dialog->present();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyWin::load_config(){
|
void MyWin::load_config(){
|
||||||
|
|
|
@ -9,34 +9,40 @@ public:
|
||||||
MyWin();
|
MyWin();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//Child Widgets
|
// Child Widgets
|
||||||
Glib::RefPtr<Gtk::Builder> menu_builder;
|
Glib::RefPtr<Gtk::Builder> menu_builder;
|
||||||
|
|
||||||
//Main window
|
// Main window
|
||||||
Gtk::Stack stack1;
|
Gtk::Stack stack1;
|
||||||
Gtk::StackSwitcher switcher;
|
Gtk::StackSwitcher switcher;
|
||||||
Gtk::Image background;
|
Gtk::Image background;
|
||||||
Gtk::Overlay overlay;
|
Gtk::Overlay back_overlay, overlay;
|
||||||
Gtk::Box btn_box;
|
Gtk::Box btn_box, cfg_box;
|
||||||
Gtk::Label api_label;
|
Gtk::Label api_label;
|
||||||
Gtk::ComboBoxText combo;
|
Gtk::ComboBoxText combo;
|
||||||
Gtk::Button btn_ver;
|
Gtk::Button btn_ver;
|
||||||
|
|
||||||
//TitleBar and menu
|
// TitleBar and menu
|
||||||
Gtk::HeaderBar header;
|
Gtk::HeaderBar header;
|
||||||
Gtk::MenuButton menubtn;
|
Gtk::MenuButton menubtn;
|
||||||
Gtk::PopoverMenu popover;
|
Gtk::PopoverMenu popover;
|
||||||
void titlebar_init();
|
void titlebar_init();
|
||||||
|
|
||||||
//Dialogs
|
// Css Style
|
||||||
|
Glib::RefPtr<Gtk::CssProvider> provider;
|
||||||
|
|
||||||
|
// Config Page
|
||||||
|
MyPrefs *prefs;
|
||||||
|
|
||||||
|
// Dialogs
|
||||||
MsgBox msg_dialog;
|
MsgBox msg_dialog;
|
||||||
|
|
||||||
//Backgrounds
|
// Backgrounds
|
||||||
void background1();
|
void background1();
|
||||||
void background2();
|
void background2();
|
||||||
void background3();
|
void background3();
|
||||||
|
|
||||||
//Version Configs
|
// Version Configs
|
||||||
struct tm *local;
|
struct tm *local;
|
||||||
char api_version[57];
|
char api_version[57];
|
||||||
json data;
|
json data;
|
||||||
|
@ -44,8 +50,8 @@ private:
|
||||||
void load_config();
|
void load_config();
|
||||||
void config_dialog();
|
void config_dialog();
|
||||||
|
|
||||||
//Signal Handlers
|
// Signal Handlers
|
||||||
void on_window_hide(Gtk::Window* window);
|
void on_window_hide(Gtk::Window *window);
|
||||||
void about_dialog();
|
void about_dialog();
|
||||||
void main_releases();
|
void main_releases();
|
||||||
};
|
};
|
Loading…
Reference in New Issue