2018-12-02 08:12:45 +08:00
# pragma once
2018-11-02 02:07:42 +08:00
# include "qtcommon.h"
namespace Ui
{
class ExtenWindow ;
}
2019-02-09 13:30:38 +08:00
struct InfoForExtension
{
const char * name ;
int64_t value ;
} ;
bool DispatchSentenceToExtensions ( std : : wstring & sentence , const InfoForExtension * miscInfo ) ;
2019-06-21 13:29:48 +08:00
void CleanupExtensions ( ) ; // must call this before exiting the program, only way to uphold guarantee that DllMain and OnNewSentence won't be called concurrently
2018-11-02 02:07:42 +08:00
class ExtenWindow : public QMainWindow
{
public :
explicit ExtenWindow ( QWidget * parent = nullptr ) ;
~ ExtenWindow ( ) ;
private :
2019-02-19 12:12:12 +08:00
inline static constexpr auto EXTEN_SAVE_FILE = u8 " SavedExtensions.txt " ;
2018-11-02 02:07:42 +08:00
void Sync ( ) ;
2018-12-21 22:34:01 +08:00
bool eventFilter ( QObject * target , QEvent * event ) override ;
2018-12-22 03:18:43 +08:00
void keyPressEvent ( QKeyEvent * event ) override ;
2018-12-21 22:34:01 +08:00
void dragEnterEvent ( QDragEnterEvent * event ) override ;
void dropEvent ( QDropEvent * event ) override ;
2018-11-02 02:07:42 +08:00
Ui : : ExtenWindow * ui ;
} ;
2019-06-29 11:16:31 +08:00
inline HMODULE LoadLibraryOnce ( std : : wstring fileName ) { if ( HMODULE module = GetModuleHandleW ( fileName . c_str ( ) ) ) return module ; return LoadLibraryW ( fileName . c_str ( ) ) ; }