Skip to content

Commit

Permalink
Actually save default splitter to config (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed May 2, 2021
1 parent 65147ca commit 0baf954
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ui/src/abstractlogview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ void AbstractLogView::createMenu()

saveDefaultSplitterSizesAction_ = new QAction( tr( "Save splitter position" ), this );
connect( saveDefaultSplitterSizesAction_, &QAction::triggered,
[ this ]( auto ) { this->saveDefaultSplitterSizes(); } );
[ this ]( auto ) { emit saveDefaultSplitterSizes(); } );

popupMenu_ = new QMenu( this );
highlightersMenu_ = popupMenu_->addMenu( "Highlighters" );
Expand Down
17 changes: 11 additions & 6 deletions src/ui/src/crawlerwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void CrawlerWidget::keyPressEvent( QKeyEvent* keyEvent )
void CrawlerWidget::changeEvent( QEvent* event )
{
if ( event->type() == QEvent::StyleChange ) {
dispatchToMainThread( [ this ] {
dispatchToMainThread( [this] {
loadIcons();
searchInfoLineDefaultPalette = this->palette();
} );
Expand Down Expand Up @@ -531,7 +531,7 @@ void CrawlerWidget::markLinesFromFiltered( const std::vector<LineNumber>& lines
std::vector<LineNumber> linesInMain;
linesInMain.reserve( lines.size() );
std::transform( lines.begin(), lines.end(), std::back_inserter( linesInMain ),
[ this ]( const auto& filteredLine ) {
[this]( const auto& filteredLine ) {
if ( filteredLine < logData_->getNbLine() ) {
return logFilteredData_->getMatchingLineNumber( filteredLine );
}
Expand Down Expand Up @@ -1006,9 +1006,9 @@ void CrawlerWidget::setup()
connect( visibilityBox, QOverload<int>::of( &QComboBox::currentIndexChanged ), this,
&CrawlerWidget::changeFilteredViewVisibility );

connect( logMainView, &LogMainView::newSelection, [ this ]( auto ) { logMainView->update(); } );
connect( logMainView, &LogMainView::newSelection, [this]( auto ) { logMainView->update(); } );
connect( filteredView, &FilteredView::newSelection,
[ this ]( auto ) { filteredView->update(); } );
[this]( auto ) { filteredView->update(); } );

connect( filteredView, &FilteredView::newSelection, this, &CrawlerWidget::jumpToMatchingLine );

Expand Down Expand Up @@ -1054,7 +1054,12 @@ void CrawlerWidget::setup()
connect( filteredView, &FilteredView::clearSearchLimits, this,
&CrawlerWidget::clearSearchLimits );

auto saveSplitterSizes = [ this, &config ]() { config.setSplitterSizes( this->sizes() ); };
auto saveSplitterSizes = [this]() {
LOG_INFO << "Saving default splitter size";
auto& splitterConfig = Configuration::get();
splitterConfig.setSplitterSizes( this->sizes() );
splitterConfig.save();
};

connect( logMainView, &LogMainView::saveDefaultSplitterSizes, saveSplitterSizes );
connect( filteredView, &FilteredView::saveDefaultSplitterSizes, saveSplitterSizes );
Expand Down Expand Up @@ -1249,7 +1254,7 @@ void CrawlerWidget::changeDataStatus( DataStatus status )
// Determine the right encoding and set the views.
void CrawlerWidget::updateEncoding()
{
const QTextCodec* textCodec = [ this ]() {
const QTextCodec* textCodec = [this]() {
QTextCodec* codec = nullptr;
if ( !encodingMib_ ) {
codec = logData_->getDetectedEncoding();
Expand Down

0 comments on commit 0baf954

Please sign in to comment.