1*bb02e0acSNicolas Bonnefon /* 2*bb02e0acSNicolas Bonnefon * Copyright (C) 2009, 2010, 2011, 2013 Nicolas Bonnefon 3*bb02e0acSNicolas Bonnefon * and other contributors 4*bb02e0acSNicolas Bonnefon * 5*bb02e0acSNicolas Bonnefon * This file is part of glogg. 6*bb02e0acSNicolas Bonnefon * 7*bb02e0acSNicolas Bonnefon * glogg is free software: you can redistribute it and/or modify 8*bb02e0acSNicolas Bonnefon * it under the terms of the GNU General Public License as published by 9*bb02e0acSNicolas Bonnefon * the Free Software Foundation, either version 3 of the License, or 10*bb02e0acSNicolas Bonnefon * (at your option) any later version. 11*bb02e0acSNicolas Bonnefon * 12*bb02e0acSNicolas Bonnefon * glogg is distributed in the hope that it will be useful, 13*bb02e0acSNicolas Bonnefon * but WITHOUT ANY WARRANTY; without even the implied warranty of 14*bb02e0acSNicolas Bonnefon * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*bb02e0acSNicolas Bonnefon * GNU General Public License for more details. 16*bb02e0acSNicolas Bonnefon * 17*bb02e0acSNicolas Bonnefon * You should have received a copy of the GNU General Public License 18*bb02e0acSNicolas Bonnefon * along with glogg. If not, see <http://www.gnu.org/licenses/>. 19*bb02e0acSNicolas Bonnefon */ 20*bb02e0acSNicolas Bonnefon 21*bb02e0acSNicolas Bonnefon // This file implements the LogMainView concrete class. 22*bb02e0acSNicolas Bonnefon // Most of the actual drawing and event management is done in AbstractLogView 23*bb02e0acSNicolas Bonnefon // Only behaviour specific to the main (top) view is implemented here. 24*bb02e0acSNicolas Bonnefon 25*bb02e0acSNicolas Bonnefon #include "logmainview.h" 26*bb02e0acSNicolas Bonnefon 27*bb02e0acSNicolas Bonnefon #include "data/logfiltereddata.h" 28*bb02e0acSNicolas Bonnefon #include "overview.h" 29*bb02e0acSNicolas Bonnefon 30*bb02e0acSNicolas Bonnefon LogMainView::LogMainView( const LogData* newLogData, 31*bb02e0acSNicolas Bonnefon const QuickFindPattern* const quickFindPattern, 32*bb02e0acSNicolas Bonnefon Overview* overview, 33*bb02e0acSNicolas Bonnefon OverviewWidget* overview_widget, 34*bb02e0acSNicolas Bonnefon QWidget* parent) 35*bb02e0acSNicolas Bonnefon : AbstractLogView( newLogData, quickFindPattern, parent ) 36*bb02e0acSNicolas Bonnefon { 37*bb02e0acSNicolas Bonnefon filteredData_ = NULL; 38*bb02e0acSNicolas Bonnefon 39*bb02e0acSNicolas Bonnefon // The main data has a real (non NULL) Overview 40*bb02e0acSNicolas Bonnefon setOverview( overview, overview_widget ); 41*bb02e0acSNicolas Bonnefon } 42*bb02e0acSNicolas Bonnefon 43*bb02e0acSNicolas Bonnefon // Just update our internal record. 44*bb02e0acSNicolas Bonnefon void LogMainView::useNewFiltering( LogFilteredData* filteredData ) 45*bb02e0acSNicolas Bonnefon { 46*bb02e0acSNicolas Bonnefon filteredData_ = filteredData; 47*bb02e0acSNicolas Bonnefon 48*bb02e0acSNicolas Bonnefon if ( getOverview() != NULL ) 49*bb02e0acSNicolas Bonnefon getOverview()->setFilteredData( filteredData_ ); 50*bb02e0acSNicolas Bonnefon } 51*bb02e0acSNicolas Bonnefon 52*bb02e0acSNicolas Bonnefon AbstractLogView::LineType LogMainView::lineType( int lineNumber ) const 53*bb02e0acSNicolas Bonnefon { 54*bb02e0acSNicolas Bonnefon if ( filteredData_ != NULL ) { 55*bb02e0acSNicolas Bonnefon LineType line_type; 56*bb02e0acSNicolas Bonnefon if ( filteredData_->isLineMarked( lineNumber ) ) 57*bb02e0acSNicolas Bonnefon line_type = Marked; 58*bb02e0acSNicolas Bonnefon else if ( filteredData_->isLineInMatchingList( lineNumber ) ) 59*bb02e0acSNicolas Bonnefon line_type = Match; 60*bb02e0acSNicolas Bonnefon else 61*bb02e0acSNicolas Bonnefon line_type = Normal; 62*bb02e0acSNicolas Bonnefon 63*bb02e0acSNicolas Bonnefon return line_type; 64*bb02e0acSNicolas Bonnefon } 65*bb02e0acSNicolas Bonnefon else 66*bb02e0acSNicolas Bonnefon return Normal; 67*bb02e0acSNicolas Bonnefon } 68