EventHandler() :
     eg(EventGenerator::Get()), m_loop(0), m_count(0), m_watcher(0)
 {
     m_loop = new wxEventLoop();
     Connect(wxEVT_IDLE, wxIdleEventHandler(EventHandler::OnIdle));
     Connect(wxEVT_FSWATCHER, wxFileSystemWatcherEventHandler(
                                         EventHandler::OnFileSystemEvent));
 }
Пример #2
0
 EventHandler(int types = wxFSW_EVENT_ALL) :
     eg(EventGenerator::Get()), m_loop(0), m_count(0), m_watcher(0),
     m_eventTypes(types)
 {
     m_loop = new wxEventLoop();
     Connect(wxEVT_IDLE, wxIdleEventHandler(EventHandler::OnIdle));
     Connect(wxEVT_FSWATCHER, wxFileSystemWatcherEventHandler(
                 EventHandler::OnFileSystemEvent));
 }
Пример #3
0
SigUIFrame::SigUIFrame(wxFrame *frame)
    : GUIFrame(frame), val_bytecode(true), watcher(0)
{
    #ifdef _WIN32
    SetIcon(wxIcon(wxT("aaaa")));
    #endif

    icon = new wxTaskBarIcon();
    icon->Connect(wxEVT_TASKBAR_BALLOON_TIMEOUT, wxTaskBarIconEventHandler(SigUIFrame::OnBalloon), NULL, this);
    icon->Connect(wxEVT_TASKBAR_BALLOON_CLICK, wxTaskBarIconEventHandler(SigUIFrame::OnBalloon), NULL, this);

    this->Connect(wxEVT_FSWATCHER, wxFileSystemWatcherEventHandler(SigUIFrame::OnChange));

    this->Connect(wxEVT_END_PROCESS, wxProcessEventHandler(SigUIFrame::OnTerminateInstall));

    this->SetStatusBar(statusBar);
    statusBar->SetStatusText(REPO_VERSION, 1);

//    m_sig_files->SetDropTarget(new DropFiles(m_sig_files));
//    m_urls->SetDropTarget(new DropURLs(m_urls));


    editor = new ConfigEditor(GetConfigFile());
    editor->RegisterText("HTTPProxyServer", &val_proxy_server, m_proxy_server, "hostname or IP address");
    editor->RegisterInt("HTTPProxyPort", &val_proxy_port, m_proxy_port);
    editor->RegisterText("HTTPProxyUsername", &val_proxy_username, m_proxy_user);
    editor->RegisterText("HTTPProxyPassword", &val_proxy_password, m_proxy_password);
    editor->RegisterText("DatabaseMirror", &val_mirror, m_mirror, "db.COUNTRYCODE.clamav.net");
    editor->RegisterStatic("DatabaseMirror", "db.local.win.clamav.net");
    editor->RegisterBool("Bytecode", &val_bytecode, m_bytecode);
    editor->RegisterList("DatabaseCustomURL", m_urls);

    HostnameValidator mirrorValidator(&val_mirror);
    m_mirror->SetValidator(mirrorValidator);

    HostnameValidator proxyValidator(&val_proxy_server);
    m_proxy_server->SetValidator(proxyValidator);

    editor->Load();
    if (!val_proxy_port)
        val_proxy_port = 8080;//default

    TransferDataToWindow();

    if (!val_proxy_server.empty()) {
	m_proxy->SetValue(true);
	if (!val_proxy_username.empty() && !val_proxy_password.empty())
	    m_proxyauth->SetValue(true);
    }

    // update enabled status
    wxCommandEvent event;
    m_proxyOnCheckBox(event);

    if (!m_urls->IsEmpty())
	m_custom_remove->Enable();

	m_proxy->SetFocus();

    // keyboard shortcuts
    wxAcceleratorEntry entries[1];
    entries[0].Set(wxACCEL_CTRL, (int)'S', wxID_SAVE);

    wxAcceleratorTable accel(sizeof(entries)/sizeof(entries[0]), entries);
    this->SetAcceleratorTable(accel);

    //prevent window from being resizing below minimum
    this->GetSizer()->SetSizeHints(this);
    show_db(true);
}