Warning, file /sdk/lokalize/src/editorview.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002   This file is part of Lokalize
0003 
0004   SPDX-FileCopyrightText: 2007-2009 Nick Shaforostoff <shafff@ukr.net>
0005   SPDX-FileCopyrightText: 2018-2019 Simon Depiets <sdepiets@gmail.com>
0006 
0007   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0008 */
0009 
0010 #ifndef EDITORVIEW_H
0011 #define EDITORVIEW_H
0012 
0013 #include "pos.h"
0014 #include "state.h"
0015 #include "catalogstring.h"
0016 
0017 #include <QSplitter>
0018 
0019 class Catalog;
0020 class LedsWidget;
0021 class TranslationUnitTextEdit;
0022 class QTabBar;
0023 class QContextMenuEvent;
0024 class QDragEnterEvent;
0025 
0026 /**
0027  * This is the main view class for Lokalize Editor.
0028  * Most of the non-menu, non-toolbar, non-statusbar,
0029  * and non-dockview editing GUI code should go here.
0030  *
0031  * There are several ways (for views) to modify current msg:
0032  * -modify KTextEdit and changes will be applied to catalog automatically (plus you need to care of fuzzy indication etc)
0033  * -modify catalog directly, then call EditorWindow::gotoEntry slot
0034  * I used both :)
0035  *
0036  * @short Main editor view: source and target textedits
0037  * @author Nick Shaforostoff <shafff@ukr.net>
0038   */
0039 
0040 class EditorView: public QSplitter
0041 {
0042     Q_OBJECT
0043 public:
0044     explicit EditorView(QWidget *, Catalog*);
0045     virtual ~EditorView();
0046 
0047     QTabBar* tabBar()
0048     {
0049         return m_pluralTabBar;   //to connect tabbar signals to controller (EditorWindow) slots
0050     }
0051     QString selectionInTarget() const;//for non-batch replace
0052     QString selectionInSource() const;
0053 
0054     QObject* viewPort();
0055     void setProperFocus();
0056 
0057 public Q_SLOTS:
0058     void gotoEntry(DocPosition pos, int selection/*, bool updateHistory=true*/);
0059     void gotoEntry();
0060     void toggleApprovement();
0061     void setState(TargetState);
0062     void setEquivTrans(bool);
0063     void settingsChanged();
0064     void insertTerm(const QString&);
0065     //workaround for qt ctrl+z bug
0066     //Edit menu
0067     void unwrap();
0068     void unwrap(TranslationUnitTextEdit* editor);
0069 
0070     /*
0071         void dragEnterEvent(QDragEnterEvent* event);
0072         void dropEvent(QDropEvent*);
0073     */
0074 private:
0075     Catalog* m_catalog;
0076 
0077     TranslationUnitTextEdit * m_sourceTextEdit;
0078     TranslationUnitTextEdit * m_targetTextEdit
0079     ;
0080 
0081     QTabBar* m_pluralTabBar;
0082     LedsWidget* m_leds;
0083 
0084 public:
0085     bool m_modifiedAfterFind;//for F3-search reset
0086 
0087 Q_SIGNALS:
0088     void signalEquivTranslatedEntryDisplayed(bool);
0089     void signalApprovedEntryDisplayed(bool);
0090     void signalChangeStatusbar(const QString&);
0091     void signalChanged(uint index); //esp for mergemode...
0092     void binaryUnitSelectRequested(const QString& id);
0093     void gotoEntryRequested(const DocPosition&);
0094     void tmLookupRequested(DocPosition::Part, const QString&);
0095     //void tmLookupRequested(const QString& source, const QString& target);
0096     void findRequested();
0097     void findNextRequested();
0098     void replaceRequested();
0099     void doExplicitCompletion();
0100 
0101 private Q_SLOTS:
0102     void resetFindForCurrent(const DocPosition& pos);
0103     void toggleBookmark(bool);
0104 };
0105 
0106 
0107 class KLed;
0108 class QLabel;
0109 class LedsWidget: public QWidget
0110 {
0111     Q_OBJECT
0112 public:
0113     explicit LedsWidget(QWidget* parent);
0114 private:
0115     void contextMenuEvent(QContextMenuEvent* event) override;
0116 
0117 public Q_SLOTS:
0118     void cursorPositionChanged(int column);
0119 
0120 public:
0121     KLed* ledFuzzy;
0122     KLed* ledUntr;
0123     QLabel* lblColumn;
0124 };
0125 
0126 #endif