Commit cc5fc1c2 authored by Robert Lancaster's avatar Robert Lancaster Committed by Jasem Mutlaq

More OSX window fixes to stay on top

parent 40ad4565
......@@ -54,7 +54,7 @@ KSWizard::KSWizard( QWidget *parent ) :
QDialog( parent )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
wizardStack = new QStackedWidget( this );
......
......@@ -38,7 +38,7 @@ ThumbnailEditor::ThumbnailEditor( ThumbnailPicker *_tp, double _w, double _h )
: QDialog( _tp ), tp( _tp )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ui = new ThumbnailEditorUI( this );
w = _w;
......
......@@ -48,7 +48,7 @@ ThumbnailPicker::ThumbnailPicker( SkyObject *o, const QPixmap &current, QWidget
: QDialog( parent ), SelectedImageIndex(-1), dd((DetailDialog*)parent), Object(o), bImageFound( false )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
wid = _w;
ht = _h;
......
......@@ -41,7 +41,7 @@ AddCatDialog::AddCatDialog( KStars *_ks )
: QDialog( ( QWidget* )_ks )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
QDir::setCurrent( QDir::homePath() );
acd = new AddCatDialogUI(this);
......
......@@ -34,7 +34,7 @@ AddLinkDialog::AddLinkDialog( QWidget *parent, const QString &oname )
: QDialog( parent ), ObjectName( oname )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ald = new AddLinkDialogUI(this);
......
......@@ -75,7 +75,7 @@ DetailDialog::DetailDialog(SkyObject *o, const KStarsDateTime &ut, GeoLocation *
Data(0), DataComet(0), Pos(0), Links(0), Adv(0), Log(0)
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
setFaceType( Tabbed );
setBackgroundRole( QPalette::Base );
......
......@@ -38,7 +38,7 @@ ExportImageDialog::ExportImageDialog(const QString &url, const QSize &size, Imag
: QDialog((QWidget*) KStars::Instance()), m_KStars(KStars::Instance()), m_Url(url), m_Size(size)
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
m_DialogUI = new ExportImageDialogUI(this);
......
......@@ -61,7 +61,7 @@ FindDialog::FindDialog( QWidget* parent ) :
m_targetObject( 0 )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ui = new FindDialogUI( this );
......
......@@ -36,7 +36,7 @@ FocusDialog::FocusDialog( KStars *_ks )
: QDialog( _ks ), ks( _ks )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
//initialize point to the current focus position
Point = *ks->map()->focus();
......
......@@ -76,7 +76,7 @@ FOVDialog::FOVDialog( QWidget* p ) :
QDialog( p )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
// Register FOV* data type
if( fovID == -1 )
......
......@@ -42,7 +42,7 @@ LocationDialog::LocationDialog( QWidget* parent ) :
QDialog( parent ), timer( 0 )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
KStarsData* data = KStarsData::Instance();
......
......@@ -37,7 +37,7 @@ TimeDialog::TimeDialog( const KStarsDateTime &now, GeoLocation *_geo, QWidget *p
: QDialog( parent ), geo( _geo )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
UTCNow = UTCFrame;
......
......@@ -50,10 +50,14 @@
EkosManager::EkosManager(QWidget *parent) : QDialog(parent)
{
#ifdef Q_OS_OSX
if(Options::independentWindowEkos())
if(Options::independentWindowEkos())
setWindowFlags(Qt::Window);
else
setWindowFlags(Qt::Tool);
else{
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
connect(QApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(changeAlwaysOnTop(Qt::ApplicationState)));
}
#endif
setupUi(this);
......@@ -168,6 +172,17 @@ EkosManager::EkosManager(QWidget *parent) : QDialog(parent)
//resize(1000,750);
}
void EkosManager::changeAlwaysOnTop(Qt::ApplicationState state)
{
if(isVisible()){
if (state == Qt::ApplicationActive)
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
else
setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
show();
}
}
EkosManager::~EkosManager()
{
delete captureProcess;
......
......@@ -152,6 +152,8 @@ public slots:
private slots:
void changeAlwaysOnTop(Qt::ApplicationState state);
void updateLog();
void clearLog();
......
......@@ -41,7 +41,7 @@ internalCalibration::internalCalibration(cgmath *mathObject, Ekos::Guide *parent
: QWidget(parent)
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ui.setupUi(this);
......
......@@ -31,7 +31,7 @@ ProfileEditorUI::ProfileEditorUI( QWidget *p ) : QFrame( p )
ProfileEditor::ProfileEditor(QWidget *w ) : QDialog( w )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ui = new ProfileEditorUI( this );
......
......@@ -72,9 +72,11 @@ FITSViewer::FITSViewer (QWidget *parent)
{
#ifdef Q_OS_OSX
if(Options::independentWindowFITS())
setWindowFlags(Qt::Window);
else
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Window);
else{
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
connect(QApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(changeAlwaysOnTop(Qt::ApplicationState)));
}
#endif
fitsTab = new QTabWidget(this);
......@@ -266,6 +268,17 @@ FITSViewer::FITSViewer (QWidget *parent)
resize(INITIAL_W, INITIAL_H);
}
void FITSViewer::changeAlwaysOnTop(Qt::ApplicationState state)
{
if(isVisible()){
if (state == Qt::ApplicationActive)
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
else
setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
show();
}
}
FITSViewer::~FITSViewer()
{
fitsTab->disconnect();
......
......@@ -88,7 +88,7 @@ protected:
void showEvent(QShowEvent *);
public slots:
void changeAlwaysOnTop(Qt::ApplicationState state);
void openFile();
void saveFile();
void saveFileAs();
......
......@@ -94,7 +94,7 @@ DriverManager::DriverManager(QWidget *parent)
: QDialog( parent )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
currentPort = Options::serverPortStart().toInt()-1;
......
......@@ -58,9 +58,11 @@ GUIManager::GUIManager(QWidget *parent) : QWidget(parent, Qt::Window)
{
#ifdef Q_OS_OSX
if(Options::independentWindowINDI())
setWindowFlags(Qt::Window);
else
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Window);
else{
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
connect(QApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(changeAlwaysOnTop(Qt::ApplicationState)));
}
#endif
mainLayout = new QVBoxLayout(this);
......@@ -92,6 +94,17 @@ GUIManager::GUIManager(QWidget *parent) : QWidget(parent, Qt::Window)
resize( 640, 480);
}
void GUIManager::changeAlwaysOnTop(Qt::ApplicationState state)
{
if(isVisible()){
if (state == Qt::ApplicationActive)
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
else
setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
show();
}
}
void GUIManager::closeEvent(QCloseEvent * /*event*/)
{
KStars *ks = KStars::Instance();
......
......@@ -81,6 +81,7 @@ protected:
QList<INDI_D*> guidevices;
public slots:
void changeAlwaysOnTop(Qt::ApplicationState state);
void clearLog();
void buildDevice(DeviceInfo *di);
void removeDevice(DeviceInfo *di);
......
......@@ -53,7 +53,7 @@ INDI_D::INDI_D(GUIManager *in_manager, INDI::BaseDevice *in_dv, ClientManager *i
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
......
......@@ -63,7 +63,7 @@ DeviceManagerUI::DeviceManagerUI(QWidget *parent) : QFrame(parent)
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
setupUi(this);
......
......@@ -70,6 +70,7 @@ KStars::KStars( bool doSplash, bool clockrun, const QString &startdate )
{
setWindowTitle(i18n("KStars"));
// Initialize logging settings
if (Options::disableLogging())
KSUtils::Logging::Disable();
......
......@@ -643,7 +643,7 @@ void KStars::slotViewOps() {
KConfigDialog* dialog = new KConfigDialog( this, "settings",
Options::self() );
#ifdef Q_OS_OSX
dialog->setWindowFlags(Qt::Tool);
dialog->setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
connect( dialog, SIGNAL( settingsChanged( const QString &) ), this, SLOT( slotApplyConfigChanges() ) );
......
......@@ -41,7 +41,7 @@ Execute::Execute() {
QWidget *w = new QWidget;
ui.setupUi( w );
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
QVBoxLayout *mainLayout = new QVBoxLayout;
......
......@@ -30,7 +30,7 @@ FovEditorDialogUI::FovEditorDialogUI(QWidget *parent) : QFrame(parent)
{
setupUi(this);
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
setWindowTitle(i18n("Field of View Snapshot Browser"));
......
......@@ -397,7 +397,7 @@ void PrintingWizard::slotNextPage()
void PrintingWizard::setupWidgets()
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
m_WizardStack = new QStackedWidget(this);
......
......@@ -29,7 +29,7 @@
AddDeepSkyObject::AddDeepSkyObject( QWidget *parent, SyncedCatalogComponent *catalog ) :
QDialog( parent ), m_catalog( catalog ), ui( new Ui::AddDeepSkyObject ) {
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
Q_ASSERT( catalog );
ui->setupUi( this );
......
......@@ -58,7 +58,7 @@ AltVsTime::AltVsTime( QWidget* parent) :
QDialog( parent )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
setWindowTitle(i18n( "Altitude vs. Time" ) );
......
......@@ -45,7 +45,7 @@ AstroCalc::AstroCalc( QWidget* parent ) :
QDialog( parent )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
// List of messages. Maybe there is better place for it...
......
......@@ -39,7 +39,7 @@ ExportEyepieceView::ExportEyepieceView( const SkyPoint *_sp, const KStarsDateTim
QWidget *parent ) : QDialog( parent ), m_dt( dt ) {
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
m_sp = new SkyPoint( *_sp ); // Work on a copy.
......
......@@ -48,7 +48,7 @@
EyepieceField::EyepieceField( QWidget *parent ) : QDialog( parent ) {
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
setWindowTitle( i18n( "Eyepiece Field View" ) );
......
......@@ -49,7 +49,7 @@ FlagManager::FlagManager( QWidget *ks )
: QDialog( ks )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
QList<QStandardItem*> itemList;
QList<QImage> imageList;
......
......@@ -38,7 +38,7 @@ HorizonManager::HorizonManager( QWidget *w )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ui = new HorizonManagerUI( this );
......
......@@ -48,7 +48,7 @@ JMoonTool::JMoonTool(QWidget *parent)
setWindowTitle( i18n("Jupiter Moons Tool") );
setModal( false );
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
QVBoxLayout *vlay = new QVBoxLayout;
......
......@@ -23,7 +23,7 @@ MoonPhaseTool::MoonPhaseTool(QWidget *parent)
: QDialog( parent, Qt::Dialog )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
//KStarsDateTime dtStart ( KStarsDateTime::currentDateTime() );
......
......@@ -96,7 +96,7 @@ ObservingList::ObservingList()
isModified(false), bIsLarge(true), m_dl( 0 )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ui = new ObservingListUI( this );
QVBoxLayout *mainLayout= new QVBoxLayout;
......
......@@ -42,7 +42,7 @@ ObsListWizard::ObsListWizard( QWidget *ksparent ) :
QDialog( ksparent )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
olw = new ObsListWizardUI( this );
QVBoxLayout *mainLayout = new QVBoxLayout;
......
......@@ -51,7 +51,7 @@ PlanetViewer::PlanetViewer(QWidget *parent)
: QDialog( parent ), scale(1.0), isClockRunning(false), tmr(this)
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
KStarsData *data = KStarsData::Instance();
pw = new PlanetViewerUI( this );
......
......@@ -48,7 +48,7 @@
OptionsTreeViewWidget::OptionsTreeViewWidget( QWidget *p ) : QFrame( p ) {
setupUi( this );
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
}
......@@ -119,7 +119,7 @@ ScriptNameDialog::ScriptNameDialog( QWidget *p )
: QDialog( p )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
snw = new ScriptNameWidget( this );
......@@ -159,7 +159,7 @@ ScriptBuilder::ScriptBuilder( QWidget *parent )
currentScriptName(), currentAuthor()
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
ks = (KStars*)parent;
sb = new ScriptBuilderUI(this);
......
......@@ -45,7 +45,7 @@ SkyCalendar::SkyCalendar( QWidget *parent )
: QDialog( parent )
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
scUI = new SkyCalendarUI( this );
......
......@@ -53,7 +53,7 @@ WUTDialog::WUTDialog( QWidget *parent, bool _session, GeoLocation *_geo, KStarsD
timer(NULL)
{
#ifdef Q_OS_OSX
setWindowFlags(Qt::Tool);
setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
WUT = new WUTDialogUI( this );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment