• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

lokalize

  • sources
  • kde-4.14
  • kdesdk
  • lokalize
  • src
  • tm
tmview.h
Go to the documentation of this file.
1 /* ****************************************************************************
2  This file is part of Lokalize
3 
4  Copyright (C) 2007-2009 by Nick Shaforostoff <shafff@ukr.net>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as
8  published by the Free Software Foundation; either version 2 of
9  the License or (at your option) version 3 or any later version
10  accepted by the membership of KDE e.V. (or its successor approved
11  by the membership of KDE e.V.), which shall act as a proxy
12  defined in Section 14 of version 3 of the license.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 **************************************************************************** */
23 
24 #ifndef TMVIEW_H
25 #define TMVIEW_H
26 
27 #include "pos.h"
28 #include "tmentry.h"
29 
30 #include <kurl.h>
31 #include <ktextbrowser.h>
32 
33 #include <QDockWidget>
34 #include <QMap>
35 #include <QVector>
36 
37 class Catalog;
38 class KAction;
39 class QDropEvent;
40 class QDragEnterEvent;
41 
42 namespace ThreadWeaver{class Job;}
43 
44 #define TM_SHORTCUTS 10
45 namespace TM {
46 class TextBrowser;
47 class SelectJob;
48 
49 class TMView: public QDockWidget
50 {
51  Q_OBJECT
52 public:
53  TMView(QWidget*,Catalog*,const QVector<KAction*>&);
54  ~TMView();
55 
56  void dragEnterEvent(QDragEnterEvent* event);
57  void dropEvent(QDropEvent*);
58 
59  QSize sizeHint() const{return QSize(300,100);}
60 signals:
61 // void textReplaceRequested(const QString&);
62  void refreshRequested();
63  void textInsertRequested(const QString&);
64  void fileOpenRequested(const KUrl& path, const QString& str, const QString& ctxt);
65 
66 public slots:
67  void slotNewEntryDisplayed(const DocPosition& pos=DocPosition());
68  void slotSuggestionsCame(ThreadWeaver::Job*);
69 
70  void slotUseSuggestion(int);
71  void slotFileLoaded(const KUrl&);
72  void displayFromCache();
73 
74  void slotBatchTranslate();
75  void slotBatchTranslateFuzzy();
76 
77 private slots:
78  //i think we do not wanna cache suggestions:
79  //what if good sugg may be generated
80  //from the entry user translated 1 minute ago?
81 
82  void slotBatchSelectDone(ThreadWeaver::Job*);
83  void slotCacheSuggestions(ThreadWeaver::Job*);
84 
85  void initLater();
86  void contextMenu(const QPoint & pos);
87 
88 private:
89  bool event(QEvent *event);
90 
91 
92 private:
93  TextBrowser* m_browser;
94  Catalog* m_catalog;
95  DocPosition m_pos;
96 
97  SelectJob* m_currentSelectJob;
98  QVector<KAction*> m_actions;//need them to get shortcuts
99  QList<TMEntry> m_entries;
100  QMap<int, int> m_entryPositions;
101 
102  QString m_normTitle;
103  QString m_hasInfoTitle;
104  bool m_hasInfo;
105 
106  bool m_isBatching;
107  bool m_markAsFuzzy;
108  QMap<DocPos, QVector<TMEntry> > m_cache;
109  DocPosition m_prevCachePos;//hacky hacky
110  QList<ThreadWeaver::Job*> m_jobs;//holds pointers to all the jobs for the current file
111 };
112 
113 class TextBrowser: public KTextBrowser
114 {
115  Q_OBJECT
116 public:
117  TextBrowser(QWidget* parent):KTextBrowser(parent)
118  {
119  setContextMenuPolicy(Qt::CustomContextMenu);
120  }
121  void mouseDoubleClickEvent(QMouseEvent* event);
122 signals:
123  void textInsertRequested(const QString&);
124 };
125 
126 CatalogString targetAdapted(const TMEntry& entry, const CatalogString& ref);
127 
128 }
129 #endif
QEvent
QWidget
TM::TMView::dropEvent
void dropEvent(QDropEvent *)
Definition: tmview.cpp:206
TM::TextBrowser::TextBrowser
TextBrowser(QWidget *parent)
Definition: tmview.h:117
QDockWidget
pos.h
QMap< int, int >
TM::TextBrowser::mouseDoubleClickEvent
void mouseDoubleClickEvent(QMouseEvent *event)
Definition: tmview.cpp:136
TM::TMView::slotNewEntryDisplayed
void slotNewEntryDisplayed(const DocPosition &pos=DocPosition())
Definition: tmview.cpp:356
TM::SelectJob
Definition: jobs.h:130
QPoint
QMouseEvent
TM::TMView::slotFileLoaded
void slotFileLoaded(const KUrl &)
Definition: tmview.cpp:212
TM::targetAdapted
CatalogString targetAdapted(const TMEntry &entry, const CatalogString &ref)
this tries some black magic naturally, there are many assumptions that might not always be true ...
Definition: tmview.cpp:660
TM::TMView::~TMView
~TMView()
Definition: tmview.cpp:169
DocPosition
This struct represents a position in a catalog.
Definition: pos.h:38
TM::TMView::textInsertRequested
void textInsertRequested(const QString &)
TM::TMView::slotSuggestionsCame
void slotSuggestionsCame(ThreadWeaver::Job *)
Definition: tmview.cpp:391
QDropEvent
TM::TMView::sizeHint
QSize sizeHint() const
Definition: tmview.h:59
TM::TMView::TMView
TMView(QWidget *, Catalog *, const QVector< KAction * > &)
Definition: tmview.cpp:146
TM::TMView
Definition: tmview.h:49
QWidget::pos
QPoint pos() const
TM::TMView::slotUseSuggestion
void slotUseSuggestion(int)
Definition: tmview.cpp:974
QString
QList
tmentry.h
TM::TextBrowser
Definition: tmview.h:113
QSize
TM::TMView::displayFromCache
void displayFromCache()
Definition: tmview.cpp:379
KTextBrowser
CatalogString
data structure used to pass info about inline elements a XLIFF tag is represented by a TAGRANGE_IMAGE...
Definition: catalogstring.h:128
QVector< KAction * >
QDragEnterEvent
TM::TMView::fileOpenRequested
void fileOpenRequested(const KUrl &path, const QString &str, const QString &ctxt)
TM::TMView::refreshRequested
void refreshRequested()
TM::TMView::slotBatchTranslateFuzzy
void slotBatchTranslateFuzzy()
Definition: tmview.cpp:341
Catalog
This class represents a catalog It uses CatalogStorage interface to work with catalogs in different f...
Definition: catalog.h:74
TM::TextBrowser::textInsertRequested
void textInsertRequested(const QString &)
TM::TMView::slotBatchTranslate
void slotBatchTranslate()
Definition: tmview.cpp:326
TM::TMView::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *event)
Definition: tmview.cpp:200
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

lokalize

Skip menu "lokalize"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal