Add page for gtk123

This commit is contained in:
daleclack 2022-02-02 11:33:44 +08:00
parent 9875c98a22
commit 0a8d0291db
10 changed files with 230 additions and 18 deletions

View File

@ -27,14 +27,15 @@ set(RESOURCE_LIST
icons/16x16/actions/list-remove.svg
folder.svg
folder-images.svg
image_file.svg)
image_file.svg
prefs_stack.ui)
compile_gresources(RESOURCE_FILE
XML_OUT
TYPE EMBED_C
RESOURCES ${RESOURCE_LIST}
PREFIX "/org/gtk/daleclack"
SOURCE_DIR ${PROJECT_SOURCE_DIR}/../default_res)
SOURCE_DIR ${PROJECT_SOURCE_DIR}/res)
# Add a custom target to the makefile. Now make builds our resource file.
# It depends on the output RESOURCE_FILE.

View File

@ -0,0 +1,36 @@
<svg width="64" height="64" version="1.1" viewBox="0 0 16.933 16.933" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="linearGradient897-3" x1="6.8792" x2="6.8792" y1="285.36" y2="283.77" gradientTransform="matrix(.99998 0 0 .99998 0 -280.06)" gradientUnits="userSpaceOnUse">
<stop offset="0"/>
<stop stop-opacity="0" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient1769-5" x1="445.28" x2="445.28" y1="179.28" y2="200.07" gradientTransform="matrix(.38956 0 0 .38184 -165.52 -63.44)" gradientUnits="userSpaceOnUse">
<stop stop-color="#60c0f0" offset="0"/>
<stop stop-color="#83d4fb" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient860-6" x1="8.4667" x2="8.4667" y1="293.3" y2="292.77" gradientTransform="translate(0,-280.07)" gradientUnits="userSpaceOnUse">
<stop stop-color="#008ea2" stop-opacity=".25" offset="0"/>
<stop stop-color="#fff" stop-opacity=".15" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient868-1" x1="8.4667" x2="8.4667" y1="294.62" y2="293.56" gradientTransform="matrix(.99998 0 0 .99998 0 -280.06)" gradientUnits="userSpaceOnUse">
<stop stop-color="#008ea2" stop-opacity=".25098" offset="0"/>
<stop stop-color="#008ea2" stop-opacity=".15" offset=".75678"/>
<stop stop-color="#fff" stop-opacity=".15" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient907-9" x1="1.0583" x2="15.875" y1="289.59" y2="289.59" gradientTransform="translate(0,-280.07)" gradientUnits="userSpaceOnUse">
<stop stop-color="#46a2d7" stop-opacity=".5" offset="0"/>
<stop stop-color="#46a2d7" stop-opacity="0" offset=".10783"/>
<stop stop-color="#46a2d7" stop-opacity=".095808" offset=".89398"/>
<stop stop-color="#46a2d7" stop-opacity=".5" offset="1"/>
</linearGradient>
</defs>
<image x=".52916" y="1.969" width="15.875" height="13.229" image-rendering="optimizeQuality" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAyCAYAAAAA9rgCAAAACXBIWXMAAA7XAAAO1wFxhj+8AAAA GXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAbVJREFUaIHtml9TglAQRw9/jMrR 6a3v//2q0azMFOhhuXJLRgHv5G3dM8PgqHA57C68/BIOSbxtCLW3RUvy63MOFMAESOkvXQMlsAW+ gB2RiifevgDmwANwB2QDz7UD1sASWAEboApzmeHIaSs7Bx6Bmff9EGpgCtwjN2+B3ICSiKqdN/sC qewMaeehsjTH3CCd4UbjBXhHWv0S0gdrukpOkDYeU1kf1y3T5pwF0uJviHTVdREd5+izzilqZMxK vNFyglmznSPrkyKyGdLia2Sm+1T61BsiPXGsYwd8Ijd7TXOzc++PoWT9xSe07V0RpsJD3hwbpMOe kNEq86OHhMG1+SVm2D1TSuR1Wf2FsCN0B/Vd8xZ5GC+Ar2PzoIWMdrSSaxAG7xllwtoxYe2YsHZM WDsmrB0T1o4Ja8eEtWPC2jFh7ZiwdkxYOyasHRPWjglr52qFo48MnsneL6WNDfYJnPxHasStBGon vEWiPdFmJEfislofNJEpl82q+RkzukQAJTROdgU8I3mtKvd+WNJmm8aES2OjRLp2AbzSdG+o+HBs uLndIgXcj2qX0NiAeGx0Bta/AZSga/2YDpsuAAAAAElFTkSuQmCC "/>
<path d="m2.21 2.38h2.695c0.75074 0 0.78302 0.0285 1.5421 0.62962 0.78159 0.5904 0.94779 0.607 1.8636 0.607l6.4126-0.0524c0.638-5e-3 1.1517 0.51363 1.1517 1.1516v6.77c0 0.63802-0.51364 1.1517-1.1517 1.1517h-12.513c-0.63802 0-1.1517-0.51364-1.1517-1.1517v-7.9542c0-0.63802 0.51364-1.1517 1.1517-1.1517z" fill="#46a2d7"/>
<path d="m2.2102 2.3812c-0.63801 0-1.1518 0.51384-1.1518 1.1518v2.8167h14.816v-1.633c0-0.63801-0.51387-1.1563-1.1518-1.1513l-6.4124 0.052194c-0.91582 0-1.0818-0.016798-1.8634-0.60718-0.75908-0.6011-0.79128-0.62941-1.542-0.62941h-2.695z" fill="url(#linearGradient897-3)" opacity=".35" stroke-width=".26458"/>
<rect x="1.0583" y="4.49" width="14.817" height="10.054" rx="1.1517" ry="1.1288" fill="url(#linearGradient1769-5)"/>
<rect x="1.0583" y="12.7" width="14.817" height=".52915" fill="url(#linearGradient860-6)"/>
<path d="m1.0655 13.494c0.03752 0.59168 0.5312 1.0583 1.1446 1.0583h12.513c0.6134 0 1.1071-0.46664 1.1446-1.0583h-14.802z" fill="url(#linearGradient868-1)" stroke-width=".26458"/>
<rect x="1.0583" y="4.49" width="14.817" height="10.054" rx="1.1517" ry="1.1288" fill="url(#linearGradient907-9)"/>
<path d="m2.2102 4.4979c-0.63801 0-1.1518 0.50323-1.1518 1.1286v0.23512c0-0.6089 0.51384-1.0991 1.1518-1.0991h12.513c0.63801 0 1.1518 0.49024 1.1518 1.0991v-0.23512c0-0.62536-0.51384-1.1286-1.1518-1.1286z" fill="#ffffff" opacity=".1" stroke-width=".26458"/>
<path class="ColorScheme-Text" d="m5.78 6.3295c-0.49611 0-0.89549 0.39938-0.89549 0.89549v4.0298c0 0.49611 0.39938 0.89549 0.89549 0.89549h5.3731c0.49611 0 0.89549-0.39938 0.89549-0.89549v-4.0298c0-0.49611-0.39938-0.89549-0.89549-0.89549zm0 0.44775h5.3731c0.24805 0 0.44775 0.1997 0.44775 0.44775v4.0298l-2.2387-2.2387-1.5579 1.791-1.1286-0.89549-1.3432 1.3432v-4.0298c0-0.24805 0.1997-0.44775 0.44775-0.44775zm1.1194 0.89549c-0.37094 0-0.67163 0.30069-0.67163 0.67163 0 0.37094 0.30069 0.67163 0.67163 0.67163 0.37094 0 0.67163-0.30069 0.67163-0.67163 0-0.37094-0.30069-0.67163-0.67163-0.67163z" color="#363636" fill="#000000" opacity=".15" stroke-width=".44775"/>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -0,0 +1,35 @@
<svg width="64" height="64" version="1.1" viewBox="0 0 16.933 16.933" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="linearGradient1769" x1="445.28" x2="445.28" y1="179.28" y2="200.07" gradientTransform="matrix(.38956 0 0 .38184 -165.52 -63.44)" gradientUnits="userSpaceOnUse">
<stop stop-color="#60c0f0" offset="0"/>
<stop stop-color="#83d4fb" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient860" x1="8.4667" x2="8.4667" y1="293.3" y2="292.77" gradientTransform="translate(0,-280.07)" gradientUnits="userSpaceOnUse">
<stop stop-color="#008ea2" stop-opacity=".25" offset="0"/>
<stop stop-color="#fff" stop-opacity=".15" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient868" x1="8.4667" x2="8.4667" y1="294.62" y2="293.56" gradientTransform="matrix(.99998 0 0 .99998 0 -280.06)" gradientUnits="userSpaceOnUse">
<stop stop-color="#008ea2" stop-opacity=".25098" offset="0"/>
<stop stop-color="#008ea2" stop-opacity=".15" offset=".75678"/>
<stop stop-color="#fff" stop-opacity=".15" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient897" x1="6.8792" x2="6.8792" y1="285.36" y2="283.77" gradientTransform="matrix(.99998 0 0 .99998 0 -280.06)" gradientUnits="userSpaceOnUse">
<stop offset="0"/>
<stop stop-opacity="0" offset="1"/>
</linearGradient>
<linearGradient id="linearGradient907" x1="1.0583" x2="15.875" y1="289.59" y2="289.59" gradientTransform="translate(0,-280.07)" gradientUnits="userSpaceOnUse">
<stop stop-color="#46a2d7" stop-opacity=".5" offset="0"/>
<stop stop-color="#46a2d7" stop-opacity="0" offset=".10783"/>
<stop stop-color="#46a2d7" stop-opacity=".095808" offset=".89398"/>
<stop stop-color="#46a2d7" stop-opacity=".5" offset="1"/>
</linearGradient>
</defs>
<image x=".52916" y="1.969" width="15.875" height="13.229" image-rendering="optimizeQuality" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAyCAYAAAAA9rgCAAAACXBIWXMAAA7XAAAO1wFxhj+8AAAA GXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAbVJREFUaIHtml9TglAQRw9/jMrR 6a3v//2q0azMFOhhuXJLRgHv5G3dM8PgqHA57C68/BIOSbxtCLW3RUvy63MOFMAESOkvXQMlsAW+ gB2RiifevgDmwANwB2QDz7UD1sASWAEboApzmeHIaSs7Bx6Bmff9EGpgCtwjN2+B3ICSiKqdN/sC qewMaeehsjTH3CCd4UbjBXhHWv0S0gdrukpOkDYeU1kf1y3T5pwF0uJviHTVdREd5+izzilqZMxK vNFyglmznSPrkyKyGdLia2Sm+1T61BsiPXGsYwd8Ijd7TXOzc++PoWT9xSe07V0RpsJD3hwbpMOe kNEq86OHhMG1+SVm2D1TSuR1Wf2FsCN0B/Vd8xZ5GC+Ar2PzoIWMdrSSaxAG7xllwtoxYe2YsHZM WDsmrB0T1o4Ja8eEtWPC2jFh7ZiwdkxYOyasHRPWjglr52qFo48MnsneL6WNDfYJnPxHasStBGon vEWiPdFmJEfislofNJEpl82q+RkzukQAJTROdgU8I3mtKvd+WNJmm8aES2OjRLp2AbzSdG+o+HBs uLndIgXcj2qX0NiAeGx0Bta/AZSga/2YDpsuAAAAAElFTkSuQmCC "/>
<path d="m2.21 2.38h2.695c0.75074 0 0.78302 0.0285 1.5421 0.62962 0.78159 0.5904 0.94779 0.607 1.8636 0.607l6.4126-0.0524c0.638-5e-3 1.1517 0.51363 1.1517 1.1516v6.77c0 0.63802-0.51364 1.1517-1.1517 1.1517h-12.513c-0.63802 0-1.1517-0.51364-1.1517-1.1517v-7.9542c0-0.63802 0.51364-1.1517 1.1517-1.1517z" fill="#46a2d7"/>
<path d="m2.2102 2.3812c-0.63801 0-1.1518 0.51384-1.1518 1.1518v2.8167h14.816v-1.633c0-0.63801-0.51387-1.1563-1.1518-1.1513l-6.4124 0.052194c-0.91582 0-1.0818-0.016798-1.8634-0.60718-0.75908-0.6011-0.79128-0.62941-1.542-0.62941h-2.695z" fill="url(#linearGradient897)" opacity=".35" stroke-width=".26458"/>
<rect x="1.0583" y="4.49" width="14.817" height="10.054" rx="1.1517" ry="1.1288" fill="url(#linearGradient1769)"/>
<rect x="1.0583" y="12.7" width="14.817" height=".52915" fill="url(#linearGradient860)"/>
<path d="m1.0655 13.494c0.03752 0.59168 0.5312 1.0583 1.1446 1.0583h12.513c0.6134 0 1.1071-0.46664 1.1446-1.0583h-14.802z" fill="url(#linearGradient868)" stroke-width=".26458"/>
<rect x="1.0583" y="4.49" width="14.817" height="10.054" rx="1.1517" ry="1.1288" fill="url(#linearGradient907)"/>
<path d="m2.2102 4.4979c-0.63801 0-1.1518 0.50323-1.1518 1.1286v0.23512c0-0.6089 0.51384-1.0991 1.1518-1.0991h12.513c0.63801 0 1.1518 0.49024 1.1518 1.0991v-0.23512c0-0.62536-0.51384-1.1286-1.1518-1.1286z" fill="#fff" opacity=".1" stroke-width=".26458"/>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#363636;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 7 3.0058594 L 7 8 L 2 8 L 2 8.9980469 L 7 8.9980469 L 7 14.007812 L 8 14.007812 L 8 8.9980469 L 13 8.9980469 L 13 8 L 8 8 L 8 3.0058594 L 7 3.0058594 z "
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 490 B

