diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bf41027c6..ea559a594 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,54 +1,54 @@ include: - https://invent.kde.org/sysadmin/ci-tooling/raw/master/invent/ci-before.yml - https://invent.kde.org/sysadmin/ci-tooling/raw/master/invent/ci-applications-linux.yml build_ubuntu_18_04: stage: build image: ubuntu:bionic only: - merge_requests before_script: - sed -i -e 's/# deb-src/deb-src/g' /etc/apt/sources.list - apt-get update - apt-get build-dep --yes --no-install-recommends okular - apt-get install --yes --no-install-recommends ninja-build libkf5crash-dev script: - mkdir -p build && cd build - cmake -G Ninja .. - ninja build_ubuntu_20_04: stage: build image: ubuntu:focal only: - merge_requests before_script: - sed -i -e 's/# deb-src/deb-src/g' /etc/apt/sources.list - apt-get update - apt-get build-dep --yes --no-install-recommends okular - apt-get install --yes --no-install-recommends ninja-build script: - mkdir -p build && cd build - cmake -DOKULAR_UI=desktop -G Ninja .. - ninja - rm -rf * - cmake -DOKULAR_UI=mobile -G Ninja .. - ninja build_clazy_clang_tidy: stage: build image: debian:unstable only: - merge_requests before_script: - echo 'deb-src http://deb.debian.org/debian unstable main' >> /etc/apt/sources.list - apt-get update - apt-get build-dep --yes --no-install-recommends okular - apt-get install --yes --no-install-recommends ninja-build clazy clang clang-tidy python python-yaml libkf5crash-dev libkf5purpose-dev libegl-dev jq script: - srcdir=`pwd` && mkdir -p /tmp/okular_build && cd /tmp/okular_build && CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && cat compile_commands.aux.json | jq '[.[] | select(.file | contains("/synctex/")| not)]' > compile_commands.json - - CLAZY_CHECKS="level0,incorrect-emit,qhash-namespace,detaching-temporary,range-loop,qdeleteall,inefficient-qlist-soft,qstring-left,const-signal-or-slot,connect-3arg-lambda" ninja + - CLAZY_CHECKS="level0,incorrect-emit,qhash-namespace,detaching-temporary,range-loop,qdeleteall,inefficient-qlist-soft,qstring-left,const-signal-or-slot,connect-3arg-lambda,qproperty-without-notify" ninja # Fix the poppler header, remove when debian:unstable ships poppler 0.82 or later - sed -i "N;N;N;N; s#class MediaRendition\;\nclass MovieAnnotation\;\nclass ScreenAnnotation;#class MediaRendition\;#g" /usr/include/poppler/qt5/poppler-link.h - "run-clang-tidy -header-filter='.*/okular/.*' -checks='-*,performance-*,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-loop-convert,modernize-use-nullptr,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-branch-clone,-bugprone-incorrect-roundings' -config=\"{WarningsAsErrors: '*'}\"" diff --git a/conf/dlgperformance.cpp b/conf/dlgperformance.cpp index 1e1cc56ef..654c7d67c 100644 --- a/conf/dlgperformance.cpp +++ b/conf/dlgperformance.cpp @@ -1,69 +1,68 @@ /*************************************************************************** * Copyright (C) 2006 by Pino Toscano * * * * 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 * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #include "dlgperformance.h" #include #include #include #include "settings_core.h" #include "ui_dlgperformancebase.h" DlgPerformance::DlgPerformance( QWidget * parent ) : QWidget( parent ) { - Q_PROPERTY( QButtonGroup checkedId READ checkedId USER true ); m_dlg = new Ui_DlgPerformanceBase(); m_dlg->setupUi( this ); QFont labelFont = m_dlg->descLabel->font(); labelFont.setBold( true ); m_dlg->descLabel->setFont( labelFont ); m_dlg->cpuLabel->setPixmap( QIcon::fromTheme( QStringLiteral("cpu") ).pixmap( 32 ) ); // m_dlg->memoryLabel->setPixmap( QIcon::fromTheme( "kcmmemory" ).pixmap( 32 ) ); // TODO: enable again when proper icon is available m_dlg->memoryLevelGroup->setId(m_dlg->lowRadio, 0); m_dlg->memoryLevelGroup->setId(m_dlg->normalRadio, 1); m_dlg->memoryLevelGroup->setId(m_dlg->aggressiveRadio, 2); m_dlg->memoryLevelGroup->setId(m_dlg->greedyRadio, 3); connect(m_dlg->memoryLevelGroup, static_cast(&QButtonGroup::buttonClicked), this, &DlgPerformance::radioGroup_changed); } DlgPerformance::~DlgPerformance() { delete m_dlg; } void DlgPerformance::radioGroup_changed( int which ) { switch ( which ) { case 0: m_dlg->descLabel->setText( i18n("Keeps used memory as low as possible. Do not reuse anything. (For systems with low memory.)") ); break; case 1: m_dlg->descLabel->setText( i18n("A good compromise between memory usage and speed gain. Preload next page and boost searches. (For systems with 2GB of memory, typically.)") ); break; case 2: m_dlg->descLabel->setText( i18n("Keeps everything in memory. Preload next pages. Boost searches. (For systems with more than 4GB of memory.)") ); break; case 3: // xgettext: no-c-format m_dlg->descLabel->setText( i18n("Loads and keeps everything in memory. Preload all pages. (Will use at maximum 50% of your total memory or your free memory, whatever is bigger.)")); break; } } #include "moc_dlgperformance.cpp" diff --git a/ui/ktreeviewsearchline.h b/ui/ktreeviewsearchline.h index 0544115da..982922918 100644 --- a/ui/ktreeviewsearchline.h +++ b/ui/ktreeviewsearchline.h @@ -1,231 +1,231 @@ /* Copyright (c) 2003 Scott Wheeler Copyright (c) 2005 Rafal Rzepecki Copyright (c) 2006 Hamish Rodda Copyright 2007 Pino Toscano This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KTREEVIEWSEARCHLINE_H #define KTREEVIEWSEARCHLINE_H #include class QModelIndex; class QTreeView; /** * This class makes it easy to add a search line for filtering the items in * listviews based on a simple text search. * * No changes to the application other than instantiating this class with * appropriate QTreeViews should be needed. */ class KTreeViewSearchLine : public KLineEdit { Q_OBJECT - Q_PROPERTY( Qt::CaseSensitivity caseSensitity READ caseSensitivity WRITE setCaseSensitivity ) + Q_PROPERTY( Qt::CaseSensitivity caseSensitity READ caseSensitivity WRITE setCaseSensitivity NOTIFY searchOptionsChanged ) public: /** * Constructs a KTreeViewSearchLine with \a treeView being the QTreeView to * be filtered. * * If \a treeView is null then the widget will be disabled until listview * are set with setTreeView(). */ explicit KTreeViewSearchLine( QWidget *parent = nullptr, QTreeView *treeView = nullptr ); /** * Destroys the KTreeViewSearchLine. */ ~KTreeViewSearchLine() override; /** * Returns true if the search is case sensitive. This defaults to false. * * @see setCaseSensitive() */ Qt::CaseSensitivity caseSensitivity() const; /** * Returns true if the search is a regular expression search. This defaults to false. * * @see setRegularExpression() */ bool regularExpression() const; /** * Returns the listview that is currently filtered by the search. * * @see setTreeView() */ QTreeView *treeView() const; public Q_SLOTS: /** * Updates search to only make visible the items that match \a pattern. If * \a s is null then the line edit's text will be used. */ virtual void updateSearch( const QString &pattern = QString() ); /** * Make the search case sensitive or case insensitive. * * @see caseSenstivity() */ void setCaseSensitivity( Qt::CaseSensitivity caseSensitivity ); /** * Make the search a regular expression search or not. * * @see regularExpression() */ void setRegularExpression( bool value ); /** * Sets the QTreeView that is filtered by this search line, replacing any * previously filtered listviews. If \a treeView is null then the widget will be * disabled. * * @see treeView() */ void setTreeView( QTreeView *treeView ); Q_SIGNALS: /** * This signal is emitted when search options have been changed. It is emitted so * that users of this class can choose to save the search options to the settings. */ void searchOptionsChanged(); protected: /** * Returns true if \a parentIndex matches the search \a pattern. This will be evaluated * based on the value of caseSensitive(). This can be overridden in * subclasses to implement more complicated matching schemes. */ virtual bool itemMatches( const QModelIndex &parentIndex, int row, const QString &pattern ) const; /** * Re-implemented for internal reasons. API not affected. */ void contextMenuEvent( QContextMenuEvent* ) override; /** * Updates search to only make visible appropriate items in \a treeView. If * \a treeView is null then nothing is done. */ virtual void updateSearch( QTreeView *treeView ); /** * Connects signals of this listview to the appropriate slots of the search * line. */ virtual void connectTreeView( QTreeView* ); /** * Disconnects signals of a listviews from the search line. */ virtual void disconnectTreeView( QTreeView* ); protected Q_SLOTS: /** * When keys are pressed a new search string is created and a timer is * activated. The most recent search is activated when this timer runs out * if another key has not yet been pressed. * * This method makes @param search the most recent search and starts the * timer. * * Together with activateSearch() this makes it such that searches are not * started until there is a short break in the users typing. * * @see activateSearch() */ void queueSearch( const QString &search ); /** * When the timer started with queueSearch() expires this slot is called. * If there has been another timer started then this slot does nothing. * However if there are no other pending searches this starts the list view * search. * * @see queueSearch() */ void activateSearch(); private: class Private; Private* const d; void rowsInserted( const QModelIndex&, int, int ) const; void treeViewDeleted( QObject* ); }; /** * Creates a widget featuring a KTreeViewSearchLine, a label with the text * "Search" and a button to clear the search. */ class KTreeViewSearchLineWidget : public QWidget { Q_OBJECT public: /** * Creates a KTreeViewSearchLineWidget for \a treeView with \a parent as the * parent. */ explicit KTreeViewSearchLineWidget( QWidget *parent = nullptr, QTreeView *treeView = nullptr ); /** * Destroys the KTreeViewSearchLineWidget */ ~KTreeViewSearchLineWidget() override; /** * Returns a pointer to the search line. */ KTreeViewSearchLine *searchLine() const; protected Q_SLOTS: /** * Creates the widgets inside of the widget. This is called from the * constructor via a single shot timer so that it is guaranteed to run * after construction is complete. This makes it suitable for overriding in * subclasses. */ virtual void createWidgets(); protected: /** * Creates the search line. This can be useful to reimplement in cases where * a KTreeViewSearchLine subclass is used. * * It is const because it is be called from searchLine(), which to the user * doesn't conceptually alter the widget. */ virtual KTreeViewSearchLine *createSearchLine( QTreeView *treeView ) const; private: class Private; Private* const d; }; #endif