|
a/src/qtgui/rclmain.cpp |
|
b/src/qtgui/rclmain.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.11 2006-01-30 09:28:50 dockes Exp $ (C) 2005 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.12 2006-03-21 09:15:56 dockes Exp $ (C) 2005 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
39 |
#include <qwindowdefs.h>
|
39 |
#include <qwindowdefs.h>
|
40 |
#include <qcheckbox.h>
|
40 |
#include <qcheckbox.h>
|
41 |
#include <qfontdialog.h>
|
41 |
#include <qfontdialog.h>
|
42 |
#include <qspinbox.h>
|
42 |
#include <qspinbox.h>
|
43 |
#include <qcombobox.h>
|
43 |
#include <qcombobox.h>
|
44 |
#include <qtextedit.h>
|
44 |
#include <qtextbrowser.h>
|
45 |
#include <qlineedit.h>
|
45 |
#include <qlineedit.h>
|
46 |
#include <qaction.h>
|
46 |
#include <qaction.h>
|
47 |
#include <qpushbutton.h>
|
47 |
#include <qpushbutton.h>
|
48 |
#include <qimage.h>
|
48 |
#include <qimage.h>
|
49 |
#include <qiconset.h>
|
49 |
#include <qiconset.h>
|
|
... |
|
... |
56 |
#include "advsearch.h"
|
56 |
#include "advsearch.h"
|
57 |
#include "rclversion.h"
|
57 |
#include "rclversion.h"
|
58 |
#include "sortseq.h"
|
58 |
#include "sortseq.h"
|
59 |
#include "uiprefs.h"
|
59 |
#include "uiprefs.h"
|
60 |
#include "guiutils.h"
|
60 |
#include "guiutils.h"
|
|
|
61 |
#include "rclreslist.h"
|
61 |
|
62 |
|
62 |
#include "rclmain.h"
|
63 |
#include "rclmain.h"
|
63 |
#include "moc_rclmain.cpp"
|
64 |
#include "moc_rclmain.cpp"
|
64 |
|
65 |
|
65 |
extern "C" int XFlush(void *);
|
66 |
extern "C" int XFlush(void *);
|
|
... |
|
... |
79 |
curPreview = 0;
|
80 |
curPreview = 0;
|
80 |
asearchform = 0;
|
81 |
asearchform = 0;
|
81 |
sortform = 0;
|
82 |
sortform = 0;
|
82 |
sortwidth = 0;
|
83 |
sortwidth = 0;
|
83 |
uiprefs = 0;
|
84 |
uiprefs = 0;
|
84 |
|
|
|
85 |
// We manage pgup/down, but let ie the arrows for the editor to process
|
|
|
86 |
resList->reslistTE->installEventFilter(this);
|
|
|
87 |
resList->reslistTE->viewport()->installEventFilter(this);
|
|
|
88 |
// resList->viewport()->setFocusPolicy(QWidget::NoFocus);
|
|
|
89 |
|
85 |
|
90 |
// Set the focus to the search terms entry:
|
86 |
// Set the focus to the search terms entry:
|
91 |
sSearch->queryText->setFocus();
|
87 |
sSearch->queryText->setFocus();
|
92 |
|
88 |
|
93 |
// Set result list font according to user preferences.
|
89 |
// Set result list font according to user preferences.
|
|
... |
|
... |
197 |
default: return "Unknown";
|
193 |
default: return "Unknown";
|
198 |
}
|
194 |
}
|
199 |
}
|
195 |
}
|
200 |
#endif
|
196 |
#endif
|
201 |
|
197 |
|
202 |
// There are a number of events that we want to process. Not sure the
|
|
|
203 |
// ^Q thing is necessary (we have an action for this)?
|
|
|
204 |
// TODO: Some of this probably should be moved into the reslist object
|
|
|
205 |
bool RclMain::eventFilter( QObject * target, QEvent * event )
|
|
|
206 |
{
|
|
|
207 |
#if defined(SHOWEVENTS)
|
|
|
208 |
LOGDEB(("RclMain::eventFilter target %p, event %s\n", target,
|
|
|
209 |
eventTypeToStr(int(event->type()))));
|
|
|
210 |
#endif
|
|
|
211 |
if (event->type() == QEvent::KeyPress) {
|
|
|
212 |
QKeyEvent *keyEvent = (QKeyEvent *)event;
|
|
|
213 |
if (keyEvent->key() == Key_Q && (keyEvent->state() & ControlButton)) {
|
|
|
214 |
recollNeedsExit = 1;
|
|
|
215 |
} else if (keyEvent->key() == Key_Prior) {
|
|
|
216 |
resList->resPageUpOrBack();
|
|
|
217 |
return true;
|
|
|
218 |
} else if (keyEvent->key() == Key_Next) {
|
|
|
219 |
resList->resPageDownOrNext();
|
|
|
220 |
return true;
|
|
|
221 |
}
|
|
|
222 |
} else if (target == resList->reslistTE->viewport()) {
|
|
|
223 |
// We don't want btdown+drag+btup to be a click ! So monitor
|
|
|
224 |
// mouse events
|
|
|
225 |
if (event->type() == QEvent::MouseMove) {
|
|
|
226 |
LOGDEB1(("resList: MouseMove\n"));
|
|
|
227 |
if (resList->m_mouseDown)
|
|
|
228 |
resList->m_mouseDrag = true;
|
|
|
229 |
} else if (event->type() == QEvent::MouseButtonPress) {
|
|
|
230 |
LOGDEB1(("resList: MouseButtonPress\n"));
|
|
|
231 |
resList->m_mouseDown = true;
|
|
|
232 |
resList->m_mouseDrag = false;
|
|
|
233 |
} else if (event->type() == QEvent::MouseButtonRelease) {
|
|
|
234 |
LOGDEB1(("resList: MouseButtonRelease\n"));
|
|
|
235 |
resList->m_mouseDown = false;
|
|
|
236 |
} else if (event->type() == QEvent::MouseButtonDblClick) {
|
|
|
237 |
LOGDEB1(("resList: MouseButtonDblClick\n"));
|
|
|
238 |
resList->m_mouseDown = false;
|
|
|
239 |
}
|
|
|
240 |
}
|
|
|
241 |
|
|
|
242 |
return QWidget::eventFilter(target, event);
|
|
|
243 |
}
|
|
|
244 |
|
|
|
245 |
void RclMain::fileExit()
|
198 |
void RclMain::fileExit()
|
246 |
{
|
199 |
{
|
247 |
LOGDEB1(("RclMain: fileExit\n"));
|
200 |
LOGDEB1(("RclMain: fileExit\n"));
|
248 |
if (asearchform)
|
201 |
if (asearchform)
|
249 |
delete asearchform;
|
202 |
delete asearchform;
|