Commit cf72f99d authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

crossplatform keyboard checker

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64318 954022d7-b5bf-4e40-9824-e11837661b57
parent f277c473
...@@ -28,7 +28,12 @@ public: ...@@ -28,7 +28,12 @@ public:
// слоты родителю. Т.е. классу CAscApplicationManager. // слоты родителю. Т.е. классу CAscApplicationManager.
// А в либе я не буду затачиваться на QT // А в либе я не буду затачиваться на QT
((QAscMainPanel*)m_pPanel)->OpenDialogSave(sName); m_pPanel->OpenDialogSave(sName);
}
virtual void OnNeedCheckKeyboard()
{
m_pPanel->CheckKeyboard();
} }
}; };
......
...@@ -54,6 +54,9 @@ public: ...@@ -54,6 +54,9 @@ public:
((QAscApplicationManager*)pAppManager)->m_pPanel = (QAscMainPanel*)pMainPanel; ((QAscApplicationManager*)pAppManager)->m_pPanel = (QAscMainPanel*)pMainPanel;
QMetaObject::connectSlotsByName(this); QMetaObject::connectSlotsByName(this);
pAppManager->StartSpellChecker();
pAppManager->StartKeyboardChecker();
} }
~QAscMainWindow() ~QAscMainWindow()
......
...@@ -21,6 +21,7 @@ QAscMainPanel::QAscMainPanel( QWidget* parent, CAscApplicationManager* pManager, ...@@ -21,6 +21,7 @@ QAscMainPanel::QAscMainPanel( QWidget* parent, CAscApplicationManager* pManager,
QObject::connect(this, SIGNAL( signal_Modified(int,bool)) , this, SLOT( slot_Modified(int,bool)), Qt::QueuedConnection ); QObject::connect(this, SIGNAL( signal_Modified(int,bool)) , this, SLOT( slot_Modified(int,bool)), Qt::QueuedConnection );
QObject::connect(this, SIGNAL( signal_Print(int,int)) , this, SLOT( slot_Print(int,int)), Qt::QueuedConnection ); QObject::connect(this, SIGNAL( signal_Print(int,int)) , this, SLOT( slot_Print(int,int)), Qt::QueuedConnection );
QObject::connect(this, SIGNAL( signal_DialogSave()), this, SLOT( slot_DialogSave()), Qt::QueuedConnection); QObject::connect(this, SIGNAL( signal_DialogSave()), this, SLOT( slot_DialogSave()), Qt::QueuedConnection);
QObject::connect(this, SIGNAL( signal_CheckKeyboard()), this, SLOT( slot_CheckKeyboard()), Qt::QueuedConnection);
m_pManager = pManager; m_pManager = pManager;
...@@ -438,11 +439,21 @@ void QAscMainPanel::slot_DialogSave() ...@@ -438,11 +439,21 @@ void QAscMainPanel::slot_DialogSave()
m_sDownloadName = L""; m_sDownloadName = L"";
} }
void QAscMainPanel::slot_CheckKeyboard()
{
if (m_pManager)
m_pManager->CheckKeyboard();
}
void QAscMainPanel::OpenDialogSave(std::wstring sName) void QAscMainPanel::OpenDialogSave(std::wstring sName)
{ {
m_sDownloadName = sName; m_sDownloadName = sName;
emit signal_DialogSave(); emit signal_DialogSave();
} }
void QAscMainPanel::CheckKeyboard()
{
emit signal_CheckKeyboard();
}
void QAscMainPanel::resizeEvent(QResizeEvent* event) void QAscMainPanel::resizeEvent(QResizeEvent* event)
{ {
......
...@@ -18,6 +18,7 @@ signals: ...@@ -18,6 +18,7 @@ signals:
void signal_Modified(int, bool); void signal_Modified(int, bool);
void signal_Print(int, int); void signal_Print(int, int);
void signal_DialogSave(); void signal_DialogSave();
void signal_CheckKeyboard();
public: public:
QAscMainPanel( QWidget *parent, CAscApplicationManager* pManager, bool bIsCustomWindow ); QAscMainPanel( QWidget *parent, CAscApplicationManager* pManager, bool bIsCustomWindow );
...@@ -34,6 +35,7 @@ public slots: ...@@ -34,6 +35,7 @@ public slots:
void slot_Modified(int, bool); void slot_Modified(int, bool);
void slot_Print(int, int); void slot_Print(int, int);
void slot_DialogSave(); void slot_DialogSave();
void slot_CheckKeyboard();
public: public:
WId GetHwndForKeyboard() WId GetHwndForKeyboard()
...@@ -47,6 +49,7 @@ public: ...@@ -47,6 +49,7 @@ public:
virtual bool IsSupportEvent(int nEventType) { return true; } virtual bool IsSupportEvent(int nEventType) { return true; }
void OpenDialogSave(std::wstring sName); void OpenDialogSave(std::wstring sName);
void CheckKeyboard();
protected: protected:
void RecalculatePlaces(); void RecalculatePlaces();
......
...@@ -115,6 +115,8 @@ public: ...@@ -115,6 +115,8 @@ public:
void StopSpellChecker(); void StopSpellChecker();
void SpellCheck(const int& nEditorId, const std::string& sTask, int nId); void SpellCheck(const int& nEditorId, const std::string& sTask, int nId);
void StartKeyboardChecker();
virtual void OnNeedCheckKeyboard();
void CheckKeyboard(); void CheckKeyboard();
void SendKeyboardAttack(); void SendKeyboardAttack();
......
...@@ -712,6 +712,24 @@ public: ...@@ -712,6 +712,24 @@ public:
int FrameId; int FrameId;
}; };
class CAscApplicationManager_Private;
class CTimerKeyboardChecker : public NSTimers::CTimer
{
CAscApplicationManager_Private* m_pManager;
public:
CTimerKeyboardChecker(CAscApplicationManager_Private* pManagerPrivate) : NSTimers::CTimer()
{
m_pManager = pManagerPrivate;
SetInterval(100);
}
virtual ~CTimerKeyboardChecker()
{
}
protected:
virtual void OnTimer();
};
class CAscApplicationManager_Private : public CefBase, public CCookieFoundCallback, public NSThreads::CBaseThread, public CCefScriptLoader::ICefScriptLoaderCallback class CAscApplicationManager_Private : public CefBase, public CCookieFoundCallback, public NSThreads::CBaseThread, public CCefScriptLoader::ICefScriptLoaderCallback
{ {
public: public:
...@@ -736,8 +754,10 @@ public: ...@@ -736,8 +754,10 @@ public:
int m_nIsCefSaveDialogWait; int m_nIsCefSaveDialogWait;
CTimerKeyboardChecker m_oKeyboardTimer;
public: public:
CAscApplicationManager_Private() CAscApplicationManager_Private() : m_oKeyboardTimer(this)
{ {
m_pListener = NULL; m_pListener = NULL;
m_nIdCounter = 0; m_nIdCounter = 0;
...@@ -762,6 +782,7 @@ public: ...@@ -762,6 +782,7 @@ public:
void CloseApplication() void CloseApplication()
{ {
m_oKeyboardTimer.Stop();
Stop(); Stop();
m_oSpellChecker.End(); m_oSpellChecker.End();
} }
...@@ -957,6 +978,12 @@ protected: ...@@ -957,6 +978,12 @@ protected:
} }
}; };
void CTimerKeyboardChecker::OnTimer()
{
if (m_pManager->m_pMain)
m_pManager->m_pMain->OnNeedCheckKeyboard();
}
CAscApplicationManager::CAscApplicationManager() CAscApplicationManager::CAscApplicationManager()
{ {
m_pInternal = new CAscApplicationManager_Private(); m_pInternal = new CAscApplicationManager_Private();
...@@ -985,6 +1012,15 @@ void CAscApplicationManager::SpellCheck(const int& nEditorId, const std::string& ...@@ -985,6 +1012,15 @@ void CAscApplicationManager::SpellCheck(const int& nEditorId, const std::string&
m_pInternal->m_oSpellChecker.AddTask(nEditorId, sTask, nId); m_pInternal->m_oSpellChecker.AddTask(nEditorId, sTask, nId);
} }
void CAscApplicationManager::StartKeyboardChecker()
{
m_pInternal->m_oKeyboardTimer.Start(0);
}
void CAscApplicationManager::OnNeedCheckKeyboard()
{
// none. evaluate in UI thread
}
void CAscApplicationManager::CheckKeyboard() void CAscApplicationManager::CheckKeyboard()
{ {
m_pInternal->m_oKeyboardChecker.Check(this, -1); m_pInternal->m_oKeyboardChecker.Check(this, -1);
......
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