DummyDialog.cpp   DummyDialog.cpp 
skipping to change at line 21 skipping to change at line 21
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "DummyDialog.hpp" #include "DummyDialog.hpp"
#include "StelMainGraphicsView.hpp" #include "StelMainView.hpp"
#include <QDebug> #include <QDebug>
#include <QDialog> #include <QDialog>
#include <QGraphicsProxyWidget> #include <QGraphicsProxyWidget>
#include <QStyleOptionGraphicsItem> #include <QStyleOptionGraphicsItem>
#include <QLineEdit> #include <QLineEdit>
// this is adapted from DummyDialog.cpp // this is adapted from DummyDialog.cpp
class CustomProxy : public QGraphicsProxyWidget class CustomProxy : public QGraphicsProxyWidget
{ {
skipping to change at line 69 skipping to change at line 69
{ {
if (!(isActiveWindow() || event->type()==QEvent::Win dowActivate || event->type()==QEvent::GraphicsSceneMousePress)) if (!(isActiveWindow() || event->type()==QEvent::Win dowActivate || event->type()==QEvent::GraphicsSceneMousePress))
{ {
event->setAccepted(false); event->setAccepted(false);
return false; return false;
} }
return QGraphicsProxyWidget::sceneEvent(event); return QGraphicsProxyWidget::sceneEvent(event);
} }
}; };
DummyDialog::DummyDialog(StelModule* eventHandler) : dialog(NULL) DummyDialog::DummyDialog(StelModule* eventHandler)
: proxy(NULL)
, dialog(NULL)
, evtHandler(eventHandler)
{ {
evtHandler = eventHandler;
} }
DummyDialog::~DummyDialog() DummyDialog::~DummyDialog()
{ {
} }
void DummyDialog::close() void DummyDialog::close()
{ {
emit visibleChanged(false); emit visibleChanged(false);
StelMainGraphicsView::getInstance().scene()->setActiveWindow(0); StelMainView::getInstance().scene()->setActiveWindow(0);
} }
void DummyDialog::setVisible(bool v) void DummyDialog::setVisible(bool v)
{ {
if (v) if (v)
{ {
if (dialog) if (dialog)
{ {
dialog->show(); dialog->show();
StelMainGraphicsView::getInstance().scene()->setActi veWindow(proxy); StelMainView::getInstance().scene()->setActiveWindow (proxy);
proxy->setFocus(); proxy->setFocus();
return; return;
} }
dialog = new QDialog(NULL); dialog = new QDialog(NULL);
connect(dialog, SIGNAL(rejected()), this, SLOT(close())); connect(dialog, SIGNAL(rejected()), this, SLOT(close()));
createDialogContent(); createDialogContent();
proxy = new CustomProxy(NULL, Qt::Tool); proxy = new CustomProxy(NULL, Qt::Tool);
proxy->setWidget(dialog); proxy->setWidget(dialog);
StelMainGraphicsView::getInstance().scene()->addItem(proxy); StelMainView::getInstance().scene()->addItem(proxy);
proxy->setWindowFrameMargins(2,0,2,2); proxy->setWindowFrameMargins(2,0,2,2);
proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache); proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
proxy->setZValue(100); proxy->setZValue(100);
StelMainGraphicsView::getInstance().scene()->setActiveWindow (proxy); StelMainView::getInstance().scene()->setActiveWindow(proxy);
proxy->setFocus(); proxy->setFocus();
} }
else else
{ {
dialog->hide(); dialog->hide();
emit visibleChanged(false); emit visibleChanged(false);
//proxy->clearFocus(); //proxy->clearFocus();
StelMainGraphicsView::getInstance().scene()->setActiveWindow (0); StelMainView::getInstance().scene()->setActiveWindow(0);
} }
} }
bool DummyDialog::eventFilter(QObject *obj, QEvent *event) bool DummyDialog::eventFilter(QObject *obj, QEvent *event)
{ {
if (event->type() == QEvent::KeyPress) { if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
evtHandler->handleKeys(keyEvent); evtHandler->handleKeys(keyEvent);
return keyEvent->isAccepted(); return keyEvent->isAccepted();
} else { } else {
 End of changes. 8 change blocks. 
8 lines changed or deleted 10 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/