View File

@ -0,0 +1,8 @@
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text {
color:#363636;
}</style>
</defs>
<path class="ColorScheme-Text" d="m3 8v1h10v-1z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 281 B

View File

@ -0,0 +1,6 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color:#363636; } .ColorScheme-Text { color:#363636; }</style>
</defs>
<path d="m2 1c-1.108 0-2 0.892-2 2v9c0 1.108 0.892 2 2 2h12c1.108 0 2-0.892 2-2v-9c0-1.108-0.892-2-2-2zm0 1h12c0.554 0 1 0.446 1 1v9l-5-5-3.4794 4-2.5206-2-3 3v-9c0-0.554 0.446-1 1-1zm2.5 2c-0.82843 0-1.5 0.67157-1.5 1.5s0.67157 1.5 1.5 1.5 1.5-0.67157 1.5-1.5-0.67157-1.5-1.5-1.5z" style="fill:currentColor" class="ColorScheme-Text"/>
</svg>

After

Width:  |  Height:  |  Size: 592 B

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkBox" id="stack_box">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkStackSwitcher">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">center</property>
<property name="stack">main_stack</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox" id="back_page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">page0</property>
<property name="title" translatable="yes">Background Preferences</property>
</packing>
</child>
<child>
<!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid" id="winsize_page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">page1</property>
<property name="title" translatable="yes">Window Size Config</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>
<placeholder/>
</child>
</object>
</interface>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkStack">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<placeholder/>
</child>
</object>
</interface>

