StelDialog.cpp   StelDialog.cpp 
skipping to change at line 17 skipping to change at line 17
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "StelDialog.hpp" #include "StelDialog.hpp"
#include "StelMainGraphicsView.hpp" #include "StelMainGraphicsView.hpp"
#include <QDebug> #include <QDebug>
#include <QDialog> #include <QDialog>
#include <QGraphicsProxyWidget> #include <QGraphicsProxyWidget>
#include <QStyleOptionGraphicsItem> #include <QStyleOptionGraphicsItem>
skipping to change at line 75 skipping to change at line 75
{ {
} }
void StelDialog::close() void StelDialog::close()
{ {
setVisible(false); setVisible(false);
StelMainGraphicsView::getInstance().scene()->setActiveWindow(0); StelMainGraphicsView::getInstance().scene()->setActiveWindow(0);
((QGraphicsWidget*)StelMainGraphicsView::getInstance().getStelAppGra phicsWidget())->setFocus(Qt::OtherFocusReason); ((QGraphicsWidget*)StelMainGraphicsView::getInstance().getStelAppGra phicsWidget())->setFocus(Qt::OtherFocusReason);
} }
void StelDialog::languageChanged()
{
// This is here so that developers sublassing this will know they sh
ould probably do something.
// They should set up a connection in their create dialog content me
thod to handle the StellApp signal.
}
bool StelDialog::visible() const bool StelDialog::visible() const
{ {
return dialog!=NULL && dialog->isVisible(); return dialog!=NULL && dialog->isVisible();
} }
void StelDialog::setVisible(bool v) void StelDialog::setVisible(bool v)
{ {
if (v) if (v)
{ {
QSize screenSize = StelMainGraphicsView::getInstance().size( ); QSize screenSize = StelMainGraphicsView::getInstance().size( );
skipping to change at line 116 skipping to change at line 110
proxy->setFocus(); proxy->setFocus();
return; return;
} }
dialog = new QDialog(NULL); dialog = new QDialog(NULL);
//dialog->setAttribute(Qt::WA_OpaquePaintEvent, true); //dialog->setAttribute(Qt::WA_OpaquePaintEvent, true);
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);
QRectF bound = proxy->boundingRect(); QSizeF size = proxy->size();
// centre with dialog according to current window size. // centre with dialog according to current window size.
proxy->setPos((int)((screenSize.width()-bound.width())/2), ( int newX = (int)((screenSize.width() - size.width())/2);
int)((screenSize.height()-bound.height())/2)); int newY = (int)((screenSize.height() - size.height())/2);
// Make sure that the window's title bar is accessible
if (newY <-0)
newY = 0;
proxy->setPos(newX, newY);
StelMainGraphicsView::getInstance().scene()->addItem(proxy); StelMainGraphicsView::getInstance().scene()->addItem(proxy);
proxy->setWindowFrameMargins(2,0,2,2); proxy->setWindowFrameMargins(2,0,2,2);
// (this also changes the bounding rectangle size)
// The caching is buggy on all plateforms with Qt 4.5.2 // The caching is buggy on all plateforms with Qt 4.5.2
proxy->setCacheMode(QGraphicsItem::ItemCoordinateCache); proxy->setCacheMode(QGraphicsItem::ItemCoordinateCache);
proxy->setZValue(100); proxy->setZValue(100);
StelMainGraphicsView::getInstance().scene()->setActiveWindow (proxy); StelMainGraphicsView::getInstance().scene()->setActiveWindow (proxy);
proxy->setFocus(); proxy->setFocus();
} }
else else
{ {
 End of changes. 5 change blocks. 
12 lines changed or deleted 9 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/