mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-21 02:22:41 +08:00
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64372 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
491e51ca2f
commit
3df993de60
@ -43,15 +43,20 @@ static std::wstring GetAppDataPath()
|
||||
class QAscMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
QWidget* m_pMainPanel;
|
||||
|
||||
public:
|
||||
explicit QAscMainWindow(QWidget *parent, CAscApplicationManager* pAppManager) : QMainWindow(parent)
|
||||
{
|
||||
#if 0
|
||||
this->resize(2000, 1000);
|
||||
QWidget* pMainPanel = new QAscMainPanel(this, pAppManager, false);
|
||||
this->setCentralWidget(pMainPanel);
|
||||
#else
|
||||
this->resize(1200, 700);
|
||||
#endif
|
||||
m_pMainPanel = new QAscMainPanel(this, pAppManager, false);
|
||||
this->setCentralWidget(m_pMainPanel);
|
||||
|
||||
((QAscApplicationManager*)pAppManager)->m_pPanel = (QAscMainPanel*)pMainPanel;
|
||||
((QAscApplicationManager*)pAppManager)->m_pPanel = (QAscMainPanel*)m_pMainPanel;
|
||||
|
||||
QMetaObject::connectSlotsByName(this);
|
||||
|
||||
@ -59,6 +64,12 @@ public:
|
||||
pAppManager->StartKeyboardChecker();
|
||||
}
|
||||
|
||||
void closeEvent(QCloseEvent*)
|
||||
{
|
||||
QAscMainPanel* pPanel = (QAscMainPanel*)m_pMainPanel;
|
||||
pPanel->GetAppManager()->GetApplication()->ExitMessageLoop();
|
||||
}
|
||||
|
||||
~QAscMainWindow()
|
||||
{
|
||||
|
||||
@ -102,6 +113,13 @@ static int AscEditor_Main( int argc, char *argv[] )
|
||||
oManager.m_oSettings.SetUserDataPath(sUserPath);
|
||||
|
||||
oCef.Init_CEF(&oManager, argc, argv);
|
||||
|
||||
bool bIsOwnMessageLoop = false;
|
||||
int nResult = oCef.RunMessageLoop(bIsOwnMessageLoop);
|
||||
|
||||
if (bIsOwnMessageLoop)
|
||||
return nResult;
|
||||
|
||||
return aa.exec();
|
||||
}
|
||||
|
||||
@ -122,7 +140,8 @@ static int AscEditor_Main( int argc, char *argv[] )
|
||||
|
||||
a.setStyleSheet("#mainPanel { margin: 0; padding: 0; }\
|
||||
#systemPanel { margin: 0; padding: 0; } \
|
||||
#centralWidget { background: #313437; }");
|
||||
#centralWidget { background: #313437; } \
|
||||
QPushButton:focus{border:none;outline:none;}");
|
||||
|
||||
// Font
|
||||
QFont mainFont = a.font();
|
||||
@ -133,8 +152,14 @@ static int AscEditor_Main( int argc, char *argv[] )
|
||||
QAscMainWindow w(NULL, pApplicationManager);
|
||||
w.show();
|
||||
|
||||
// Launch
|
||||
a.exec();
|
||||
bool bIsOwnMessageLoop = false;
|
||||
application_cef->RunMessageLoop(bIsOwnMessageLoop);
|
||||
|
||||
if (!bIsOwnMessageLoop)
|
||||
{
|
||||
// Launch
|
||||
a.exec();
|
||||
}
|
||||
|
||||
// release all subprocesses
|
||||
pApplicationManager->CloseApplication();
|
||||
|
||||
@ -63,6 +63,8 @@ public:
|
||||
void OpenDialogSave(std::wstring sName);
|
||||
void CheckKeyboard();
|
||||
|
||||
CAscApplicationManager* GetAppManager() { return m_pManager; }
|
||||
|
||||
protected:
|
||||
void RecalculatePlaces();
|
||||
|
||||
|
||||
@ -17,6 +17,9 @@ public:
|
||||
void Init_CEF(CAscApplicationManager* , int argc = 0, char* argv[] = NULL);
|
||||
virtual ~CApplicationCEF();
|
||||
void Close();
|
||||
|
||||
int RunMessageLoop(bool& is_runned);
|
||||
bool ExitMessageLoop();
|
||||
};
|
||||
|
||||
#endif // APPLICATION_CEF_H
|
||||
|
||||
@ -228,3 +228,24 @@ void CApplicationCEF::Close()
|
||||
RELEASEOBJECT(m_pInternal);
|
||||
}
|
||||
}
|
||||
|
||||
int CApplicationCEF::RunMessageLoop(bool& is_runned)
|
||||
{
|
||||
#if defined(_LINUX) && !defined(_MAC)
|
||||
is_runned = true;
|
||||
return m_pInternal->message_loop->Run();
|
||||
#else
|
||||
is_runned = false;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CApplicationCEF::ExitMessageLoop()
|
||||
{
|
||||
#if defined(_LINUX) && !defined(_MAC)
|
||||
m_pInternal->message_loop->Quit();
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user