Skip to content

Commit

Permalink
fix fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc committed Feb 25, 2013
1 parent d6619e2 commit 42fdd8e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
17 changes: 2 additions & 15 deletions liteidex/src/liteapp/liteapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ LiteApp::LiteApp()

connect(m_goProxy,SIGNAL(done(QByteArray,QByteArray)),this,SLOT(goproxyDone(QByteArray,QByteArray)));
connect(this,SIGNAL(key_escape()),m_mainwindow,SLOT(hideToolWindow()));
connect(m_mainwindow,SIGNAL(fullScreenStateChanged(bool)),m_fullScreent,SLOT(setChecked(bool)));
}

static QImage makeSplashImage(LiteApi::IApplication *app)
Expand Down Expand Up @@ -329,20 +330,6 @@ void LiteApp::cleanup()
delete m_settings;
}

void LiteApp::fullScreen(bool b)
{
if (b) {
m_window_state.maximized = m_mainwindow->isMaximized();
m_window_state.geometry = m_mainwindow->saveGeometry();
m_mainwindow->showFullScreen();
} else {
m_mainwindow->restoreGeometry(m_window_state.geometry);
if (m_window_state.maximized) {
m_mainwindow->showMaximized();
}
}
}

void LiteApp::aboutPlugins()
{
PluginsDialog *dlg = new PluginsDialog(this,m_mainwindow);
Expand Down Expand Up @@ -620,7 +607,7 @@ void LiteApp::createActions()
connect(m_exitAct,SIGNAL(triggered()),m_mainwindow,SLOT(close()));
connect(m_aboutAct,SIGNAL(triggered()),m_mainwindow,SLOT(about()));
connect(m_aboutPluginsAct,SIGNAL(triggered()),this,SLOT(aboutPlugins()));
connect(m_fullScreent,SIGNAL(toggled(bool)),this,SLOT(fullScreen(bool)));
connect(m_fullScreent,SIGNAL(toggled(bool)),m_mainwindow,SLOT(setFullScreen(bool)));
}

void LiteApp::createMenus()
Expand Down
2 changes: 0 additions & 2 deletions liteidex/src/liteapp/liteapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ protected slots:
void currentEditorChanged(LiteApi::IEditor *editor);
void editorModifyChanged(bool);
void cleanup();
void fullScreen(bool b);
void aboutPlugins();
void escape();
protected:
Expand All @@ -140,7 +139,6 @@ protected slots:
QAction *m_logAct;
LiteAppOptionFactory *m_liteAppOptionFactory;
QList<IPlugin*> m_pluginList;
windows_state m_window_state;
static QMap<QString,QVariant> m_cookie;
protected:
QAction *m_newAct;
Expand Down
2 changes: 2 additions & 0 deletions liteidex/src/liteapp/liteapp_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
#define LITEAPP_TOOLBARICONSIZE "General/ToolBarIconSize"
#define LITEAPP_EDITTABSCLOSABLE "LiteApp/EditTabsClosable"
#define LITEAPP_QSS "LitApp/Qss"
#define LITEAPP_FULLSCREEN "LiteApp/FullScreen"
#define LITEAPP_WINSTATE "LiteApp/WinState"
#define LITEAPP_SHORTCUTS "keybord_shortcuts/"

enum TOOLBAR_ICONSIZE {
Expand Down
19 changes: 19 additions & 0 deletions liteidex/src/liteapp/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
event->acceptProposedAction();
}

void MainWindow::changeEvent(QEvent *e)
{
if (e->type() == QEvent::WindowStateChange) {
bool b = (windowState() & Qt::WindowFullScreen) != 0;
emit fullScreenStateChanged(b);
}
}

void MainWindow::setFullScreen(bool b)
{
if (bool(windowState() & Qt::WindowFullScreen) == b)
return;
if (b) {
setWindowState(windowState() | Qt::WindowFullScreen);
} else {
setWindowState(windowState() & ~Qt::WindowFullScreen);
}
}

void MainWindow::dropEvent(QDropEvent *event)
{
QList<QUrl> urls = event->mimeData()->urls();
Expand Down
4 changes: 4 additions & 0 deletions liteidex/src/liteapp/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ class MainWindow : public ToolMainWindow
virtual void closeEvent(QCloseEvent *event);
virtual void dropEvent(QDropEvent *event);
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void changeEvent(QEvent *e);
signals:
void fullScreenStateChanged(bool b);
public slots:
void setFullScreen(bool b);
void editorModifyChanged(bool b);
void currentEditorChanged(LiteApi::IEditor *editor);
void about();
Expand Down

0 comments on commit 42fdd8e

Please sign in to comment.