mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
WIP.
This commit is contained in:
@@ -1717,7 +1717,7 @@ void App::initProjectTreeView( const std::string& path ) {
|
||||
const ModelEvent* modelEvent = static_cast<const ModelEvent*>( event );
|
||||
if ( modelEvent->getModelEventType() == ModelEventType::Open ) {
|
||||
Variant vPath(
|
||||
modelEvent->getModel()->data( modelEvent->getModelIndex(), Model::Role::Custom ) );
|
||||
modelEvent->getModel()->data( modelEvent->getModelIndex(), ModelRole::Custom ) );
|
||||
if ( vPath.isValid() && vPath.is( Variant::Type::cstr ) ) {
|
||||
std::string path( vPath.asCStr() );
|
||||
UITab* tab = mEditorSplitter->isDocumentOpen( path );
|
||||
|
||||
@@ -98,7 +98,7 @@ void FileLocator::initLocateBar( UILocateBar* locateBar, UITextInput* locateInpu
|
||||
if ( modelEvent->getModelEventType() == ModelEventType::Open ) {
|
||||
Variant vPath( modelEvent->getModel()->data(
|
||||
modelEvent->getModel()->index( modelEvent->getModelIndex().row(), 1 ),
|
||||
Model::Role::Display ) );
|
||||
ModelRole::Display ) );
|
||||
if ( vPath.isValid() && vPath.is( Variant::Type::cstr ) ) {
|
||||
std::string path( vPath.asCStr() );
|
||||
UITab* tab = mEditorSplitter->isDocumentOpen( path );
|
||||
|
||||
@@ -13,7 +13,7 @@ void FileSystemListener::handleFileAction( efsw::WatchID, const std::string& dir
|
||||
case efsw::Actions::Add:
|
||||
case efsw::Actions::Delete:
|
||||
case efsw::Actions::Moved: {
|
||||
auto* node = mFileSystemModel.get()->getNodeFromPath(
|
||||
/*auto* node = mFileSystemModel.get()->getNodeFromPath(
|
||||
file.isDirectory() ? FileSystem::removeLastFolderFromPath( file.getDirectoryPath() )
|
||||
: file.getDirectoryPath(),
|
||||
true, false );
|
||||
@@ -21,7 +21,9 @@ void FileSystemListener::handleFileAction( efsw::WatchID, const std::string& dir
|
||||
!file.isHidden() ) ) {
|
||||
node->invalidate();
|
||||
mFileSystemModel.get()->invalidate();
|
||||
}
|
||||
}*/
|
||||
FileEvent event( (FileSystemEventType)action, dir, filename, oldFilename );
|
||||
mFileSystemModel.get()->handleFileEvent( event );
|
||||
|
||||
if ( mDirTree )
|
||||
mDirTree.get()->onChange( (ProjectDirectoryTree::Action)action, file, oldFilename );
|
||||
|
||||
@@ -409,7 +409,7 @@ void GlobalSearchController::initGlobalSearchTree( UITreeViewGlobalSearch* searc
|
||||
|
||||
Variant vPath( model->data( model->index( modelEvent->getModelIndex().internalId(),
|
||||
ProjectSearch::ResultModel::FileOrPosition ),
|
||||
Model::Role::Custom ) );
|
||||
ModelRole::Custom ) );
|
||||
if ( vPath.isValid() && vPath.is( Variant::Type::cstr ) ) {
|
||||
std::string path( vPath.asCStr() );
|
||||
UITab* tab = mEditorSplitter->isDocumentOpen( path );
|
||||
@@ -424,11 +424,11 @@ void GlobalSearchController::initGlobalSearchTree( UITreeViewGlobalSearch* searc
|
||||
model->data( model->index( modelEvent->getModelIndex().row(),
|
||||
ProjectSearch::ResultModel::FileOrPosition,
|
||||
modelEvent->getModelIndex().parent() ),
|
||||
Model::Role::Custom ) );
|
||||
ModelRole::Custom ) );
|
||||
Variant colNum( model->data( model->index( modelEvent->getModelIndex().row(),
|
||||
ProjectSearch::ResultModel::ColumnStart,
|
||||
modelEvent->getModelIndex().parent() ),
|
||||
Model::Role::Custom ) );
|
||||
ModelRole::Custom ) );
|
||||
if ( mEditorSplitter->getCurEditor() && lineNum.isValid() && colNum.isValid() &&
|
||||
lineNum.is( Variant::Type::Int64 ) && colNum.is( Variant::Type::Int64 ) ) {
|
||||
TextPosition pos{ lineNum.asInt64(), colNum.asInt64() };
|
||||
|
||||
@@ -29,8 +29,8 @@ class FileListModel : public Model {
|
||||
return index == 0 ? "Name" : "Path";
|
||||
}
|
||||
|
||||
virtual Variant data( const ModelIndex& index, Role role = Role::Display ) const {
|
||||
if ( role == Role::Display && index.row() < (Int64)mFiles.size() ) {
|
||||
virtual Variant data( const ModelIndex& index, ModelRole role = ModelRole::Display ) const {
|
||||
if ( role == ModelRole::Display && index.row() < (Int64)mFiles.size() ) {
|
||||
return Variant( index.column() == 0 ? mNames[index.row()].c_str()
|
||||
: mFiles[index.row()].c_str() );
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class ProjectSearch {
|
||||
return {};
|
||||
if ( !parent.isValid() )
|
||||
return createIndex( row, column, &mResult[row], -1 );
|
||||
if ( parent.data() )
|
||||
if ( parent.internalData() )
|
||||
return createIndex( row, column, &mResult[parent.row()].results[row],
|
||||
parent.row() );
|
||||
return {};
|
||||
@@ -109,9 +109,9 @@ class ProjectSearch {
|
||||
return count;
|
||||
}
|
||||
|
||||
Variant data( const ModelIndex& index, Role role = Role::Display ) const {
|
||||
Variant data( const ModelIndex& index, ModelRole role = ModelRole::Display ) const {
|
||||
static const char* EMPTY = "";
|
||||
if ( role == Role::Display ) {
|
||||
if ( role == ModelRole::Display ) {
|
||||
if ( index.internalId() == -1 ) {
|
||||
if ( index.column() == FileOrPosition ) {
|
||||
return Variant( String::format( "%s (%zu)",
|
||||
@@ -133,7 +133,7 @@ class ProjectSearch {
|
||||
.c_str() ) );
|
||||
}
|
||||
}
|
||||
} else if ( role == Role::Custom ) {
|
||||
} else if ( role == ModelRole::Custom ) {
|
||||
if ( index.internalId() != -1 ) {
|
||||
switch ( index.column() ) {
|
||||
case FileOrPosition:
|
||||
|
||||
@@ -77,7 +77,7 @@ void* UITreeViewCellGlobalSearch::getDataPtr( const ModelIndex& modelIndex ) {
|
||||
static_cast<const ProjectSearch::ResultModel*>( modelIndex.model() );
|
||||
ModelIndex index =
|
||||
model->index( modelIndex.row(), ProjectSearch::ResultModel::Data, modelIndex.parent() );
|
||||
Variant var( model->data( index, Model::Role::Custom ) );
|
||||
Variant var( model->data( index, ModelRole::Custom ) );
|
||||
if ( var.is( Variant::Type::DataPtr ) )
|
||||
return var.asDataPtr();
|
||||
return nullptr;
|
||||
@@ -122,7 +122,7 @@ UIPushButton* UITreeViewCellGlobalSearch::updateText( const std::string& text )
|
||||
if ( getCurIndex().internalId() != -1 ) {
|
||||
UITreeViewGlobalSearch* pp = getParent()->getParent()->asType<UITreeViewGlobalSearch>();
|
||||
|
||||
ProjectSearch::ResultData* res = (ProjectSearch::ResultData*)getCurIndex().parent().data();
|
||||
ProjectSearch::ResultData* res = (ProjectSearch::ResultData*)getCurIndex().parent().internalData();
|
||||
|
||||
auto styleDef = SyntaxDefinitionManager::instance()->getStyleByExtension( res->file );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user