void CWizKbSync::onDownloadDocumentsSimpleInfoCompleted() { // save max version of document // if no error occured while downloading document full information // then update this version if (!m_arrayAllDocumentsNeedToBeDownloaded.empty()) { m_nDocumentMaxVersion = ::WizObjectsGetMaxVersion<WIZDOCUMENTDATABASE>(m_arrayAllDocumentsNeedToBeDownloaded); } // filter documents for getting document full information (not data) // if it's the first time user syncing triggered, filter is not needed. int nSize; m_db->GetAllDocumentsSize(nSize, true); if (nSize) { filterDocuments(); } int nTotal = m_arrayAllDocumentsNeedToBeDownloaded.size(); if (nTotal) { Q_EMIT processLog(WizFormatString1(tr("Total %1 documents need to be synchronized"), nTotal)); } startDownloadDocumentsFullInfo(); }
BOOL CWizKMDatabaseServer::data_download(const QString& strObjectGUID, const QString& strObjectType, QByteArray& stream, const QString& strDisplayName) { stream.clear(); // int nAllSize = 0; int startPos = 0; while (1) { int partSize = 500 * 1000; // BOOL bEOF = FALSE; if (!data_download(strObjectGUID, strObjectType, startPos, partSize, stream, nAllSize, bEOF)) { TOLOG(WizFormatString1(_T("Failed to download object part data: %1"), strDisplayName)); return FALSE; } // int nDownloadedSize = stream.size(); // if (bEOF) break; // startPos = nDownloadedSize; } // __int64 nStreamSize = stream.size(); if (nStreamSize != nAllSize) { TOLOG3(_T("Failed to download object data: %1, stream_size=%2, object_size=%3"), strDisplayName, WizInt64ToStr(nStreamSize), WizInt64ToStr(nAllSize)); return FALSE; } // return TRUE; }
void CWizKbSync::onDownloadDeletedsCompleted() { int nTotal = m_arrayAllDeletedsDownloaded.size(); if (nTotal) { Q_EMIT processLog(WizFormatString1(tr("Total %1 deleted objects be synchronized"), nTotal)); } startUploadTags(); }
void CWizKbSync::onDownloadStylesCompleted() { int nTotal = m_arrayAllStylesDownloaded.size(); if (nTotal) { Q_EMIT processLog(WizFormatString1(tr("Total %1 styles be sychronized"), nTotal)); } startUploadDocuments(); }
void CWizKbSync::onDownloadAttachmentsInfoCompleted() { int nTotal = m_arrayAllAttachmentsDownloaded.size(); if (nTotal) { Q_EMIT processLog(WizFormatString1(tr("Total %1 attachments be synchronized"), nTotal)); } startDownloadObjectsData(); }
bool CWizIndexBase::GetChildTagsSize(const CString &strParentTagGUID, int &size) { CString strWhere = strParentTagGUID.isEmpty() ? WizFormatString0(_T("TAG_GROUP_GUID is null")) : WizFormatString1(_T("TAG_GROUP_GUID='%1'"), strParentTagGUID); CString strSQL = FormatQuerySQL(TABLE_NAME_WIZ_TAG, "COUNT(*)", strWhere); return SQLToSize(strSQL, size); }
bool CWizIndexBase::GetChildTags(const CString& strParentTagGUID, CWizTagDataArray& arrayTag) { CString strWhere = strParentTagGUID.isEmpty() ? WizFormatString0(_T("TAG_GROUP_GUID is null")) : WizFormatString1(_T("TAG_GROUP_GUID='%1'"), strParentTagGUID); CString strSQL = FormatQuerySQL(TABLE_NAME_WIZ_TAG, FIELD_LIST_WIZ_TAG, strWhere); return SQLToTagDataArray(strSQL, arrayTag); }
void CWizKbSync::startUploadAttachments() { m_db->GetModifiedAttachments(m_arrayAllAttachmentsNeedToBeUploaded); int nTotal = m_arrayAllAttachmentsNeedToBeUploaded.size(); if (nTotal) { Q_EMIT processLog(WizFormatString1(tr("uploading attachments, total %1 attachments need upload"), nTotal)); } Q_EMIT progressChanged(progressDocumentUploaded); uploadNextAttachment(); }
WelcomeDialog::WelcomeDialog(const QString &strDefaultUserId, const QString& strLocale, QWidget *parent) : QDialog(parent) , ui(new Ui::WelcomeDialog) , m_strDefaultUserId(strDefaultUserId) , m_verifyAccount(WIZ_API_URL) { ui->setupUi(this); ui->labelProxySettings->setText(WizFormatString1("<a href=\"proxy_settings\">%1</a>", tr("Proxy settings"))); // load webview content QString strLocalFileName = ::WizGetResourcesPath() + "languages/welcome_" + strLocale + ".htm"; QString strFileName = ::WizGetResourcesPath() + "languages/welcome.htm"; if (PathFileExists(strLocalFileName)) { strFileName = strLocalFileName; } QPalette pal = palette(); QColor color = pal.color(QPalette::Background); CString strHtml; ::WizLoadUnicodeTextFromFile(strFileName, strHtml); strHtml.replace("ButtonFace", "#" + ::WizColorToString(color)); ui->webView->setHtml(strHtml, QUrl::fromLocalFile(strFileName)); ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); connect(ui->webView, SIGNAL(linkClicked(const QUrl&)), \ SLOT(on_webView_linkClicked(const QUrl&)), Qt::UniqueConnection); connect(ui->labelProxySettings, SIGNAL(linkActivated(const QString&)), \ SLOT(on_labelProxySettings_linkActivated(const QString&)), \ Qt::UniqueConnection); connect(ui->comboUsers, SIGNAL(activated(const QString&)), \ SLOT(on_comboUsers_activated(const QString&))); connect(ui->comboUsers, SIGNAL(editTextChanged(const QString&)), \ SLOT(on_comboUsers_editTextChanged(const QString&))); connect(ui->checkAutoLogin, SIGNAL(stateChanged(int)), \ SLOT(on_checkAutoLogin_stateChanged(int))); connect(ui->buttonLogin, SIGNAL(clicked()), SLOT(accept())); connect(&m_verifyAccount, SIGNAL(done(bool, const CString&)), \ SLOT(verifyAccountDone(bool, const CString&))); setUsers(); setFixedSize(size()); }
void CWizKbSync::startUploadStyles() { m_db->GetModifiedStyles(m_arrayAllStylesNeedToBeUploaded); int nTotal = m_arrayAllStylesNeedToBeUploaded.size(); if (nTotal) { Q_EMIT processLog(WizFormatString1(tr("uploading styles list, total %1 styles need upload"), nTotal)); } Q_EMIT progressChanged(progressStyleDownloaded); uploadNextStyles(); }
void CWizKbSync::startUploadDeleteds() { m_db->GetModifiedDeletedGUIDs(m_arrayAllDeletedsNeedToBeUploaded); int nTotal = m_arrayAllDeletedsNeedToBeUploaded.size(); if (nTotal) { Q_EMIT processLog(WizFormatString1(tr("uploading deleted objects list, total %1 deleted objects need upload"), nTotal)); } Q_EMIT progressChanged(progressDeletedsDownloaded); uploadNextDeleteds(); }
void CWizKbSync::startUploadDeleteds() { m_db->GetModifiedDeletedGUIDs(m_arrayAllDeletedsNeedToBeUploaded); int nSize = m_arrayAllDeletedsNeedToBeUploaded.size(); qDebug() << "[Syncing]upload deleteds, total: " << nSize; if (nSize) { Q_EMIT processLog(WizFormatString1(tr("uploading deleted objects list, total %1 deleted objects need upload"), nSize)); } uploadNextDeleteds(); }
void CWizKbSync::startUploadStyles() { m_db->GetModifiedStyles(m_arrayAllStylesNeedToBeUploaded); int nSize = m_arrayAllStylesNeedToBeUploaded.size(); qDebug() << "[Syncing]upload styles, total: " << nSize; if (nSize) { Q_EMIT processLog(WizFormatString1(tr("uploading styles list, total %1 styles need upload"), nSize)); } uploadNextStyles(); }
void CWizKbSync::startUploadDocuments() { m_db->GetModifiedDocuments(m_arrayAllDocumentsNeedToBeUploaded); int nSize = m_arrayAllDocumentsNeedToBeUploaded.size(); qDebug() << "[Syncing]upload documents, total: " << nSize; if (nSize) { Q_EMIT processLog(WizFormatString1(tr("uploading documents, total %1 documents need upload"), nSize)); } uploadNextDocument(); }
void CWizKbSync::startUploadAttachments() { m_db->GetModifiedAttachments(m_arrayAllAttachmentsNeedToBeUploaded); int nSize = m_arrayAllAttachmentsNeedToBeUploaded.size(); qDebug() << "[Syncing]upload attachments, total: " << nSize; Q_ASSERT(nSize == 0); if (nSize) { Q_EMIT processLog(WizFormatString1(tr("uploading attachments, total %1 attachments need upload"), nSize)); } uploadNextAttachment(); }
void WIZTODODATAEX::AddCompletedDate(const CString& strTextExt) { CString strTime = WizFormatString1(_T("[%1]"), WizDateToLocalString(tCompleted)); // strText = strTime + strTextExt + strText; // std::map<CString, int> mapTextAndIndex; for (WIZTODODATAEX::CWizTodoDataExArray::iterator it = arrayChild.begin(); it != arrayChild.end(); it++) { WIZTODODATAEX& dataCurr = *it; dataCurr.AddCompletedDate(strTextExt); } }
CWizNoteInfoForm::CWizNoteInfoForm(QWidget *parent) : CWizPopupWidget(parent) , ui(new Ui::CWizNoteInfoForm) { ui->setupUi(this); setContentsMargins(0, 20, 0, 0); // ui->editTitle->setReadOnly(true); ui->editCreateTime->setReadOnly(true); ui->editUpdateTime->setReadOnly(true); // ui->editURL->setReadOnly(true); // ui->editAuthor->setReadOnly(true); // ui->checkEncrypted->setEnabled(false); QString openDocument = WizFormatString1("<a href=\"locate\" style=\"color:#3CA2E0;\">%1</a>", tr("Locate")); ui->labelOpenDocument->setText(openDocument); }
void CWizKbSync::onDownloadDocumentsSimpleInfoCompleted() { Q_EMIT progressChanged(progressDocumentSimpleInfoDownloaded); //save max version of document //if no error occured while downloading document full information //then update this version if (!m_arrayAllDocumentsNeedToBeDownloaded.empty()) { m_nDocumentMaxVersion = ::WizObjectsGetMaxVersion<WIZDOCUMENTDATABASE>(m_arrayAllDocumentsNeedToBeDownloaded); } //filter documents for getting document full information (not data) filterDocuments(); int nTotal = m_arrayAllDocumentsNeedToBeDownloaded.size(); if (nTotal) { Q_EMIT processLog(WizFormatString1(tr("Total %1 documents need to be synchronized"), nTotal)); } //startUploadDocuments(); startDownloadDocumentsFullInfo(); }
void CWizKbSync::processConflictObjectData(const WIZOBJECTDATA& data) { WIZOBJECTDATA conflictObjectData(data); conflictObjectData.strObjectGUID = WizGenGUIDLowerCaseLetterOnly(); conflictObjectData.strDisplayName += tr("(conflict backup)"); // set dirty flag, upload needed m_conflictDownloadedInfo.nVersion = -1; m_conflictDownloadedInfo.strKbGUID = kbGUID(); m_conflictDownloadedInfo.strGUID = conflictObjectData.strObjectGUID; m_conflictDownloadedInfo.strTitle += tr("(conflict backup)"); m_conflictDownloadedInfo.strInfoMD5 = m_db->CalDocumentInfoMD5(m_conflictDownloadedInfo); if (m_db->CreateDocumentEx(m_conflictDownloadedInfo)) { m_db->UpdateSyncObjectLocalData(conflictObjectData); Q_EMIT processLog(WizFormatString1(tr("Conflict backup created: %1"), m_conflictDownloadedInfo.strTitle)); } else { Q_EMIT processLog("unable to create conflict backup while create document"); } // chain back onQueryDocumentInfo(m_conflictDownloadedInfo); }
bool CppSQLite3DB::tableExists(const CString& strTable) { CString strSQL = WizFormatString1(_T("select count(*) from sqlite_master where type='table' and name='%1'"), strTable); int nRet = execScalar(strSQL); return (nRet > 0); }
CWizPreferenceWindow::CWizPreferenceWindow(CWizExplorerApp& app, QWidget* parent) : QDialog(parent) , ui(new Ui::CWizPreferenceWindow) , m_app(app) , m_dbMgr(app.databaseManager()) { ui->setupUi(this); setWindowIcon(QIcon()); setWindowTitle(tr("Preference")); connect(ui->btnClose, SIGNAL(clicked()), SLOT(accept())); // FIXME: proxy settings will back soon!!! ui->labelProxySettings->hide(); // general tab ::WizGetTranslatedLocales(m_locales); for (int i = 0; i < m_locales.count(); i++) { ui->comboLang->addItem(::WizGetTranslatedLocaleDisplayName(i)); } for (int i = 0; i < ui->comboLang->count(); i++) { if (m_locales[i] == userSettings().locale()) { ui->comboLang->setCurrentIndex(i); } } connect(ui->comboLang, SIGNAL(activated(int)), SLOT(on_comboLang_activated(int))); // reading tab switch (userSettings().noteViewMode()) { case viewmodeAlwaysEditing: ui->radioAlwaysEditing->setChecked(true); break; case viewmodeAlwaysReading: ui->radioAlwaysReading->setChecked(true); break; default: ui->radioAuto->setChecked(true); break; } connect(ui->radioAuto, SIGNAL(clicked(bool)), SLOT(on_radioAuto_clicked(bool))); connect(ui->radioAlwaysReading, SIGNAL(clicked(bool)), SLOT(on_radioAlwaysReading_clicked(bool))); connect(ui->radioAlwaysEditing, SIGNAL(clicked(bool)), SLOT(on_radioAlwaysEditing_clicked(bool))); // syncing tab int nInterval = userSettings().syncInterval(); switch (nInterval) { case 5: ui->comboSyncInterval->setCurrentIndex(0); break; case 15: ui->comboSyncInterval->setCurrentIndex(1); break; case 30: ui->comboSyncInterval->setCurrentIndex(2); break; case 60: ui->comboSyncInterval->setCurrentIndex(3); break; case -1: ui->comboSyncInterval->setCurrentIndex(4); break; default: ui->comboSyncInterval->setCurrentIndex(1); } switch (m_dbMgr.db().GetObjectSyncTimeline()) { case -1: ui->comboSyncMethod->setCurrentIndex(0); break; case 1: ui->comboSyncMethod->setCurrentIndex(1); break; case 7: ui->comboSyncMethod->setCurrentIndex(2); break; case 30: ui->comboSyncMethod->setCurrentIndex(3); break; case 99999: ui->comboSyncMethod->setCurrentIndex(4); break; default: ui->comboSyncMethod->setCurrentIndex(4); } int nDays = 1; if (m_dbMgr.count()) { nDays = m_dbMgr.at(0).GetObjectSyncTimeline(); } switch (nDays) { case -1: ui->comboSyncGroupMethod->setCurrentIndex(0); break; case 1: ui->comboSyncGroupMethod->setCurrentIndex(1); break; case 7: ui->comboSyncGroupMethod->setCurrentIndex(2); break; case 30: ui->comboSyncGroupMethod->setCurrentIndex(3); break; case 99999: ui->comboSyncGroupMethod->setCurrentIndex(4); break; default: ui->comboSyncGroupMethod->setCurrentIndex(1); } connect(ui->comboSyncInterval, SIGNAL(activated(int)), SLOT(on_comboSyncInterval_activated(int))); connect(ui->comboSyncMethod, SIGNAL(activated(int)), SLOT(on_comboSyncMethod_activated(int))); connect(ui->comboSyncGroupMethod, SIGNAL(activated(int)), SLOT(on_comboSyncGroupMethod_activated(int))); QString proxySettings = WizFormatString1("<a href=\"proxy_settings\">%1</a>", tr("Proxy settings")); ui->labelProxySettings->setText(proxySettings); connect(ui->labelProxySettings, SIGNAL(linkActivated(const QString&)), SLOT(labelProxy_linkActivated(const QString&))); // format tab QString strFont = QString("%1 %2"). arg(m_app.userSettings().defaultFontFamily()) .arg(m_app.userSettings().defaultFontSize()); ui->editFont->setText(strFont); connect(ui->buttonFontSelect, SIGNAL(clicked()), SLOT(onButtonFontSelect_clicked())); }
CWizPreferenceWindow::CWizPreferenceWindow(CWizExplorerApp& app, QWidget* parent) : QDialog(parent) , ui(new Ui::CWizPreferenceWindow) , m_app(app) , m_dbMgr(app.databaseManager()) { ui->setupUi(this); setWindowIcon(QIcon()); setWindowTitle(tr("Preference")); connect(ui->btnClose, SIGNAL(clicked()), SLOT(accept())); // general tab ::WizGetTranslatedLocales(m_locales); ui->comboLang->blockSignals(true); for (int i = 0; i < m_locales.count(); i++) { ui->comboLang->addItem(::WizGetTranslatedLocaleDisplayName(i)); } for (int i = 0; i < ui->comboLang->count(); i++) { if (m_locales[i] == userSettings().locale()) { ui->comboLang->setCurrentIndex(i); } } ui->comboLang->blockSignals(false); ui->checkBox->blockSignals(true); Qt::CheckState checkState = userSettings().autoCheckUpdate() ? Qt::Checked : Qt::Unchecked; ui->checkBox->setCheckState(checkState); ui->checkBox->blockSignals(false); ui->checkBoxTrayIcon->blockSignals(true); checkState = userSettings().showSystemTrayIcon() ? Qt::Checked : Qt::Unchecked; ui->checkBoxTrayIcon->setCheckState(checkState); ui->checkBoxTrayIcon->blockSignals(false); #ifdef BUILD4APPSTORE // hide language choice and upgrade for appstore ui->comboLang->setEnabled(false); ui->checkBox->setVisible(false); #endif #ifndef Q_OS_LINUX ui->checkBoxSystemStyle->setVisible(false); #endif checkState = userSettings().useSystemBasedStyle() ? Qt::Checked : Qt::Unchecked; ui->checkBoxSystemStyle->blockSignals(true); ui->checkBoxSystemStyle->setCheckState(checkState); ui->checkBoxSystemStyle->blockSignals(false); // reading tab switch (userSettings().noteViewMode()) { case viewmodeAlwaysEditing: ui->radioAlwaysEditing->setChecked(true); break; case viewmodeAlwaysReading: ui->radioAlwaysReading->setChecked(true); break; default: ui->radioAuto->setChecked(true); break; } // syncing tab int nInterval = userSettings().syncInterval(); switch (nInterval) { case 5: ui->comboSyncInterval->setCurrentIndex(0); break; case 15: ui->comboSyncInterval->setCurrentIndex(1); break; case 30: ui->comboSyncInterval->setCurrentIndex(2); break; case 60: ui->comboSyncInterval->setCurrentIndex(3); break; case -1: ui->comboSyncInterval->setCurrentIndex(4); break; default: ui->comboSyncInterval->setCurrentIndex(1); } switch (m_dbMgr.db().GetObjectSyncTimeline()) { case -1: ui->comboSyncMethod->setCurrentIndex(0); break; case 1: ui->comboSyncMethod->setCurrentIndex(1); break; case 7: ui->comboSyncMethod->setCurrentIndex(2); break; case 30: ui->comboSyncMethod->setCurrentIndex(3); break; case 99999: ui->comboSyncMethod->setCurrentIndex(4); break; default: ui->comboSyncMethod->setCurrentIndex(4); } int nDays = 1; if (m_dbMgr.count()) { nDays = m_dbMgr.at(0).GetObjectSyncTimeline(); } switch (nDays) { case -1: ui->comboSyncGroupMethod->setCurrentIndex(0); break; case 1: ui->comboSyncGroupMethod->setCurrentIndex(1); break; case 7: ui->comboSyncGroupMethod->setCurrentIndex(2); break; case 30: ui->comboSyncGroupMethod->setCurrentIndex(3); break; case 99999: ui->comboSyncGroupMethod->setCurrentIndex(4); break; default: ui->comboSyncGroupMethod->setCurrentIndex(1); } bool downloadAttachments = m_dbMgr.db().getDownloadAttachmentsAtSync(); ui->comboDownloadAttachments->setCurrentIndex(downloadAttachments ? 1 : 0); connect(ui->comboSyncInterval, SIGNAL(activated(int)), SLOT(on_comboSyncInterval_activated(int))); connect(ui->comboSyncMethod, SIGNAL(activated(int)), SLOT(on_comboSyncMethod_activated(int))); connect(ui->comboSyncGroupMethod, SIGNAL(activated(int)), SLOT(on_comboSyncGroupMethod_activated(int))); connect(ui->comboDownloadAttachments, SIGNAL(activated(int)), SLOT(on_comboDownloadAttachments_activated(int))); QString proxySettings = WizFormatString1("<a href=\"proxy_settings\" style=\"color:#3CA2E0;\">%1</a>", tr("Proxy settings")); ui->labelProxySettings->setText(proxySettings); connect(ui->labelProxySettings, SIGNAL(linkActivated(const QString&)), SLOT(labelProxy_linkActivated(const QString&))); // format tab QString strFont = QString("%1 %2"). arg(m_app.userSettings().defaultFontFamily()) .arg(m_app.userSettings().defaultFontSize()); ui->editFont->setText(strFont); connect(ui->buttonFontSelect, SIGNAL(clicked()), SLOT(onButtonFontSelect_clicked())); // ui->comboBox_unit->setCurrentIndex(m_app.userSettings().printMarginUnit()); ui->spinBox_bottom->setValue(m_app.userSettings().printMarginValue(wizPositionBottom)); ui->spinBox_left->setValue(m_app.userSettings().printMarginValue(wizPositionLeft)); ui->spinBox_right->setValue(m_app.userSettings().printMarginValue(wizPositionRight)); ui->spinBox_top->setValue(m_app.userSettings().printMarginValue(wizPositionTop)); bool searchEncryptedNote = m_app.userSettings().searchEncryptedNote(); ui->checkBoxSearchEncryNote->setChecked(searchEncryptedNote); ui->lineEditNotePassword->setEnabled(searchEncryptedNote); ui->lineEditNotePassword->setText(m_app.userSettings().encryptedNotePassword()); QString strColor = m_app.userSettings().editorBackgroundColor(); ui->pushButtonBackgroundColor->setStyleSheet(QString("QPushButton " "{ border: 1px; background: %1; height:20px; border-radius:5px } ").arg(strColor)); ui->pushButtonClearBackground->setStyleSheet(QString("QPushButton:pressed{background-color: #000000;")); bool manuallySortFolders = m_app.userSettings().isManualSortingEnabled(); ui->checkBoxManuallySort->setChecked(manuallySortFolders); }
CWizPreferenceWindow::CWizPreferenceWindow(CWizExplorerApp& app, QWidget* parent) : QDialog(parent) , ui(new Ui::CWizPreferenceWindow) , m_app(app) , m_bRestart(false) { ui->setupUi(this); connect(ui->buttonOK, SIGNAL(clicked()), SLOT(accept())); // general tab ::WizGetTranslatedLocales(m_locales); for (int i = 0; i < m_locales.count(); i++) { ui->comboLang->addItem(::WizGetTranslatedLocaleDisplayName(i)); } for (int i = 0; i < ui->comboLang->count(); i++) { if (!m_locales[i].compare(userSettings().locale())) { ui->comboLang->setCurrentIndex(i); } } // just hide skin setup and upgrade notfiy on mac for convience. #ifdef Q_WS_MAC ui->groupBoxSkin->hide(); ui->checkBox->hide(); #endif // Q_WS_MAC ::WizGetSkins(m_skins); for (int i = 0; i < m_skins.count(); i++) { ui->comboSkin->addItem(::WizGetSkinDisplayName(m_skins[i], userSettings().locale())); } QString strCurSkinName = userSettings().skin(); for (int i = 0; i < ui->comboSkin->count(); i++) { if (!strCurSkinName.compare(m_skins[i])) { ui->comboSkin->setCurrentIndex(i); } } connect(ui->comboLang, SIGNAL(currentIndexChanged(int)), SLOT(on_comboLang_currentIndexChanged(int))); connect(ui->comboSkin, SIGNAL(currentIndexChanged(int)), SLOT(on_comboSkin_currentIndexChanged(int))); // reading tab switch (userSettings().noteViewMode()) { case viewmodeAlwaysEditing: ui->radioAlwaysEditing->setChecked(true); break; case viewmodeAlwaysReading: ui->radioAlwaysReading->setChecked(true); break; default: ui->radioAuto->setChecked(true); break; } connect(ui->radioAuto, SIGNAL(clicked(bool)), SLOT(on_radioAuto_clicked(bool))); connect(ui->radioAlwaysReading, SIGNAL(clicked(bool)), SLOT(on_radioAlwaysReading_clicked(bool))); connect(ui->radioAlwaysEditing, SIGNAL(clicked(bool)), SLOT(on_radioAlwaysEditing_clicked(bool))); // syncing tab ui->checkAutoSync->setChecked(userSettings().autoSync()); ui->checkDownloadAllNotesData->setChecked(userSettings().downloadAllNotesData()); QString proxySettings = WizFormatString1("<a href=\"proxy_settings\">%1</a>", tr("Proxy settings")); ui->labelProxySettings->setText(proxySettings); connect(ui->checkAutoSync, SIGNAL(clicked(bool)), SLOT(on_checkAutoSync_clicked(bool))); connect(ui->checkDownloadAllNotesData, SIGNAL(clicked(bool)), SLOT(on_checkDownloadAllNotesData_clicked(bool))); connect(ui->labelProxySettings, SIGNAL(linkActivated(const QString&)), SLOT(labelProxy_linkActivated(const QString&))); }
CWizPreferenceWindow::CWizPreferenceWindow(CWizExplorerApp& app, QWidget* parent) : QDialog(parent) , ui(new Ui::CWizPreferenceWindow) , m_app(app) , m_bRestart(false) { ui->setupUi(this); setWindowIcon(QIcon()); connect(ui->buttonOK, SIGNAL(clicked()), SLOT(accept())); // general tab ::WizGetTranslatedLocales(m_locales); for (int i = 0; i < m_locales.count(); i++) { ui->comboLang->addItem(::WizGetTranslatedLocaleDisplayName(i)); } for (int i = 0; i < ui->comboLang->count(); i++) { if (!m_locales[i].compare(userSettings().locale())) { ui->comboLang->setCurrentIndex(i); } } // just hide skin setup and upgrade notfiy on mac for convenience. //#ifdef Q_WS_MAC //ui->groupBoxSkin->hide(); //ui->checkBox->hide(); //#endif // Q_WS_MAC // ::WizGetSkins(m_skins); // for (int i = 0; i < m_skins.count(); i++) { // ui->comboSkin->addItem(::WizGetSkinDisplayName(m_skins[i], userSettings().locale())); // } // QString strCurSkinName = userSettings().skin(); // for (int i = 0; i < ui->comboSkin->count(); i++) { // if (!strCurSkinName.compare(m_skins[i])) { // ui->comboSkin->setCurrentIndex(i); // } // } connect(ui->comboLang, SIGNAL(currentIndexChanged(int)), SLOT(on_comboLang_currentIndexChanged(int))); //connect(ui->comboSkin, SIGNAL(currentIndexChanged(int)), SLOT(on_comboSkin_currentIndexChanged(int))); // reading tab switch (userSettings().noteViewMode()) { case viewmodeAlwaysEditing: ui->radioAlwaysEditing->setChecked(true); break; case viewmodeAlwaysReading: ui->radioAlwaysReading->setChecked(true); break; default: ui->radioAuto->setChecked(true); break; } connect(ui->radioAuto, SIGNAL(clicked(bool)), SLOT(on_radioAuto_clicked(bool))); connect(ui->radioAlwaysReading, SIGNAL(clicked(bool)), SLOT(on_radioAlwaysReading_clicked(bool))); connect(ui->radioAlwaysEditing, SIGNAL(clicked(bool)), SLOT(on_radioAlwaysEditing_clicked(bool))); // syncing tab int nInterval = userSettings().syncInterval(); switch (nInterval) { case 5: ui->comboSyncInterval->setCurrentIndex(0); break; case 15: ui->comboSyncInterval->setCurrentIndex(1); break; case 30: ui->comboSyncInterval->setCurrentIndex(2); break; case 60: ui->comboSyncInterval->setCurrentIndex(3); break; case -1: ui->comboSyncInterval->setCurrentIndex(4); break; default: ui->comboSyncInterval->setCurrentIndex(1); } int nMethod = userSettings().syncMethod(); switch (nMethod) { case -1: ui->comboSyncMethod->setCurrentIndex(0); break; case 1: ui->comboSyncMethod->setCurrentIndex(1); break; case 7: ui->comboSyncMethod->setCurrentIndex(2); break; case 30: ui->comboSyncMethod->setCurrentIndex(3); break; case 99999: ui->comboSyncMethod->setCurrentIndex(4); break; default: ui->comboSyncMethod->setCurrentIndex(2); } connect(ui->comboSyncInterval, SIGNAL(activated(int)), SLOT(on_comboSyncInterval_activated(int))); connect(ui->comboSyncMethod, SIGNAL(activated(int)), SLOT(on_comboSyncMethod_activated(int))); QString proxySettings = WizFormatString1("<a href=\"proxy_settings\">%1</a>", tr("Proxy settings")); ui->labelProxySettings->setText(proxySettings); connect(ui->labelProxySettings, SIGNAL(linkActivated(const QString&)), SLOT(labelProxy_linkActivated(const QString&))); // format tab QString strFont = QString("%1 %2"). arg(m_app.userSettings().defaultFontFamily()) .arg(m_app.userSettings().defaultFontSize()); ui->editFont->setText(strFont); connect(ui->buttonFontSelect, SIGNAL(clicked()), SLOT(onButtonFontSelect_clicked())); }