Исправил загрузку картинок

pull/13/head
Igor Belitskiy 3 years ago
parent e17da88c44
commit a9933b7f99

@ -447,8 +447,39 @@ void MainWindow::get_path_filemaneg() {
this->denamic_cmd(); this->denamic_cmd();
} }
vector <size_t> MainWindow::find_all(string &text, string &word) {
size_t index{};
vector <size_t> list_index;
while ((index = text.find(word, index)) != std::string::npos)
{
index += word.length();
list_index.push_back(index);
}
return list_index;
}
void MainWindow::tempalte_row(string Name, string Exec, string path , Glib::RefPtr<Gtk::ListStore> &dtk_list) { void MainWindow::tempalte_row(string Name, string Exec, string path , Glib::RefPtr<Gtk::ListStore> &dtk_list) {
Gtk::TreeModel::Row row = *(dtk_list->append()); Gtk::TreeModel::Row row = *(dtk_list->append());
string s_remove[] = {".png", ".jpg", ".jpeg", ".svg"};
string str_search = "/";
if (path.find(str_search) != string::npos){
vector <size_t> list_index = this->find_all(path, str_search);
int index = list_index.size();
if (index>1){
index = index-1;
index = list_index.at(index);
if (index){
size_t len_path = path.length();
path = path.substr(index, len_path);
}
}
}
for (string &del: s_remove){
if (path.find(del) != string::npos){
str_remove(path, del);
}
}
row[m_Columns.m_col_filename] = path; row[m_Columns.m_col_filename] = path;
row[m_Columns.m_col_description] = Name; row[m_Columns.m_col_description] = Name;
row[m_Columns.icon_name] = path; row[m_Columns.icon_name] = path;

@ -88,6 +88,7 @@ public:
void denamic_cmd(); void denamic_cmd();
void is_user_wheel(); void is_user_wheel();
void sudo_nice(); void sudo_nice();
vector <size_t> find_all(string &text, string &word);
bool focus_out_txt_cmd(GdkEventFocus* event); bool focus_out_txt_cmd(GdkEventFocus* event);
bool focus_in_txt_cmd(GdkEventFocus* event); bool focus_in_txt_cmd(GdkEventFocus* event);
void unselect_icon(Gtk::IconView *icon_entry); void unselect_icon(Gtk::IconView *icon_entry);

@ -1082,10 +1082,10 @@ specified priority</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame" id="frame1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property> <property name="halign">baseline</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
@ -1285,7 +1285,7 @@ specified priority</property>
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
@ -1304,16 +1304,16 @@ specified priority</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame" id="frame2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property> <property name="halign">baseline</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="label-xalign">0.019999999552965164</property> <property name="label-xalign">0.019999999552965164</property>
<property name="shadow-type">none</property> <property name="shadow-type">in</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
@ -1484,7 +1484,7 @@ specified priority</property>
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
@ -1503,10 +1503,10 @@ specified priority</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkFrame"> <object class="GtkFrame" id="frame3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property> <property name="halign">baseline</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
@ -1719,7 +1719,7 @@ specified priority</property>
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">True</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
@ -1827,6 +1827,14 @@ specified priority</property>
</object> </object>
</child> </child>
</object> </object>
<object class="GtkSizeGroup">
<widgets>
<widget name="boxColor"/>
<widget name="frame1"/>
<widget name="frame2"/>
<widget name="frame3"/>
</widgets>
</object>
<object class="GtkMessageDialog" id="messageError"> <object class="GtkMessageDialog" id="messageError">
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="title" translatable="yes">Внимание!</property> <property name="title" translatable="yes">Внимание!</property>

Loading…
Cancel
Save