"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/pathjumpui.cc" between
worker-4.7.0.tar.bz2 and worker-4.8.0.tar.bz2

About: Worker is a file manager for the X Window System with the classical two panel interface.

pathjumpui.cc  (worker-4.7.0.tar.bz2):pathjumpui.cc  (worker-4.8.0.tar.bz2)
/* pathjumpui.cc /* pathjumpui.cc
* This file belongs to Worker, a file manager for UN*X/X11. * This file belongs to Worker, a file manager for UN*X/X11.
* Copyright (C) 2012-2019 Ralf Hoffmann. * Copyright (C) 2012-2021 Ralf Hoffmann.
* You can contact me at: ralf@boomerangsworld.de * You can contact me at: ralf@boomerangsworld.de
* or http://www.boomerangsworld.de/worker * or http://www.boomerangsworld.de/worker
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 47 skipping to change at line 47
#include "worker_locale.h" #include "worker_locale.h"
#include "nwc_path.hh" #include "nwc_path.hh"
#include <algorithm> #include <algorithm>
#include "worker.h" #include "worker.h"
#include "deeppathstore.hh" #include "deeppathstore.hh"
#include "bookmarkdbproxy.hh" #include "bookmarkdbproxy.hh"
#include "persdeeppathstore.hh" #include "persdeeppathstore.hh"
#include "prefixdb.hh" #include "prefixdb.hh"
#include "wconfig.h" #include "wconfig.h"
#include "pers_kvp.hh" #include "pers_kvp.hh"
#include "async_job_limiter.hh"
#include <iostream>
#include <functional> #include <functional>
int PathJumpUI::s_pathjump_number = 1; int PathJumpUI::s_pathjump_number = 1;
static time_t get_newest_time( const std::list< std::pair< std::string, time_t > > &paths ) static time_t get_newest_time( const std::list< std::pair< std::string, time_t > > &paths )
{ {
time_t v = 0; time_t v = 0;
for ( auto &e : paths ) { for ( auto &e : paths ) {
if ( e.second > v ) { if ( e.second > v ) {
skipping to change at line 301 skipping to change at line 303
1, 0, AContainer::CO_INCWNR ); 1, 0, AContainer::CO_INCWNR );
m_filter_mode_cyb->addOption( catalog.getLocale( 981 ) ); m_filter_mode_cyb->addOption( catalog.getLocale( 981 ) );
m_filter_mode_cyb->addOption( catalog.getLocale( 982 ) ); m_filter_mode_cyb->addOption( catalog.getLocale( 982 ) );
m_filter_mode_cyb->addOption( catalog.getLocale( 983 ) ); m_filter_mode_cyb->addOption( catalog.getLocale( 983 ) );
m_filter_mode_cyb->resize( m_filter_mode_cyb->getMaxSize(), m_filter_mode_cyb->resize( m_filter_mode_cyb->getMaxSize(),
m_filter_mode_cyb->getHeight() ); m_filter_mode_cyb->getHeight() );
co1_4_1->readLimits(); co1_4_1->readLimits();
AContainer *co1_op = co1_4->add( new AContainer( m_subwin1, 2, 1 ), 0, 1 ); AContainer *co1_op = co1_4->add( new AContainer( m_subwin1, 3, 1 ), 0, 1 );
co1_op->setMaxSpace( 5 ); co1_op->setMaxSpace( 5 );
co1_op->setBorderWidth( 0 ); co1_op->setBorderWidth( 0 );
m_show_all_cb = (ChooseButton*)co1_op->add( new ChooseButton( &m_aguix, 0, 0 , m_show_all_cb = (ChooseButton*)co1_op->add( new ChooseButton( &m_aguix, 0, 0 ,
false, m_show_hidden_ entries,
catalog.getLoc ale( 977 ), catalog.getLoc ale( 977 ),
LABEL_RIGHT, 0 ), LABEL_RIGHT, 0 ),
0, 0, AContainer::CO_FIXNR ); 0, 0, AContainer::CO_FIXNR );
m_ignore_date_cb = (ChooseButton*)co1_op->add( new ChooseButton( &m_aguix, 0 , 0, m_ignore_date_cb = (ChooseButton*)co1_op->add( new ChooseButton( &m_aguix, 0 , 0,
m_ignore_da te_for_sorting, m_ignore_da te_for_sorting,
catalog.get Locale( 1111 ), catalog.get Locale( 1111 ),
LABEL_RIGHT , 0 ), LABEL_RIGHT , 0 ),
1, 0, AContainer::CO_INCWNR ) ; 1, 0, AContainer::CO_INCWNR ) ;
m_show_relative_paths_cb = co1_op->addWidget( new ChooseButton( &m_aguix, 0,
0,
m_relative_v
iew_mode,
catalog.getL
ocale( 1386 ),
LABEL_RIGHT,
0 ),
2, 0, AContainer::CO_INCWNR );
AContainer *co_age = m_co1->add( new AContainerBB( m_subwin1, 7, 1 ), 0, 2 ) ; AContainer *co_age = m_co1->add( new AContainerBB( m_subwin1, 7, 1 ), 0, 2 ) ;
co_age->setMaxSpace( 5 ); co_age->setMaxSpace( 5 );
co_age->add( new Text( &m_aguix, 0, 0, catalog.getLocale( 1154 ) ), co_age->add( new Text( &m_aguix, 0, 0, catalog.getLocale( 1154 ) ),
0, 0, AContainer::CO_FIX ); 0, 0, AContainer::CO_FIX );
m_age_text = co_age->addWidget( new Text( &m_aguix, 0, 0, "----" ), m_age_text = co_age->addWidget( new Text( &m_aguix, 0, 0, "----" ),
1, 0, AContainer::CO_FIX ); 1, 0, AContainer::CO_FIX );
{ {
int textw = 0; int textw = 0;
skipping to change at line 646 skipping to change at line 654
m_k1->maximize(); m_k1->maximize();
m_k1->contMaximize(); m_k1->contMaximize();
m_k1->show(); m_k1->show();
m_mainco->readLimits(); m_mainco->readLimits();
m_win->contMaximize( true ); m_win->contMaximize( true );
m_win->setDoTabCycling( true ); m_win->setDoTabCycling( true );
m_entry_filter_age = 0; m_entry_filter_age = 0;
if ( m_entry_filter_mode == SHOW_ALL ) {
m_show_relative_paths_cb->hide();
}
} }
PathJumpUI::~PathJumpUI() PathJumpUI::~PathJumpUI()
{ {
} }
void PathJumpUI::checkExistResults() void PathJumpUI::checkExistResults()
{ {
if ( ! m_apply_state.done || if ( ! m_apply_state.done ||
( m_existence_tests.empty() && ( m_existence_tests.empty() &&
skipping to change at line 1111 skipping to change at line 1123
}); });
} }
} else if ( msg->key.key == XK_t && } else if ( msg->key.key == XK_t &&
KEYSTATEMASK( msg->key.keystate ) == ControlMa sk && KEYSTATEMASK( msg->key.keystate ) == ControlMa sk &&
m_k1->getCurOption() == 0 ) { m_k1->getCurOption() == 0 ) {
m_ignore_date_for_sorting = ! m_ignore_date_for_sortin g; m_ignore_date_for_sorting = ! m_ignore_date_for_sortin g;
m_ignore_date_cb->setState( m_ignore_date_for_sorting ); m_ignore_date_cb->setState( m_ignore_date_for_sorting );
apply_filter( m_filter, [this]( int matches ) { apply_filter( m_filter, [this]( int matches ) {
showData(); showData();
}); });
} else if ( msg->key.key == XK_r &&
KEYSTATEMASK( msg->key.keystate ) == ControlMa
sk &&
m_k1->getCurOption() == 0 ) {
m_relative_view_mode = ! m_relative_view_mode;
m_show_relative_paths_cb->setState( m_relative_view_mo
de );
m_lv_dirty = true;
showData();
} else if ( msg->key.key == XK_f && } else if ( msg->key.key == XK_f &&
KEYSTATEMASK( msg->key.keystate ) == ControlMa sk && KEYSTATEMASK( msg->key.keystate ) == ControlMa sk &&
m_k1->getCurOption() == 0 ) { m_k1->getCurOption() == 0 ) {
switch ( m_entry_filter_mode ) { switch ( m_entry_filter_mode ) {
case SHOW_ONLY_SUBDIRS: case SHOW_ONLY_SUBDIRS:
m_entry_filter_mode = SHOW_ONLY_DIRECT_SUBDIRS ; m_entry_filter_mode = SHOW_ONLY_DIRECT_SUBDIRS ;
m_filter_mode_cyb->setOption( 2 ); m_filter_mode_cyb->setOption( 2 );
m_show_relative_paths_cb->show();
break; break;
case SHOW_ONLY_DIRECT_SUBDIRS: case SHOW_ONLY_DIRECT_SUBDIRS:
m_entry_filter_mode = SHOW_ALL; m_entry_filter_mode = SHOW_ALL;
m_filter_mode_cyb->setOption( 0 ); m_filter_mode_cyb->setOption( 0 );
m_show_relative_paths_cb->hide();
break; break;
default: default:
m_entry_filter_mode = SHOW_ONLY_SUBDIRS; m_entry_filter_mode = SHOW_ONLY_SUBDIRS;
m_filter_mode_cyb->setOption( 1 ); m_filter_mode_cyb->setOption( 1 );
m_show_relative_paths_cb->show();
break; break;
} }
apply_filter( m_filter, [this]( int matches ) { apply_filter( m_filter, [this]( int matches ) {
showData(); showData();
}); });
} else if ( msg->key.key == XK_h && } else if ( msg->key.key == XK_h &&
KEYSTATEMASK( msg->key.keystate ) == ControlMa sk && KEYSTATEMASK( msg->key.keystate ) == ControlMa sk &&
m_k1->getCurOption() == 0 ) { m_k1->getCurOption() == 0 ) {
m_entry_filter_age += 1 * 60 * 60; m_entry_filter_age += 1 * 60 * 60;
skipping to change at line 1215 skipping to change at line 1237
if ( msg->choose.button == m_show_all_cb ) { if ( msg->choose.button == m_show_all_cb ) {
m_show_hidden_entries = msg->choose.state; m_show_hidden_entries = msg->choose.state;
apply_filter( m_filter, [this]( int matches ) { apply_filter( m_filter, [this]( int matches ) {
showData(); showData();
}); });
} else if ( msg->choose.button == m_ignore_date_cb ) { } else if ( msg->choose.button == m_ignore_date_cb ) {
m_ignore_date_for_sorting = m_ignore_date_cb->getState() ; m_ignore_date_for_sorting = m_ignore_date_cb->getState() ;
apply_filter( m_filter, [this]( int matches ) { apply_filter( m_filter, [this]( int matches ) {
showData(); showData();
}); });
} else if ( msg->choose.button == m_show_relative_paths_cb )
{
m_relative_view_mode = m_show_relative_paths_cb->getStat
e();
m_lv_dirty = true;
showData();
} }
break; break;
case AG_CYCLEBUTTONCLICKED: case AG_CYCLEBUTTONCLICKED:
if ( msg->cyclebutton.cyclebutton == m_filter_mode_cyb ) { if ( msg->cyclebutton.cyclebutton == m_filter_mode_cyb ) {
switch ( msg->cyclebutton.option ) { switch ( msg->cyclebutton.option ) {
case 1: case 1:
m_entry_filter_mode = SHOW_ONLY_SUBDIRS; m_entry_filter_mode = SHOW_ONLY_SUBDIRS;
m_show_relative_paths_cb->show();
break; break;
case 2: case 2:
m_entry_filter_mode = SHOW_ONLY_DIRECT_SUBDIRS; m_entry_filter_mode = SHOW_ONLY_DIRECT_SUBDIRS;
m_show_relative_paths_cb->show();
break; break;
default: default:
m_entry_filter_mode = SHOW_ALL; m_entry_filter_mode = SHOW_ALL;
m_show_relative_paths_cb->hide();
break; break;
} }
apply_filter( m_filter, [this]( int matches ) { apply_filter( m_filter, [this]( int matches ) {
showData(); showData();
}); });
} }
break; break;
case AG_SIZECHANGED: case AG_SIZECHANGED:
if ( msg->size.window == m_win->getWindow() && if ( msg->size.window == m_win->getWindow() &&
! msg->size.explicit_resize ) { ! msg->size.explicit_resize ) {
skipping to change at line 1344 skipping to change at line 1373
moveTests(); moveTests();
return endmode; return endmode;
} }
void PathJumpUI::showData() void PathJumpUI::showData()
{ {
m_ondemand_info.matcher.setMatchString( m_filter ); m_ondemand_info.matcher.setMatchString( m_filter );
if ( m_lv_dirty || if ( m_lv_dirty ) {
m_entry_filter_mode == SHOW_ONLY_DIRECT_SUBDIRS ) {
m_lv->setSize( 0 ); m_lv->setSize( 0 );
m_entry_fullnames.resize( 0 ); m_entry_fullnames.resize( 0 );
// invalidate running futures // invalidate running futures
for ( auto &e : m_existence_tests ) { for ( auto &e : m_existence_tests ) {
std::get<2>( e ) = false; std::get<2>( e ) = false;
} }
int size = 0, pos = 0; int size = 0, pos = 0;
skipping to change at line 1612 skipping to change at line 1640
} }
void PathJumpUI::setCurrentBasename( const std::string &basename ) void PathJumpUI::setCurrentBasename( const std::string &basename )
{ {
m_basename = basename; m_basename = basename;
} }
void PathJumpUI::maximizeWin() void PathJumpUI::maximizeWin()
{ {
m_lv->maximizeX(); m_lv->maximizeX();
m_lv->maximizeY();
int my_w = m_lv->getWidth() + 10; int my_w = m_lv->getWidth() + 10;
int my_h = m_lv->getHeight() + 10; int my_h = m_lv->getHeight() + 10;
if ( my_w < 400 ) my_w = 400; if ( my_w < 400 ) my_w = 400;
if ( my_h < 300 ) my_h = 300; if ( my_h < 300 ) my_h = 300;
int rx, ry, rw, rh; int rx, ry, rw, rh;
m_aguix.getLargestDimensionOfCurrentScreen( &rx, &ry, m_aguix.getLargestDimensionOfCurrentScreen( &rx, &ry,
&rw, &rh ); &rw, &rh );
skipping to change at line 1634 skipping to change at line 1661
int mw = rw * 80 / 100; int mw = rw * 80 / 100;
int mh = rh * 80 / 100; int mh = rh * 80 / 100;
m_mainco->resize( mw, mh ); m_mainco->resize( mw, mh );
m_mainco->rearrange(); m_mainco->rearrange();
if ( my_w < m_lv->getWidth() ) { if ( my_w < m_lv->getWidth() ) {
m_co1->setMinWidth( my_w, 0, 4 ); m_co1->setMinWidth( my_w, 0, 4 );
} else { } else {
m_co1->setMinWidth( m_lv->getWidth(), 0, 4 ); m_co1->setMinWidth( m_lv->getWidth(), 0, 4 );
} }
if ( my_h < m_lv->getHeight() ) {
m_co1->setMinHeight( my_h, 0, 4 );
} else {
m_co1->setMinHeight( m_lv->getHeight(), 0, 4 );
}
m_win->contMaximize( true ); m_win->contMaximize( true );
} }
void PathJumpUI::highlight_best_hit( const std::string &filter ) void PathJumpUI::highlight_best_hit( const std::string &filter )
{ {
find_entry( filter, "" ); find_entry( filter, "" );
post_filtering(); post_filtering();
showData(); showData();
skipping to change at line 1893 skipping to change at line 1915
entry_to_find = name; entry_to_find = name;
} }
for ( auto it1 = m_entries.begin(); for ( auto it1 = m_entries.begin();
it1 != m_entries.end(); it1 != m_entries.end();
it1++ ) { it1++ ) {
if ( it1->m_always_ignore ) continue; if ( it1->m_always_ignore ) continue;
if ( it1->m_type == PATH_SHOW || if ( it1->m_type == PATH_SHOW ||
it1->m_type == BOOKMARK_SHOW ) { it1->m_type == BOOKMARK_SHOW ) {
if ( AGUIXUtils::starts_with( it1->m_path, if ( NWC::Path::is_prefix_dir( it1->m_path,
entry_to_find ) || entry_to_find ) ||
first_found == false ) { first_found == false ) {
m_current_entry = it1->m_path; m_current_entry = it1->m_path;
if ( first_found ) { if ( first_found ) {
break; break;
} else { } else {
first_found = true; first_found = true;
} }
} }
} }
skipping to change at line 1959 skipping to change at line 1981
if ( found ) { if ( found ) {
if ( ! m_filter.empty() && if ( ! m_filter.empty() &&
m_entry_filter_mode == SHOW_ALL ) { m_entry_filter_mode == SHOW_ALL ) {
m_current_depth = find_best_matching_depth( m_current_entry, m_filte r ); m_current_depth = find_best_matching_depth( m_current_entry, m_filte r );
} }
} else { } else {
find_entry( name, m_filter ); find_entry( name, m_filter );
} }
if ( m_entry_filter_mode != SHOW_ALL ) {
m_lv_dirty = true;
}
post_filtering(); post_filtering();
return 0; return 0;
} }
int PathJumpUI::post_filtering() int PathJumpUI::post_filtering()
{ {
std::string prefix_filter; std::string prefix_filter;
build_current_path_components( m_current_entry ); build_current_path_components( m_current_entry );
skipping to change at line 2229 skipping to change at line 2247
std::string temp_path = ""; std::string temp_path = "";
bool exists = true; bool exists = true;
for ( std::vector< std::string >::const_iterator it1 = components.begin(); for ( std::vector< std::string >::const_iterator it1 = components.begin();
it1 != components.end(); it1 != components.end();
it1++ ) { it1++ ) {
if ( ! it1->empty() ) { if ( ! it1->empty() ) {
temp_path += "/"; temp_path += "/";
temp_path += *it1; temp_path += *it1;
if ( exists && ! NWC::FSEntry( temp_path ).entryExists() ) { if ( wconfig->getDisableBGCheckPrefix().empty() ||
exists = false; ! AGUIXUtils::starts_with( path, wconfig->getDisableBGCheckPref
ix() ) ) {
if ( exists && ! NWC::FSEntry( temp_path ).entryExists() ) {
exists = false;
}
} }
if ( exists ) { if ( exists ) {
m_current_components.push_back( std::make_pair( *it1, true ) ); m_current_components.push_back( std::make_pair( *it1, true ) );
} else { } else {
m_current_components.push_back( std::make_pair( *it1, false ) ); m_current_components.push_back( std::make_pair( *it1, false ) );
} }
} }
} }
skipping to change at line 2355 skipping to change at line 2376
break; break;
} }
m_aguix.ReplyMessage( msg ); m_aguix.ReplyMessage( msg );
} }
} }
if ( endmode == 1 ) { if ( endmode == 1 ) {
char *endptr; char *endptr;
int t = strtol( sg->getText(), &endptr, 10 ); int t = strtol( sg->getText(), &endptr, 10 );
if ( *endptr == '\0' && t >= 0 ) { if ( *endptr == '\0' && t >= 0 ) {
if ( cleanup( win, getCurrentPath() + "/", t ) != 0 ) { if ( cleanup( win, getCurrentPath(), t ) != 0 ) {
endmode = -1; endmode = -1;
} }
} else { } else {
endmode = -1; endmode = -1;
} }
} }
delete win; delete win;
return endmode == 1 ? 0 : 1; return endmode == 1 ? 0 : 1;
skipping to change at line 2609 skipping to change at line 2630
win->setCursor( AGUIX::WAIT_CURSOR ); win->setCursor( AGUIX::WAIT_CURSOR );
m_aguix.Flush(); m_aguix.Flush();
for ( auto it1 = temp_paths.begin(); for ( auto it1 = temp_paths.begin();
it1 != temp_paths.end(); it1 != temp_paths.end();
it1++ ) { it1++ ) {
time_t now = time( NULL ); time_t now = time( NULL );
processed++; processed++;
if ( ! AGUIXUtils::starts_with( it1->first, base ) ) { if ( ! NWC::Path::is_prefix_dir( base,
it1->first ) ) {
continue; continue;
} }
if ( it1->second > now ) { if ( it1->second > now ) {
continue; continue;
} }
if ( now - it1->second <= unused_since_days * 24 * 60 * 60 ) { if ( now - it1->second <= unused_since_days * 24 * 60 * 60 ) {
continue; continue;
} }
skipping to change at line 3051 skipping to change at line 3073
void PathJumpUI::updateLVData( int row, int field, void PathJumpUI::updateLVData( int row, int field,
struct FieldListView::on_demand_data &data ) struct FieldListView::on_demand_data &data )
{ {
if ( row < 0 || if ( row < 0 ||
row >= (int)m_entry_fullnames.size() ) { row >= (int)m_entry_fullnames.size() ) {
return; return;
} }
if ( field == 3 ) { if ( field == 3 ) {
std::string visibile_name; std::string visible_name;
ExistenceTest::existence_state_t e = { .exists = ExistenceTest::EXISTS_U NKNOWN, ExistenceTest::existence_state_t e = { .exists = ExistenceTest::EXISTS_U NKNOWN,
.path_length = 0 }; .path_length = 0 };
try { try {
visibile_name = std::get<0>( m_entry_fullnames.at( row ) ); visible_name = std::get<0>( m_entry_fullnames.at( row ) );
e = std::get<2>( m_entry_fullnames.at( row ) ); e = std::get<2>( m_entry_fullnames.at( row ) );
} catch (...) { } catch (...) {
} }
if ( ! visibile_name.empty() ) { if ( ! visible_name.empty() ) {
size_t adjust_strike_out = 0;
if ( m_entry_filter_mode == SHOW_ONLY_DIRECT_SUBDIRS ) { if ( m_entry_filter_mode == SHOW_ONLY_DIRECT_SUBDIRS ) {
size_t p2 = visibile_name.find( '/', m_ondemand_info.prefix_filt er_length + 1 ); size_t p2 = visible_name.find( '/', m_ondemand_info.prefix_filte r_length + 1 );
if ( p2 != std::string::npos ) { if ( p2 != std::string::npos ) {
std::string s( visibile_name, 0, p2 ); std::string s( visible_name, 0, p2 );
visible_name = s;
}
}
visibile_name = s; if ( m_entry_filter_mode != SHOW_ALL &&
m_relative_view_mode ) {
size_t start_pos = 0;
for ( int d = 0; d < m_current_depth; d++ ) {
start_pos = visible_name.find( '/', start_pos );
if ( start_pos != std::string::npos ) {
start_pos++;
}
}
if ( start_pos != std::string::npos ) {
adjust_strike_out = start_pos;
visible_name = std::string( visible_name, start_pos );
} }
} }
data.text = visibile_name; data.text = visible_name;
data.text_set = true; data.text_set = true;
if ( e.exists == ExistenceTest::EXISTS_NO ) { if ( e.exists == ExistenceTest::EXISTS_NO ) {
data.strike_out = true; data.strike_out = true;
data.strike_out_set = true; data.strike_out_set = true;
data.strike_out_start = e.path_length + 1; data.strike_out_start = e.path_length + 1 - adjust_strike_out;
data.strike_out_start_set = true; data.strike_out_start_set = true;
} }
if ( ! m_filter.empty() ) { if ( ! m_filter.empty() ) {
data.segments.clear(); data.segments.clear();
m_ondemand_info.matcher.countNonMatchingBlocks<true>( visibile_n ame, &data.segments ); m_ondemand_info.matcher.countNonMatchingBlocks<true>( visible_na me, &data.segments );
if ( data.segments.size() > 1 ) { if ( data.segments.size() > 1 ) {
data.segments_set = true; data.segments_set = true;
} }
} }
data.done = true; data.done = true;
} }
} else if ( field == 2 ) { } else if ( field == 2 ) {
try { ExistenceTest::existence_state_t e = std::get<2>( m_entry_fullnames.at(
ExistenceTest::existence_state_t e = std::get<2>( m_entry_fullnames. row ) );
at( row ) );
if ( e.exists == ExistenceTest::EXISTS_UNKNOWN ) { if ( e.exists == ExistenceTest::EXISTS_UNKNOWN ) {
std::string path = std::get<0>( m_entry_fullnames.at( row ) ); std::string path = std::get<0>( m_entry_fullnames.at( row ) );
auto f = std::async( std::launch::async, bool async_started = false;
[path] { bool do_check = true;
return ExistenceTest::checkPathExistenc
e( path ); if ( ! wconfig->getDisableBGCheckPrefix().empty() &&
} ); AGUIXUtils::starts_with( path, wconfig->getDisableBGCheckPrefix
m_existence_tests.push_back( std::make_tuple( std::move( f ), ro () ) ) {
w, true ) ); do_check = false;
} }
if ( e.exists == ExistenceTest::EXISTS_YES ) { if ( do_check && ! AsyncJobLimiter::async_job_limit_reached() ) {
data.text = ""; try {
data.text_set = true; auto f = std::async( std::launch::async,
} else if ( e.exists == ExistenceTest::EXISTS_NO ) { [path] {
data.text = ""; AsyncJobLimiter::inc_async_job();
data.text_set = true; auto res = ExistenceTest::checkPath
} else { Existence( path );
data.text = "?"; AsyncJobLimiter::dec_async_job();
data.text_set = true;
return res;
} );
m_existence_tests.push_back( std::make_tuple( std::move( f )
, row, true ) );
async_started = true;
} catch ( std::system_error &e ) {
std::cout << e.what() << std::endl;
}
}
if ( ! async_started ) {
std::promise< ExistenceTest::existence_state_t > promise;
auto f = promise.get_future();
m_existence_tests.push_back( std::make_tuple( std::move( f ), ro
w, true ) );
if ( do_check ) {
promise.set_value( ExistenceTest::checkPathExistence( path )
);
} else {
promise.set_value( { .exists = ExistenceTest::EXISTS_YES,
.path_length = path.size() } );
}
} }
} catch (...) { }
if ( e.exists == ExistenceTest::EXISTS_YES ) {
data.text = "";
data.text_set = true;
} else if ( e.exists == ExistenceTest::EXISTS_NO ) {
data.text = "";
data.text_set = true;
} else {
data.text = "?";
data.text_set = true;
} }
} else if ( field == 1 ) { } else if ( field == 1 ) {
time_t diff = 0; time_t diff = 0;
bool ignore = false; bool ignore = false;
try { try {
diff = std::get<1>( m_entry_fullnames.at( row ) ); diff = std::get<1>( m_entry_fullnames.at( row ) );
if ( diff == m_oldest_time || if ( diff == m_oldest_time ||
diff == 0 ) { diff == 0 ) {
skipping to change at line 3200 skipping to change at line 3271
t = AGUIXUtils::formatStringToString( catalog.getLocale( 111 0 ), (int)( diff / 60 / 60 / 24 / 7 ) ); t = AGUIXUtils::formatStringToString( catalog.getLocale( 111 0 ), (int)( diff / 60 / 60 / 24 / 7 ) );
} }
} }
data.text = t; data.text = t;
data.text_set = true; data.text_set = true;
} else if ( field == 2 ) { } else if ( field == 2 ) {
if ( e.exists.exists == ExistenceTest::EXISTS_UNKNOWN ) { if ( e.exists.exists == ExistenceTest::EXISTS_UNKNOWN ) {
std::string path = e.path; std::string path = e.path;
auto f = std::async( std::launch::async, bool async_started = false;
[path] { bool do_check = true;
return ExistenceTest::checkPathExistenc
e( path ); if ( ! wconfig->getDisableBGCheckPrefix().empty() &&
} ); AGUIXUtils::starts_with( path, wconfig->getDisableBGCheckPr
m_existence_tests_filter_path.push_back( std::make_tuple( std::m efix() ) ) {
ove( f ), row, true ) ); do_check = false;
}
if ( do_check && ! AsyncJobLimiter::async_job_limit_reached() )
{
try {
auto f = std::async( std::launch::async,
[path] {
AsyncJobLimiter::inc_async_job(
);
auto res = ExistenceTest::chec
kPathExistence( path );
AsyncJobLimiter::dec_async_job(
);
return res;
} );
m_existence_tests_filter_path.push_back( std::make_tuple
( std::move( f ), row, true ) );
async_started = true;
} catch ( std::system_error &e ) {
std::cout << e.what() << std::endl;
}
}
if ( ! async_started ) {
std::promise< ExistenceTest::existence_state_t > promise;
auto f = promise.get_future();
m_existence_tests_filter_path.push_back( std::make_tuple( st
d::move( f ), row, true ) );
if ( do_check ) {
promise.set_value( ExistenceTest::checkPathExistence( pa
th ) );
} else {
promise.set_value( { .exists = ExistenceTest::EXISTS_YES
,
.path_length = path.size() } );
}
}
} }
if ( e.exists.exists == ExistenceTest::EXISTS_YES ) { if ( e.exists.exists == ExistenceTest::EXISTS_YES ) {
data.text = ""; data.text = "";
data.text_set = true; data.text_set = true;
} else if ( e.exists.exists == ExistenceTest::EXISTS_NO ) { } else if ( e.exists.exists == ExistenceTest::EXISTS_NO ) {
data.text = ""; data.text = "";
data.text_set = true; data.text_set = true;
} else { } else {
data.text = "?"; data.text = "?";
skipping to change at line 3262 skipping to change at line 3366
return; return;
} }
try { try {
ExistenceTest::existence_state_t e = path_list.at( row ).exists; ExistenceTest::existence_state_t e = path_list.at( row ).exists;
if ( field == 0 ) { if ( field == 0 ) {
if ( e.exists == ExistenceTest::EXISTS_UNKNOWN ) { if ( e.exists == ExistenceTest::EXISTS_UNKNOWN ) {
std::string path = path_list.at( row ).path; std::string path = path_list.at( row ).path;
auto f = std::async( std::launch::async, bool async_started = false;
[path] { bool do_check = true;
return ExistenceTest::checkPathExistenc
e( path ); if ( ! wconfig->getDisableBGCheckPrefix().empty() &&
} ); AGUIXUtils::starts_with( path, wconfig->getDisableBGCheckPr
m_existence_tests_prog_path.push_back( std::make_tuple( std::mov efix() ) ) {
e( f ), row, true ) ); do_check = false;
}
if ( do_check && ! AsyncJobLimiter::async_job_limit_reached() )
{
try {
auto f = std::async( std::launch::async,
[path] {
AsyncJobLimiter::inc_async_job(
);
auto res = ExistenceTest::check
PathExistence( path );
AsyncJobLimiter::dec_async_job(
);
return res;
} );
m_existence_tests_prog_path.push_back( std::make_tuple(
std::move( f ), row, true ) );
async_started = true;
} catch ( std::system_error &e ) {
std::cout << e.what() << std::endl;
}
}
if ( ! async_started ) {
std::promise< ExistenceTest::existence_state_t > promise;
auto f = promise.get_future();
m_existence_tests_prog_path.push_back( std::make_tuple( std:
:move( f ), row, true ) );
if ( do_check ) {
promise.set_value( ExistenceTest::checkPathExistence( pa
th ) );
} else {
promise.set_value( { .exists = ExistenceTest::EXISTS_YES
,
.path_length = path.size() } );
}
}
} }
if ( e.exists == ExistenceTest::EXISTS_YES ) { if ( e.exists == ExistenceTest::EXISTS_YES ) {
data.text = ""; data.text = "";
data.text_set = true; data.text_set = true;
} else if ( e.exists == ExistenceTest::EXISTS_NO ) { } else if ( e.exists == ExistenceTest::EXISTS_NO ) {
data.text = ""; data.text = "";
data.text_set = true; data.text_set = true;
} else { } else {
data.text = "?"; data.text = "?";
skipping to change at line 3482 skipping to change at line 3619
if ( status != std::future_status::ready ) { if ( status != std::future_status::ready ) {
auto f = std::move( std::get<0>( *it ) ); auto f = std::move( std::get<0>( *it ) );
m_worker.enqueueFuture( std::move( f ) ); m_worker.enqueueFuture( std::move( f ) );
} }
m_existence_tests_filter_path.erase( it ); m_existence_tests_filter_path.erase( it );
it = next_it; it = next_it;
} }
} }
void PathJumpUI::setEntryFilterMode( entry_filter_mode_t m )
{
m_entry_filter_mode = m;
switch ( m_entry_filter_mode ) {
case SHOW_ONLY_SUBDIRS:
m_filter_mode_cyb->setOption( 1 );
m_show_relative_paths_cb->show();
break;
case SHOW_ONLY_DIRECT_SUBDIRS:
m_filter_mode_cyb->setOption( 2 );
m_show_relative_paths_cb->show();
break;
default:
m_filter_mode_cyb->setOption( 0 );
m_show_relative_paths_cb->hide();
break;
}
}
void PathJumpUI::setShowAllData( bool v )
{
m_show_hidden_entries = v;
m_show_all_cb->setState( v );
}
 End of changes. 39 change blocks. 
66 lines changed or deleted 229 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)