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