View File

@ -3,7 +3,6 @@
#include "../Gtk4/img7.xpm"
#include "image_types.hh"
#include <iostream>
#include <string>
MyPrefs::MyPrefs()
: main_box(Gtk::ORIENTATION_VERTICAL, 10),
@ -89,11 +88,20 @@ MyPrefs::MyPrefs()
// Add Main Box to window
const int margin_value = 15;
main_box.set_hexpand();
main_box.set_vexpand();
main_box.set_margin_top(margin_value);
main_box.set_margin_bottom(margin_value);
main_box.set_margin_start(margin_value);
main_box.set_margin_end(margin_value);
add(main_box);
//Get Widgets for multi pages
stackbuilder = Gtk::Builder::create_from_resource("/org/gtk/daleclack/prefs_stack.ui");
stackbuilder->get_widget("stack_box",stack_box);
stackbuilder->get_widget("back_page",back_page);
back_page->pack_start(main_box);
add(*stack_box);
show_all_children();
}
@ -199,6 +207,22 @@ int MyPrefs::sort_func(const Gtk::TreeModel::iterator &a, const Gtk::TreeModel::
}
}
bool MyPrefs::icasecompare(const std::string &a, const std::string &b)
{
if (a.length() == b.length())
{
return std::equal(a.begin(), a.end(), b.begin(),
[](char a, char b)
{
return tolower(a) == tolower(b);
});
}
else
{
return false;
}
}
void MyPrefs::update_images_view(std::string &folder_path)
{
// Unselect everything
@ -235,7 +259,7 @@ void MyPrefs::update_images_view(std::string &folder_path)
for (int i = 0; supported_globs[i] != NULL; i++)
{
std::string glob = std::string(supported_globs[i]);
if (glob == pattern)
if (icasecompare(glob, pattern))
{
file_valid = true;
break;

View File

@ -1,6 +1,7 @@
#pragma once
#include <gtkmm.h>
#include <string>
class MyPrefs : public Gtk::Window
{
@ -34,10 +35,11 @@ private:
// Widget for parent window
Gtk::Image *background1;
//Page switcher and another page
Glib::RefPtr<Gtk::Builder> stackbuilder;
Gtk::Box *stack_box, *back_page;
// Child Widgets
Gtk::Stack *stack;
Gtk::TreeView folders_view, images_view;
Gtk::ScrolledWindow sw_folders, sw_images;
Gtk::Box main_box, views_box, btnbox;
@ -50,6 +52,7 @@ private:
// Sort for ListStore
int sort_func(const Gtk::TreeModel::iterator &a, const Gtk::TreeModel::iterator &b);
bool icasecompare(const std::string &a, const std::string &b);
// Signal Handlers
void btnadd_clicked();