CWizDownloadObjectData::CWizDownloadObjectData(CWizDatabaseManager& dbMgr)
    : CWizApi(dbMgr.db())
    , m_dbMgr(dbMgr)
    , m_bInited(false)
{
    connect(this, SIGNAL(processLog(const QString&)), SLOT(processLog(const QString&)));
    connect(this, SIGNAL(processErrorLog(const QString&)), SLOT(processLog(const QString&)));
}
Ejemplo n.º 2
0
CWizSync::CWizSync(CWizDatabaseManager& dbMgr, const QString& strKbUrl /* = WIZ_API_URL */)
    : m_dbMgr(dbMgr)
    , m_bStarted(false)
{
    qRegisterMetaType<CWizGroupDataArray>("CWizGroupDataArray");

    m_kbSync = new CWizKbSync(dbMgr.db(), strKbUrl);
    connect(m_kbSync, SIGNAL(clientLoginDone()), SLOT(on_clientLoginDone()));
    connect(m_kbSync, SIGNAL(getGroupListDone(const CWizGroupDataArray&)),
            SLOT(on_getGroupListDone(const CWizGroupDataArray&)));
    connect(m_kbSync, SIGNAL(kbSyncDone(bool)), SLOT(on_kbSyncDone(bool)));

    connect(m_kbSync, SIGNAL(processLog(const QString&)),
            SIGNAL(processLog(const QString&)));
    connect(m_kbSync, SIGNAL(processDebugLog(const QString&)),
            SIGNAL(processDebugLog(const QString&)));
    connect(m_kbSync, SIGNAL(processErrorLog(const QString&)),
            SIGNAL(processErrorLog(const QString&)));
}
Ejemplo n.º 3
0
MainWindow::MainWindow(CWizDatabaseManager& dbMgr, QWidget *parent)
    : QMainWindow(parent)
    , m_core(new ICore(this))
    , m_dbMgr(dbMgr)
    , m_progress(new CWizProgressDialog(this))
    , m_settings(new CWizUserSettings(dbMgr.db()))
    , m_sync(new CWizKMSyncThread(dbMgr.db(), this))
    , m_syncTimer(new QTimer(this))
    , m_searchIndexer(new CWizSearchIndexer(m_dbMgr))
    , m_upgrade(new CWizUpgrade())
    //, m_certManager(new CWizCertManager(*this))
    , m_cipherForm(new CWizUserCipherForm(*this, this))
    , m_objectDownloaderHost(new CWizObjectDataDownloaderHost(dbMgr, this))
    //, m_avatarDownloaderHost(new CWizUserAvatarDownloaderHost(dbMgr.db().GetAvatarPath(), this))
    , m_transitionView(new CWizDocumentTransitionView(this))
    #ifndef Q_OS_MAC
    , m_labelNotice(NULL)
    , m_optionsAction(NULL)
    #endif
    #ifdef Q_OS_MAC
    , m_toolBar(new CWizMacToolBar(this))
    #else
    , m_toolBar(new QToolBar("Main", this))
    #endif
    , m_menuBar(new QMenuBar(this))
    , m_statusBar(new CWizStatusBar(*this, this))
    , m_actions(new CWizActions(*this, this))
    , m_category(new CWizCategoryView(*this, this))
    , m_documents(new CWizDocumentListView(*this, this))
    , m_noteList(NULL)
    , m_msgList(new MessageListView(this))
    , m_documentSelection(new CWizDocumentSelectionView(*this, this))
    , m_doc(new CWizDocumentView(*this, this))
    , m_history(new CWizDocumentViewHistory())
    , m_animateSync(new CWizAnimateAction(*this, this))
    , m_bRestart(false)
    , m_bLogoutRestart(false)
    , m_bUpdatingSelection(false)
{
    connect(qApp, SIGNAL(aboutToQuit()), SLOT(on_application_aboutToQuit()));
    connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit())); // Qt bug: Qt5 bug
    qApp->installEventFilter(this);

    //CWizCloudPool::instance()->init(&m_dbMgr);

    // search and full text search
    QThread *threadFTS = new QThread();
    m_searchIndexer->moveToThread(threadFTS);
    threadFTS->start(QThread::IdlePriority);

    // upgrade check
    QThread *thread = new QThread();
    m_upgrade->moveToThread(thread);
    connect(m_upgrade, SIGNAL(checkFinished(bool)), SLOT(on_checkUpgrade_finished(bool)));
    thread->start(QThread::IdlePriority);

    // syncing thread
    connect(m_sync, SIGNAL(processLog(const QString&)), SLOT(on_syncProcessLog(const QString&)));
    connect(m_sync, SIGNAL(syncFinished(int, QString)), SLOT(on_syncDone(int, QString)));
    connect(m_syncTimer, SIGNAL(timeout()), SLOT(on_actionAutoSync_triggered()));
    int nInterval = m_settings->syncInterval();
    if (nInterval == 0) {
        m_syncTimer->setInterval(15 * 60 * 1000);   // default 15 minutes
    } else {
        m_syncTimer->setInterval(nInterval * 60 * 1000);
    }

    if (nInterval != -1) {
        QTimer::singleShot(3 * 1000, this, SLOT(on_actionAutoSync_triggered()));
    }

    // misc settings
    //m_avatarDownloaderHost->setDefault(::WizGetSkinResourcePath(userSettings().skin()) + "avatar_default.png");

    // GUI
    initActions();
    initMenuBar();
    initToolBar();
    initClient();

    setWindowTitle(tr("WizNote"));

    restoreStatus();

    client()->hide();

#ifdef Q_OS_MAC
    setupFullScreenMode(this);
#endif // Q_OS_MAC

    WizService::NoteComments::init();
}