This repository has been archived by the owner on Aug 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kompare_shell.h
151 lines (124 loc) · 3.98 KB
/
kompare_shell.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/***************************************************************************
kompare_shell.h
----------------
begin : Sun Mar 4 2001
Copyright 2001-2003 Otto Bruggeman <[email protected]>
Copyright 2001-2003 John Firebaugh <[email protected]>
Copyright 2007-2011 Kevin Kofler <[email protected]>
****************************************************************************/
/***************************************************************************
**
** 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.
**
***************************************************************************/
#ifndef KOMPARESHELL_H
#define KOMPARESHELL_H
#include <kapplication.h>
#include <kparts/mainwindow.h>
#include "kompare.h"
class KompareInterface;
namespace KParts {
class ReadOnlyPart;
class ReadWritePart;
}
class KToggleAction;
class KSqueezedTextLabel;
class KomparePart;
class KompareNavTreePart;
namespace KTextEditor {
class Document;
class EditInterface;
class View;
}
/**
* This is the application "Shell". It has a menubar, toolbar, and
* statusbar but relies on the "Part" to do all the real work.
*
* Adapted the shell a bit so it now handles separate view and navigation parts
*
* @short Application Shell
* @author John Firebaugh <[email protected]>
* @author Otto Bruggeman <[email protected]>
* @version 3.2.90
*/
class KompareShell : public KParts::MainWindow
{
Q_OBJECT
public:
/**
* Default Constructor
*/
KompareShell();
/**
* Default Destructor
*/
virtual ~KompareShell();
/**
* Use this method to load whatever file/URL you have
*/
void openDiff( const KUrl& url );
/**
* Use this method to load the diff from stdin
*/
void openStdin();
/**
* Use this method to compare 2 URLs (files or directories)
*/
void compare( const KUrl& source, const KUrl& destination );
/**
* Use this method to blend diff into url1 (file or directory)
*/
void blend( const KUrl& url1, const KUrl& diff );
public slots:
void slotUpdateStatusBar( int modelIndex, int differenceIndex, int modelCount, int differenceCount, int appliedCount );
KompareInterface* viewPart() const;
protected:
virtual bool queryClose();
/**
* This method is called when it is time for the app to save its
* properties for session management purposes.
*/
void saveProperties(KConfigGroup &);
/**
* This method is called when this app is restored. The KConfig
* object points to the session management config file that was saved
* with @ref saveProperties
*/
void readProperties(const KConfigGroup &);
private slots:
void slotSetStatusBarText( const QString& text );
void slotFileOpen();
void slotFileCompareFiles();
void slotFileBlendURLAndDiff();
void slotShowTextView();
void slotFileClose();
void optionsConfigureKeys();
void optionsConfigureToolbars();
void slotSetDiffString( const QString& diffString );
void newToolbarConfig();
void slotVisibilityChanged( bool visible );
private:
void setupAccel();
void setupActions();
void setupStatusBar();
private:
KUrl m_sourceURL;
KUrl m_destinationURL;
KUrl m_diffURL;
KParts::ReadWritePart* m_viewPart;
KParts::ReadOnlyPart* m_navTreePart;
KTextEditor::Document* m_textViewPart;
KTextEditor::View* m_textView;
// KTextEditor::EditInterface* m_textEditIface;
QDockWidget* m_textViewWidget;
QDockWidget* m_navTreeDock;
KToggleAction* m_showTextView;
enum Kompare::Mode m_mode;
// This is the statusbarwidget for displaying the general stuff
KSqueezedTextLabel* m_generalLabel;
QString m_diffString;
};
#endif // KOMPARE_H