本文整理汇总了C++中CWizExplorerApp::databaseManager方法的典型用法代码示例。如果您正苦于以下问题:C++ CWizExplorerApp::databaseManager方法的具体用法?C++ CWizExplorerApp::databaseManager怎么用?C++ CWizExplorerApp::databaseManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWizExplorerApp
的用法示例。
在下文中一共展示了CWizExplorerApp::databaseManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QObject
CWizDocumentWebViewWorkerPool::CWizDocumentWebViewWorkerPool(CWizExplorerApp& app, QObject* parent)
: m_dbMgr(app.databaseManager())
, QObject(parent)
{
m_timer.setInterval(100);
connect(&m_timer, SIGNAL(timeout()), SLOT(on_timer_timeout()));
}
示例2: QWidget
CWizTagBar::CWizTagBar(CWizExplorerApp& app, QWidget *parent)
: QWidget(parent)
, m_app(app)
, m_dbMgr(app.databaseManager())
, m_tagList(nullptr)
{
int nHeight = Utils::StyleHelper::tagBarHeight();
setFixedHeight(nHeight);
// setStyleSheet("font-size: 11px; color: #646464;");
setContentsMargins(8, 0, 0, 0);
setFocusPolicy(Qt::ClickFocus);
QPalette pl = palette();
pl.setColor(QPalette::Window, QColor("#f7f8f9"));
// pl.setBrush(QPalette::Window, QColor("#f7f8f9"));
setPalette(pl);
setAutoFillBackground(true);
//
QHBoxLayout* hLayout = new QHBoxLayout(this);
hLayout->setContentsMargins(0, 0, 0, 0);
m_label = new QLabel(tr("Tag"), this);
hLayout->addWidget(m_label);
m_btnAdd = new QToolButton(this);
hLayout->addWidget(m_btnAdd);
m_tagWidget = new QWidget(this);
hLayout->addWidget(m_tagWidget);
m_btnMore = new QToolButton(this);
hLayout->addWidget(m_btnMore);
m_btnMore->setVisible(false);
m_lineEdit = new QLineEdit(this);
hLayout->addWidget(m_lineEdit);
hLayout->addStretch();
//
m_tagLayout = new QHBoxLayout(m_tagWidget);
m_tagLayout->setContentsMargins(0, 0, 0, 0);
applyStyleSheet();
connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(on_lineEditReturnPressed()));
connect(m_lineEdit, SIGNAL(textChanged(QString)), SLOT(on_lineEditTextChanged(QString)));
connect(m_btnMore, SIGNAL(clicked()), SLOT(on_buttonMoreClicked()));
connect(m_btnAdd, SIGNAL(clicked()), SLOT(on_buttonAddClicked()));
//
connect(&m_dbMgr, SIGNAL(tagCreated(WIZTAGDATA)),
SLOT(on_tagCreated(WIZTAGDATA)));
connect(&m_dbMgr, SIGNAL(tagModified(WIZTAGDATA,WIZTAGDATA)),
SLOT(on_tagModified(WIZTAGDATA,WIZTAGDATA)));
connect(&m_dbMgr, SIGNAL(tagDeleted(WIZTAGDATA)),
SLOT(on_tagDeleted(WIZTAGDATA)));
connect(&m_dbMgr, SIGNAL(documentTagModified(WIZDOCUMENTDATA)),
SLOT(on_documentTagModified(WIZDOCUMENTDATA)));
}
示例3: QWidget
CWizDocumentView::CWizDocumentView(CWizExplorerApp& app, QWidget* parent)
: QWidget(parent)
, m_app(app)
, m_userSettings(app.userSettings())
, m_dbMgr(app.databaseManager())
, m_title(new CWizTitleBar(app, this))
, m_web(new CWizDocumentWebView(app, this))
, m_client(NULL)
, m_tags(NULL)
, m_attachments(NULL)
, m_editingDocument(true)
, m_viewMode(app.userSettings().noteViewMode())
{
m_client = createClient();
QVBoxLayout* layout = new QVBoxLayout(this);
setLayout(layout);
layout->addWidget(m_client);
layout->setContentsMargins(0, 0, 0, 0);
m_title->setEditingDocument(m_editingDocument);
m_timerDelay.setSingleShot(true);
connect(&m_timerDelay, SIGNAL(timeout()), SLOT(on_titleEdit_textEdit_writeDelay()));
connect(m_title->titleEdit(), SIGNAL(textChanged(const QString&)), \
SLOT(on_titleEdit_textChanged(const QString&)));
connect(m_title->editDocumentButton(), SIGNAL(clicked()), \
SLOT(on_editDocumentButton_clicked()));
connect(m_title->tagsButton(), SIGNAL(clicked()), \
SLOT(on_tagsButton_clicked()));
connect(m_title->attachmentButton(), SIGNAL(clicked()), \
SLOT(on_attachmentButton_clicked()));
connect(m_title->infoButton(), SIGNAL(clicked()), \
SLOT(on_infoButton_clicked()));
qRegisterMetaType<WIZDOCUMENTDATA>("WIZDOCUMENTDATA");
qRegisterMetaType<WIZDOCUMENTATTACHMENTDATA>("WIZDOCUMENTATTACHMENTDATA");
connect(&m_dbMgr, SIGNAL(documentModified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)), \
SLOT(on_document_modified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)));
connect(&m_dbMgr, SIGNAL(attachmentCreated(const WIZDOCUMENTATTACHMENTDATA&)), \
SLOT(on_attachment_created(const WIZDOCUMENTATTACHMENTDATA&)));
connect(&m_dbMgr, SIGNAL(attachmentDeleted(const WIZDOCUMENTATTACHMENTDATA&)), \
SLOT(on_attachment_deleted(const WIZDOCUMENTATTACHMENTDATA&)));
}
示例4: WIZUSERINFOWIDGETBASE
CWizUserInfoWidget::CWizUserInfoWidget(CWizExplorerApp& app, QWidget *parent)
: WIZUSERINFOWIDGETBASE(parent)
, m_app(app)
, m_db(app.databaseManager().db())
{
connect(AvatarHost::instance(), SIGNAL(loaded(const QString&)),
SLOT(on_userAvatar_loaded(const QString&)));
AvatarHost::load(m_db.GetUserId());
resetUserInfo();
connect(&m_db, SIGNAL(userInfoChanged()), SLOT(on_userInfo_changed()));
// load builtin arraw
QString strIconPath = ::WizGetSkinResourcePath(app.userSettings().skin()) + "arrow.png";
m_iconArraw.addFile(strIconPath);
// setup menu
m_menuMain = new QMenu(this);
QAction* actionAccountInfo = new QAction(tr("View account info..."), m_menuMain);
connect(actionAccountInfo, SIGNAL(triggered()), SLOT(on_action_accountInfo_triggered()));
actionAccountInfo->setVisible(false);
QAction* actionAccountSetup = new QAction(tr("Account settings..."), m_menuMain);
connect(actionAccountSetup, SIGNAL(triggered()), SLOT(on_action_accountSetup_triggered()));
QAction* actionChangeAvatar = new QAction(tr("Change avatar..."), m_menuMain);
connect(actionChangeAvatar, SIGNAL(triggered()), SLOT(on_action_changeAvatar_triggered()));
QAction* actionWebService = new QAction(tr("Open web client..."), m_menuMain);
connect(actionWebService, SIGNAL(triggered()), SLOT(on_action_viewNotesOnWeb_triggered()));
QAction* actionMyShare = new QAction(tr("My shared links..."), m_menuMain);
connect(actionMyShare, SIGNAL(triggered()), SLOT(on_action_mySharedNotes_triggered()));
QAction* actionLogout = new QAction(tr("Logout..."), m_menuMain);
connect(actionLogout, SIGNAL(triggered()), SLOT(on_action_logout_triggered()));
m_menuMain->addAction(actionAccountInfo);
m_menuMain->addAction(actionAccountSetup);
m_menuMain->addAction(actionChangeAvatar);
m_menuMain->addSeparator();
m_menuMain->addAction(actionWebService);
m_menuMain->addAction(actionMyShare);
m_menuMain->addSeparator();
m_menuMain->addAction(actionLogout);
//
setMenu(m_menuMain);
}
示例5: QWebView
CWizDocumentWebView::CWizDocumentWebView(CWizExplorerApp& app, QWidget* parent)
: QWebView(parent)
, m_app(app)
, m_dbMgr(app.databaseManager())
, m_bEditorInited(false)
, m_bNewNote(false)
, m_bNewNoteTitleInited(false)
, m_noteFrame(0)
, m_bCurrentEditing(false)
, m_bContentsChanged(false)
{
CWizDocumentWebViewPage* page = new CWizDocumentWebViewPage(this);
setPage(page);
#ifdef QT_DEBUG
settings()->globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
#endif
connect(page, SIGNAL(actionTriggered(QWebPage::WebAction)), SLOT(onActionTriggered(QWebPage::WebAction)));
// minimum page size hint
setMinimumSize(400, 250);
// only accept focus by mouse click as the best way to trigger toolbar reset
setFocusPolicy(Qt::ClickFocus);
setAttribute(Qt::WA_AcceptTouchEvents, false);
// FIXME: should accept drop picture, attachment, link etc.
setAcceptDrops(true);
// refers
MainWindow* mainWindow = qobject_cast<MainWindow *>(m_app.mainWindow());
m_transitionView = mainWindow->transitionView();
m_docLoadThread = new CWizDocumentWebViewLoaderThread(m_dbMgr);
connect(m_docLoadThread, SIGNAL(loaded(const QString&, const QString, const QString)),
SLOT(onDocumentReady(const QString&, const QString, const QString)), Qt::QueuedConnection);
//
m_docSaverThread = new CWizDocumentWebViewSaverThread(m_dbMgr);
connect(m_docSaverThread, SIGNAL(saved(const QString, const QString,bool)),
SLOT(onDocumentSaved(const QString, const QString,bool)), Qt::QueuedConnection);
// loading and saving thread
m_timerAutoSave.setInterval(5*60*1000); // 5 minutes
connect(&m_timerAutoSave, SIGNAL(timeout()), SLOT(onTimerAutoSaveTimout()));
}
示例6: QTreeWidget
CWizFolderView::CWizFolderView(CWizExplorerApp& app, QWidget *parent)
: QTreeWidget(parent)
, m_app(app)
, m_dbMgr(app.databaseManager())
{
header()->hide();
setAnimated(true);
setAttribute(Qt::WA_MacShowFocusRect, false);
setStyle(::WizGetStyle(m_app.userSettings().skin()));
// use custom scrollbar
setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_vScroll = new CWizScrollBar(this);
m_vScroll->syncWith(verticalScrollBar());
initFolders();
}
示例7: QTreeWidget
CWizCategoryBaseView::CWizCategoryBaseView(CWizExplorerApp& app, QWidget* parent)
: QTreeWidget(parent)
, m_app(app)
, m_dbMgr(app.databaseManager())
, m_bDragHovered(false)
{
header()->hide();
setFrameStyle(QFrame::NoFrame);
setAttribute(Qt::WA_MacShowFocusRect, false);
setAutoFillBackground(true);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setTextElideMode(Qt::ElideMiddle);
setIndentation(12);
QPalette pal = palette();
pal.setColor(QPalette::Base, WizGetCategoryBackroundColor(m_app.userSettings().skin()));
setPalette(pal);
setStyle(::WizGetStyle(m_app.userSettings().skin()));
}
示例8: CWizMultiLineListWidget
CWizAttachmentListView::CWizAttachmentListView(CWizExplorerApp& app, QWidget* parent)
: CWizMultiLineListWidget(2, parent)
, m_app(app)
, m_dbMgr(app.databaseManager())
{
setFrameStyle(QFrame::NoFrame);
setStyle(WizGetStyle(m_app.userSettings().skin()));
setSelectionMode(QAbstractItemView::ExtendedSelection);
setAttribute(Qt::WA_MacShowFocusRect, false);
QPalette pal;
#ifdef Q_OS_LINUX
pal.setBrush(QPalette::Base, QBrush("#D7D7D7"));
#elif defined(Q_OS_MAC)
pal.setBrush(QPalette::Base, QBrush("#F7F7F7"));
#endif
setPalette(pal);
//QVBoxLayout* layout = new QVBoxLayout();
//setStyleSheet("background-color: #F7F7F7");
connect(this, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
SLOT(on_list_itemDoubleClicked(QListWidgetItem*)));
MainWindow* mainWindow = qobject_cast<MainWindow *>(m_app.mainWindow());
m_downloaderHost = mainWindow->downloaderHost();
//connect(m_downloaderHost, SIGNAL(downloadDone(const WIZOBJECTDATA&, bool)),
// SLOT(on_download_finished(const WIZOBJECTDATA&, bool)));
// setup context menu
m_menu = new QMenu(this);
m_menu->addAction(WIZACTION_ATTACHMENT_ADD, this, SLOT(on_action_addAttachment()));
m_menu->addSeparator();
m_menu->addAction(WIZACTION_ATTACHMENT_SAVEAS, this, SLOT(on_action_saveAttachmentAs()));
m_menu->addAction(WIZACTION_ATTACHMENT_OPEN, this, SLOT(on_action_openAttachment()));
m_menu->addSeparator();
m_menu->addAction(WIZACTION_ATTACHMENT_DELETE, this, SLOT(on_action_deleteAttachment()));
}
示例9: QWidget
CWizDocumentSelectionView::CWizDocumentSelectionView(CWizExplorerApp& app, QWidget *parent)
: m_app(app)
, m_dbMgr(app.databaseManager())
, QWidget(parent)
{
MainWindow* mainWindow = qobject_cast<MainWindow*>(app.mainWindow());
CWizDocumentListView* listView = qobject_cast<CWizDocumentListView*>(mainWindow->DocumentsCtrl());
m_thumbCache = listView->thumbCache();
connect(m_thumbCache, SIGNAL(loaded(const WIZABSTRACT&)), SLOT(on_thumbCache_loaded(const WIZABSTRACT&)));
QVBoxLayout* layout = new QVBoxLayout();
setLayout(layout);
QGraphicsScene* scene = new QGraphicsScene(this);
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
//scene->setSceneRect(-100, -100, 500, 500);
m_graphicsView = new QGraphicsView(scene, this);
m_graphicsView->setBackgroundBrush(WizGetLeftViewBrush());
m_graphicsView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
layout->addWidget(m_graphicsView);
}
示例10: CWizMultiLineListWidget
CWizAttachmentListView::CWizAttachmentListView(CWizExplorerApp& app, QWidget* parent)
: CWizMultiLineListWidget(2, parent)
, m_app(app)
, m_dbMgr(app.databaseManager())
{
setFrameStyle(QFrame::NoFrame);
setStyle(WizGetStyle(m_app.userSettings().skin()));
setSelectionMode(QAbstractItemView::ExtendedSelection);
setAttribute(Qt::WA_MacShowFocusRect, false);
MainWindow* mainWindow = qobject_cast<MainWindow *>(m_app.mainWindow());
m_downloadDialog = mainWindow->objectDownloadDialog();
connect(this, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(on_list_itemDoubleClicked(QListWidgetItem*)));
// setup context menu
m_menu = new QMenu(this);
m_menu->addAction(WIZACTION_ATTACHMENT_ADD, this, SLOT(on_action_addAttachment()));
m_menu->addSeparator();
m_menu->addAction(WIZACTION_ATTACHMENT_SAVEAS, this, SLOT(on_action_saveAttachmentAs()));
m_menu->addAction(WIZACTION_ATTACHMENT_OPEN, this, SLOT(on_action_openAttachment()));
m_menu->addSeparator();
m_menu->addAction(WIZACTION_ATTACHMENT_DELETE, this, SLOT(on_action_deleteAttachment()));
}
示例11: INoteView
CWizDocumentView::CWizDocumentView(CWizExplorerApp& app, QWidget* parent)
: INoteView(parent)
, m_app(app)
, m_userSettings(app.userSettings())
, m_dbMgr(app.databaseManager())
, m_web(new CWizDocumentWebView(app, this))
, m_comments(new QWebView(this))
, m_title(new TitleBar(this))
, m_viewMode(app.userSettings().noteViewMode())
, m_bLocked(false)
, m_bEditingMode(false)
, m_noteLoaded(false)
{
m_title->setEditor(m_web);
QVBoxLayout* layoutDoc = new QVBoxLayout();
layoutDoc->setContentsMargins(0, 0, 0, 0);
layoutDoc->setSpacing(0);
m_docView = new QWidget(this);
m_docView->setLayout(layoutDoc);
m_tab = new QStackedWidget(this);
//
MainWindow* mainWindow = qobject_cast<MainWindow *>(m_app.mainWindow());
m_passwordView = new CWizUserCipherForm(m_app, this);
m_passwordView->setGeometry(this->geometry());
connect(m_passwordView, SIGNAL(cipherCheckRequest()), SLOT(onCipherCheckRequest()));
//
m_msgWidget = new QWidget(this);
QVBoxLayout* layoutMsg = new QVBoxLayout();
m_msgWidget->setLayout(layoutMsg);
m_msgLabel = new QLabel(m_msgWidget);
m_msgLabel->setAlignment(Qt::AlignCenter);
m_msgLabel->setWordWrap(true);
layoutMsg->addWidget(m_msgLabel);
//
m_tab->addWidget(m_docView);
m_tab->addWidget(m_passwordView);
m_tab->addWidget(m_msgWidget);
m_tab->setCurrentWidget(m_docView);
m_splitter = new CWizSplitter(this);
m_splitter->addWidget(m_web);
m_splitter->addWidget(m_comments);
m_comments->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
m_comments->hide();
layoutDoc->addWidget(m_title);
layoutDoc->addWidget(m_splitter);
layoutDoc->setStretchFactor(m_title, 0);
layoutDoc->setStretchFactor(m_splitter, 1);
QVBoxLayout* layoutMain = new QVBoxLayout(this);
layoutMain->setContentsMargins(0, 0, 0, 0);
setLayout(layoutMain);
layoutMain->addWidget(m_tab);
m_downloaderHost = mainWindow->downloaderHost();
connect(m_downloaderHost, SIGNAL(downloadDone(const WIZOBJECTDATA&, bool)),
SLOT(on_download_finished(const WIZOBJECTDATA&, bool)));
connect(&m_dbMgr, SIGNAL(documentModified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)), \
SLOT(on_document_modified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)));
connect(&m_dbMgr, SIGNAL(documentDataModified(const WIZDOCUMENTDATA&)),
SLOT(on_document_data_modified(const WIZDOCUMENTDATA&)));
connect(&m_dbMgr, SIGNAL(attachmentCreated(const WIZDOCUMENTATTACHMENTDATA&)), \
SLOT(on_attachment_created(const WIZDOCUMENTATTACHMENTDATA&)));
connect(&m_dbMgr, SIGNAL(attachmentDeleted(const WIZDOCUMENTATTACHMENTDATA&)), \
SLOT(on_attachment_deleted(const WIZDOCUMENTATTACHMENTDATA&)));
connect(Core::ICore::instance(), SIGNAL(viewNoteRequested(Core::INoteView*,const WIZDOCUMENTDATA&)),
SLOT(onViewNoteRequested(Core::INoteView*,const WIZDOCUMENTDATA&)));
connect(Core::ICore::instance(), SIGNAL(viewNoteLoaded(Core::INoteView*,WIZDOCUMENTDATA,bool)),
SLOT(onViewNoteLoaded(Core::INoteView*,const WIZDOCUMENTDATA&,bool)));
connect(Core::ICore::instance(), SIGNAL(closeNoteRequested(Core::INoteView*)),
SLOT(onCloseNoteRequested(Core::INoteView*)));
}
示例12: QDialog
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);
//.........这里部分代码省略.........
示例13: QDialog
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:
//.........这里部分代码省略.........
示例14: QListWidget
CWizDocumentListView::CWizDocumentListView(CWizExplorerApp& app, QWidget *parent /*= 0*/)
: QListWidget(parent)
, m_app(app)
, m_dbMgr(app.databaseManager())
, m_tagList(NULL)
, m_itemSelectionChanged(false)
, m_accpetAllItems(false)
{
setFrameStyle(QFrame::NoFrame);
setAttribute(Qt::WA_MacShowFocusRect, false);
setSelectionMode(QAbstractItemView::ExtendedSelection);
m_nViewType = (ViewType)app.userSettings().get("VIEW_TYPE").toInt();
m_nSortingType = app.userSettings().get("SORT_TYPE").toInt();
if (qAbs(m_nSortingType) < CWizSortingPopupButton::SortingCreateTime ||
qAbs(m_nSortingType) > CWizSortingPopupButton::SortingSize)
{
m_nSortingType = CWizSortingPopupButton::SortingCreateTime;
}
connect(this, SIGNAL(itemSelectionChanged()), SLOT(on_itemSelectionChanged()));
// scroll bar
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
#ifdef Q_OS_MAC
verticalScrollBar()->setSingleStep(15);
#else
verticalScrollBar()->setSingleStep(30);
#endif
#ifdef WIZNOTE_CUSTOM_SCROLLBAR
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_vScroll = new CWizScrollBar(this);
m_vScroll->syncWith(verticalScrollBar());
#endif
// setup style
QString strSkinName = m_app.userSettings().skin();
setStyle(::WizGetStyle(strSkinName));
QPalette pal = palette();
pal.setColor(QPalette::Base, Utils::StyleHelper::listViewBackground());
setPalette(pal);
setCursor(QCursor(Qt::ArrowCursor));
//
connect(&m_dbMgr, SIGNAL(tagCreated(const WIZTAGDATA&)), \
SLOT(on_tag_created(const WIZTAGDATA&)));
connect(&m_dbMgr, SIGNAL(tagModified(const WIZTAGDATA&, const WIZTAGDATA&)), \
SLOT(on_tag_modified(const WIZTAGDATA&, const WIZTAGDATA&)));
connect(&m_dbMgr, SIGNAL(documentCreated(const WIZDOCUMENTDATA&)), \
SLOT(on_document_created(const WIZDOCUMENTDATA&)));
connect(&m_dbMgr, SIGNAL(documentModified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)), \
SLOT(on_document_modified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)));
connect(&m_dbMgr, SIGNAL(documentDeleted(const WIZDOCUMENTDATA&)),
SLOT(on_document_deleted(const WIZDOCUMENTDATA&)));
connect(&m_dbMgr, SIGNAL(documentReadCountChanged(const WIZDOCUMENTDATA&)),
SLOT(on_documentReadCount_changed(const WIZDOCUMENTDATA&)));
// message
//connect(&m_dbMgr.db(), SIGNAL(messageModified(const WIZMESSAGEDATA&, const WIZMESSAGEDATA&)),
// SLOT(on_message_modified(const WIZMESSAGEDATA&, const WIZMESSAGEDATA&)));
//connect(&m_dbMgr.db(), SIGNAL(messageDeleted(const WIZMESSAGEDATA&)),
// SLOT(on_message_deleted(const WIZMESSAGEDATA&)));
// thumb cache
//m_thumbCache = new CWizThumbIndexCache(app);
//connect(m_thumbCache, SIGNAL(loaded(const WIZABSTRACT&)),
// SLOT(on_document_abstractLoaded(const WIZABSTRACT&)));
//QThread *thread = new QThread();
//m_thumbCache->moveToThread(thread);
//thread->start();
connect(ThumbCache::instance(), SIGNAL(loaded(const QString& ,const QString&)),
SLOT(onThumbCacheLoaded(const QString&, const QString&)));
connect(WizService::AvatarHost::instance(), SIGNAL(loaded(const QString&)),
SLOT(on_userAvatar_loaded(const QString&)));
setDragDropMode(QAbstractItemView::DragDrop);
setDragEnabled(true);
viewport()->setAcceptDrops(true);
// message context menu
//m_menuMessage = new QMenu(this);
//m_menuMessage->addAction(WIZACTION_LIST_MESSAGE_MARK_READ, this,
// SLOT(on_action_message_mark_read()));
//m_menuMessage->addAction(WIZACTION_LIST_MESSAGE_DELETE, this,
// SLOT(on_action_message_delete()));
// document context menu
m_menuDocument = new QMenu(this);
//.........这里部分代码省略.........
示例15: QListWidget
CWizDocumentListView::CWizDocumentListView(CWizExplorerApp& app, QWidget *parent /*= 0*/)
: QListWidget(parent)
, m_app(app)
, m_dbMgr(app.databaseManager())
, m_tagList(NULL)
{
setFrameStyle(QFrame::NoFrame);
setAttribute(Qt::WA_MacShowFocusRect, false);
connect(this, SIGNAL(itemSelectionChanged()), SLOT(on_itemSelectionChanged()));
// use custom scrollbar
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_vScroll = new CWizScrollBar(this);
m_vScroll->syncWith(verticalScrollBar());
//QScrollAreaKineticScroller *newScroller = new QScrollAreaKineticScroller();
//newScroller->setWidget(this);
//m_kinecticScroll = new QsKineticScroller(this);
//m_kinecticScroll->enableKineticScrollFor(this);
//#ifndef Q_OS_MAC
// smoothly scroll
m_vscrollCurrent = 0;
m_vscrollOldPos = 0;
connect(verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(on_vscroll_valueChanged(int)));
connect(verticalScrollBar(), SIGNAL(actionTriggered(int)), SLOT(on_vscroll_actionTriggered(int)));
connect(&m_vscrollTimer, SIGNAL(timeout()), SLOT(on_vscroll_update()));
//#endif //Q_OS_MAC
setItemDelegate(new CWizDocumentListViewDelegate(this));
// setup background
QPalette pal = palette();
pal.setColor(QPalette::Base, QColor(247,247,247));
setPalette(pal);
setStyle(::WizGetStyle(m_app.userSettings().skin()));
connect(&m_dbMgr, SIGNAL(tagCreated(const WIZTAGDATA&)), \
SLOT(on_tag_created(const WIZTAGDATA&)));
connect(&m_dbMgr, SIGNAL(tagModified(const WIZTAGDATA&, const WIZTAGDATA&)), \
SLOT(on_tag_modified(const WIZTAGDATA&, const WIZTAGDATA&)));
connect(&m_dbMgr, SIGNAL(documentCreated(const WIZDOCUMENTDATA&)), \
SLOT(on_document_created(const WIZDOCUMENTDATA&)));
connect(&m_dbMgr, SIGNAL(documentModified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)), \
SLOT(on_document_modified(const WIZDOCUMENTDATA&, const WIZDOCUMENTDATA&)));
connect(&m_dbMgr, SIGNAL(documentDeleted(const WIZDOCUMENTDATA&)),
SLOT(on_document_deleted(const WIZDOCUMENTDATA&)));
// message
connect(&m_dbMgr.db(), SIGNAL(messageModified(const WIZMESSAGEDATA&, const WIZMESSAGEDATA&)),
SLOT(on_message_modified(const WIZMESSAGEDATA&, const WIZMESSAGEDATA&)));
connect(&m_dbMgr.db(), SIGNAL(messageDeleted(const WIZMESSAGEDATA&)),
SLOT(on_message_deleted(const WIZMESSAGEDATA&)));
// thumb cache
m_thumbCache = new CWizThumbIndexCache(app);
connect(m_thumbCache, SIGNAL(loaded(const WIZABSTRACT&)),
SLOT(on_document_abstractLoaded(const WIZABSTRACT&)));
QThread *thread = new QThread();
m_thumbCache->moveToThread(thread);
thread->start();
// avatar downloader
m_avatarDownloader = new CWizUserAvatarDownloaderHost(m_dbMgr.db().GetAvatarPath(), this);
connect(m_avatarDownloader, SIGNAL(downloaded(const QString&)),
SLOT(on_userAvatar_downloaded(const QString&)));
setDragDropMode(QAbstractItemView::DragDrop);
setDragEnabled(true);
viewport()->setAcceptDrops(true);
setSelectionMode(QAbstractItemView::ExtendedSelection);
// message context menu
m_menuMessage = new QMenu(this);
m_menuMessage->addAction(WIZACTION_LIST_MESSAGE_MARK_READ, this,
SLOT(on_action_message_mark_read()));
m_menuMessage->addAction(WIZACTION_LIST_MESSAGE_DELETE, this,
SLOT(on_action_message_delete()));
// document context menu
m_menuDocument = new QMenu(this);
m_menuDocument->addAction(WIZACTION_LIST_TAGS, this,
SLOT(on_action_selectTags()));
m_menuDocument->addSeparator();
QAction* actionDeleteDoc = m_menuDocument->addAction(WIZACTION_LIST_DELETE,
this, SLOT(on_action_deleteDocument()), QKeySequence::Delete);
QAction* actionMoveDoc = m_menuDocument->addAction(WIZACTION_LIST_MOVE_DOCUMENT,
this, SLOT(on_action_moveDocument()), QKeySequence("Ctrl+Shift+M"));
//.........这里部分代码省略.........