PopplerViewer::PopplerViewer(const QString &mimeType, const QString &reslid, QWidget *parent) : QWidget(parent) { this->mimeType = mimeType; this->lid = reslid.toInt(); printImageFile = global.fileManager.getTmpDirPath() + QString::number(lid) +QString("-print.png"); QString file = global.fileManager.getDbaDirPath() + reslid +".pdf"; doc = Poppler::Document::load(file); if (doc == NULL || doc->isLocked()) return; currentPage = 0; totalPages = doc->numPages(); image = new QImage(doc->page(currentPage)->renderToImage()); scene = new QGraphicsScene(); view = new PopplerGraphicsView(scene); view->filename = file; item = new QGraphicsPixmapItem(QPixmap::fromImage(*image)); image->save(printImageFile); // This is in case we want to print a note. Otherwise it isn't used. scene->addItem(item); view->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); QHBoxLayout *buttonLayout = new QHBoxLayout(); pageLabel = new QLabel(tr("Page ") +QString::number(currentPage+1) + QString(tr(" of ") +QString::number(totalPages)), this); pageLeft = new QPushButton(); pageRight = new QPushButton(); pageRight->setMaximumWidth(30); pageLeft->setMaximumWidth(30); pageLeft->setIcon(global.getIconResource(":leftArrowIcon")); pageRight->setIcon(global.getIconResource(":rightArrowIcon")); buttonLayout->addStretch(100); buttonLayout->addWidget(pageLeft); buttonLayout->addWidget(pageLabel); buttonLayout->addWidget(pageRight); buttonLayout->addStretch(100); QVBoxLayout *layout = new QVBoxLayout(this); layout->addLayout(buttonLayout); layout->addWidget(view); this->setLayout(layout); connect(pageRight, SIGNAL(clicked()), this, SLOT(pageRightPressed())); connect(pageLeft, SIGNAL(clicked()), this, SLOT(pageLeftPressed())); if (totalPages == 1) { pageRight->setEnabled(false); } pageLeft->setEnabled(false); }
LoginDialog::LoginDialog(QWidget *parent) : QDialog(parent) { okPressed = false; setWindowTitle(tr("NixNote Login")); setWindowIcon(global.getIconResource(":passwordIcon")); setLayout(&grid); password.setEchoMode(QLineEdit::Password); connect(&userid, SIGNAL(textChanged(const QString&)), this, SLOT(validateInput())); connect(&password, SIGNAL(textChanged(const QString&)), this, SLOT(validateInput())); useridLabel.setText(tr("Userid")); passwordLabel.setText(tr("Password")); passwordGrid.addWidget(&useridLabel, 1,1); passwordGrid.addWidget(&userid, 1, 2); passwordGrid.addWidget(&passwordLabel, 2,1); passwordGrid.addWidget(&password, 2, 2); passwordGrid.setContentsMargins(10, 10, -10, -10); grid.addLayout(&passwordGrid,1,1); ok.setText(tr("OK")); if (global.password == "" and global.username == "") ok.setEnabled(false); connect(&ok, SIGNAL(clicked()), this, SLOT(okButtonPressed())); cancel.setText(tr("Cancel")); connect(&cancel, SIGNAL(clicked()), this, SLOT(cancelButtonPressed())); buttonGrid.addWidget(&ok, 1, 1); buttonGrid.addWidget(&cancel, 1,2); grid.addLayout(&buttonGrid,2,1); grid.setSizeConstraint( QLayout::SetFixedSize ); this->setFont(global.getGuiFont(font())); }
// Constructor. Thys happens when the class is declared. NotebookProperties::NotebookProperties(QWidget *parent) : QDialog(parent) { okPressed = false; setWindowTitle(tr("Notebook")); setWindowIcon(global.getIconResource(":notebookSmallIcon")); setLayout(&grid); syncBox.setText(tr("Synchronized")); syncBox.setChecked(true); syncBox.setEnabled(false); defaultNotebook.setText(tr("Default")); defaultNotebook.setChecked(false); defaultNotebook.setEnabled(true); connect(&name, SIGNAL(textChanged(const QString&)), this, SLOT(validateInput())); nameLabel.setText(tr("Name")); queryGrid.addWidget(&nameLabel, 1,1); queryGrid.addWidget(&name, 1, 2); queryGrid.addWidget(&syncBox, 2,2); queryGrid.addWidget(&defaultNotebook, 3,2); // queryGrid.setContentsMargins(10, 10, -10, -10); grid.addLayout(&queryGrid,1,1); ok.setText(tr("OK")); connect(&ok, SIGNAL(clicked()), this, SLOT(okButtonPressed())); cancel.setText(tr("Cancel")); connect(&cancel, SIGNAL(clicked()), this, SLOT(cancelButtonPressed())); buttonGrid.addWidget(&ok, 1, 1); buttonGrid.addWidget(&cancel, 1,2); grid.addLayout(&buttonGrid,2,1); this->setFont(global.getGuiFont(font())); }
void FavoritesView::buildTreeEntry(FavoritesViewItem *parent, const FavoritesRecord *record) { FavoritesViewItem *item = new FavoritesViewItem(); item->setFlags(item->flags() & ~Qt::ItemIsDropEnabled); item->record.lid = record->lid; item->setData(NAME_POSITION, Qt::UserRole, record->lid); item->record.type = record->type; item->record.target = record->target; item->record.order = record->order; item->setText(NAME_POSITION, record->displayName); switch (record->type) { case FavoritesRecord::Tag : item->setIcon(NAME_POSITION, global.getIconResource(":tagIcon")); break; case FavoritesRecord::Note : item->setIcon(NAME_POSITION, global.getIconResource(":newNoteIcon")); break; case FavoritesRecord::ConflictNotebook : item->setIcon(NAME_POSITION, global.getIconResource(":notebookConflictIcon")); break; case FavoritesRecord::LinkedNotebook : item->setIcon(NAME_POSITION, global.getIconResource(":notebookLinkedIcon")); break; case FavoritesRecord::LinkedStack : item->setIcon(NAME_POSITION, global.getIconResource(":silhouetteIcon")); break; case FavoritesRecord::LocalNotebook : item->setIcon(NAME_POSITION, global.getIconResource(":locaNotebookIcon")); break; case FavoritesRecord::Search : item->setIcon(NAME_POSITION, global.getIconResource(":searchIcon")); break; case FavoritesRecord::SharedNotebook : item->setIcon(NAME_POSITION, global.getIconResource(":notebookSharedIcon")); break; case FavoritesRecord::SynchronizedNotebook : item->setIcon(NAME_POSITION, global.getIconResource(":notebookSmallIcon")); break; case FavoritesRecord::NotebookStack : item->setIcon(NAME_POSITION, global.getIconResource(":stackIcon")); break; } dataStore.insert(record->lid, item); if (record->target.toInt() > 0) targetStore.insert(record->target.toInt(), item); parent->addChild(item); }
ExternalBrowse::ExternalBrowse(qint32 lid, QWidget *parent) : QMdiSubWindow(parent) { setAttribute(Qt::WA_QuitOnClose, false); this->setWindowTitle(tr("NixNote")); setWindowIcon(global.getIconResource(":windowIcon")); browser = new NBrowserWindow(this); setWidget(browser); // Setup shortcuts focusTitleShortcut = new QShortcut(this); focusTitleShortcut->setContext(Qt::WidgetShortcut); this->setupShortcut(focusTitleShortcut, "Focus_Title"); connect(focusTitleShortcut, SIGNAL(activated()), &browser->noteTitle, SLOT(setFocus())); focusNoteShortcut = new QShortcut(this); focusNoteShortcut->setContext(Qt::WidgetShortcut); this->setupShortcut(focusNoteShortcut, "Focus_Note"); connect(focusNoteShortcut, SIGNAL(activated()), browser->editor, SLOT(setFocus())); focusTagShortcut = new QShortcut(this); focusTagShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(focusTagShortcut, "Focus_Tag"); connect(focusTagShortcut, SIGNAL(activated()), browser, SLOT(newTagFocusShortcut())); focusUrlShortcut = new QShortcut(this); focusUrlShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(focusUrlShortcut, "Focus_Url"); connect(focusUrlShortcut, SIGNAL(activated()), browser, SLOT(urlFocusShortcut())); focusAuthorShortcut = new QShortcut(this); focusAuthorShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(focusAuthorShortcut, "Focus_Author"); connect(focusAuthorShortcut, SIGNAL(activated()), browser, SLOT(authorFocusShortcut())); // Load actual note browser->setContent(lid); }
void NTrashTree::reloadIcons() { root->setIcon(0,global.getIconResource(":trashIcon")); }
void EditorButtonBar::reloadIcons() { undoButtonAction->setIcon(global.getIconResource(":undoIcon")); redoButtonAction->setIcon(global.getIconResource(":redoIcon")); cutButtonAction->setIcon(global.getIconResource(":cutIcon")); copyButtonAction->setIcon(global.getIconResource(":copyIcon")); pasteButtonAction->setIcon(global.getIconResource(":pasteIcon")); removeFormatButtonAction->setIcon(global.getIconResource(":eraserIcon")); boldButtonWidget->setIcon(global.getIconResource(":boldIcon")); italicButtonWidget->setIcon(global.getIconResource(":italicsIcon")); underlineButtonWidget->setIcon(global.getIconResource(":underlineIcon")); strikethroughButtonAction->setIcon(global.getIconResource(":strikethroughIcon")); leftJustifyButtonAction->setIcon(global.getIconResource(":leftAlignIcon")); rightJustifyButtonAction->setIcon(global.getIconResource(":rightAlignIcon")); centerJustifyButtonAction->setIcon(global.getIconResource(":centerAlignIcon")); hlineButtonAction->setIcon(global.getIconResource(":hlineIcon")); shiftRightButtonAction->setIcon(global.getIconResource(":shiftRightIcon")); shiftLeftButtonAction->setIcon(global.getIconResource(":shiftLeftIcon")); bulletListButtonAction->setIcon(global.getIconResource(":bulletListIcon")); numberListButtonAction->setIcon(global.getIconResource(":numberListIcon")); fontColorButtonWidget->setIcon(global.getIconResource(":fontColorIcon")); highlightColorButtonWidget->setIcon(global.getIconResource(":fontHighlightIcon")); todoButtonAction->setIcon(global.getIconResource(":todoIcon")); spellCheckButtonAction->setIcon(global.getIconResource(":spellCheckIcon")); insertTableButtonAction->setIcon(global.getIconResource(":gridIcon")); htmlEntitiesButtonAction->setIcon(global.getIconResource(":htmlentitiesIcon")); }
EditorButtonBar::EditorButtonBar(QWidget *parent) : QToolBar(parent) { contextMenu = new QMenu(); undoVisible = contextMenu->addAction(tr("Undo")); redoVisible = contextMenu->addAction(tr("Redo")); cutVisible = contextMenu->addAction(tr("Cut")); copyVisible = contextMenu->addAction(tr("Copy")); pasteVisible = contextMenu->addAction(tr("Paste")); removeFormatVisible = contextMenu->addAction(tr("Remove Formatting")); boldVisible = contextMenu->addAction(tr("Bold")); italicVisible = contextMenu->addAction(tr("Italics")); superscriptVisible = contextMenu->addAction(tr("Superscript")); subscriptVisible = contextMenu->addAction(tr("Subscript")); underlineVisible = contextMenu->addAction(tr("Underline")); strikethroughVisible = contextMenu->addAction(tr("Strikethrough")); leftJustifyVisible = contextMenu->addAction(tr("Align Left")); centerJustifyVisible = contextMenu->addAction(tr("Align Center")); rightJustifyVisible = contextMenu->addAction(tr("Align Right")); hlineVisible = contextMenu->addAction(tr("Horizontal Line")); insertDatetimeVisible = contextMenu->addAction(tr("Insert Date && Time")); shiftRightVisible = contextMenu->addAction(tr("Shift Right")); shiftLeftVisible = contextMenu->addAction(tr("Shift Left")); bulletListVisible = contextMenu->addAction(tr("Bullet List")); numberListVisible = contextMenu->addAction(tr("Number List")); fontVisible = contextMenu->addAction(tr("Font")); fontSizeVisible = contextMenu->addAction(tr("Font Size")); fontColorVisible = contextMenu->addAction(tr("Font Color")); highlightVisible = contextMenu->addAction(tr("Highlight")); todoVisible = contextMenu->addAction(tr("To-do")); spellCheckButtonVisible = contextMenu->addAction(tr("Spell Check")); insertTableButtonVisible = contextMenu->addAction(tr("Insert Table")); htmlEntitiesButtonVisible = contextMenu->addAction(tr("HTML Entities")); undoVisible->setCheckable(true); redoVisible->setCheckable(true); cutVisible->setCheckable(true); copyVisible->setCheckable(true); pasteVisible->setCheckable(true); removeFormatVisible->setCheckable(true); boldVisible->setCheckable(true); italicVisible->setCheckable(true); underlineVisible->setCheckable(true); strikethroughVisible->setCheckable(true); superscriptVisible->setCheckable(true); subscriptVisible->setCheckable(true); leftJustifyVisible->setCheckable(true); centerJustifyVisible->setCheckable(true); rightJustifyVisible->setCheckable(true); hlineVisible->setCheckable(true); shiftRightVisible->setCheckable(true); shiftLeftVisible->setCheckable(true); bulletListVisible->setCheckable(true); numberListVisible->setCheckable(true); todoVisible->setCheckable(true); fontColorVisible->setCheckable(true); highlightVisible->setCheckable(true); fontColorVisible->setCheckable(true); fontSizeVisible->setCheckable(true); fontVisible->setCheckable(true); spellCheckButtonVisible->setCheckable(true); spellCheckButtonVisible->setChecked(true); insertTableButtonVisible->setCheckable(true); htmlEntitiesButtonVisible->setCheckable(true); insertDatetimeVisible->setCheckable(true); connect(undoVisible, SIGNAL(triggered()), this, SLOT(toggleUndoButtonVisible())); connect(redoVisible, SIGNAL(triggered()), this, SLOT(toggleRedoButtonVisible())); connect(cutVisible, SIGNAL(triggered()), this, SLOT(toggleCutButtonVisible())); connect(copyVisible, SIGNAL(triggered()), this, SLOT(toggleCopyButtonVisible())); connect(pasteVisible, SIGNAL(triggered()), this, SLOT(togglePasteButtonVisible())); connect(removeFormatVisible, SIGNAL(triggered()), this, SLOT(toggleRemoveFormatVisible())); connect(boldVisible, SIGNAL(triggered()), this, SLOT(toggleBoldButtonVisible())); connect(italicVisible, SIGNAL(triggered()), this, SLOT(toggleItalicButtonVisible())); connect(underlineVisible, SIGNAL(triggered()), this, SLOT(toggleUnderlineButtonVisible())); connect(strikethroughVisible, SIGNAL(triggered()), this, SLOT(toggleStrikethroughButtonVisible())); connect(superscriptVisible, SIGNAL(triggered()), this, SLOT(toggleSuperscriptButtonVisible())); connect(subscriptVisible, SIGNAL(triggered()), this, SLOT(toggleSubscriptButtonVisible())); connect(insertDatetimeVisible, SIGNAL(triggered()), this, SLOT(toggleInsertDatetimeVisible())); connect(leftJustifyVisible, SIGNAL(triggered()), this, SLOT(toggleLeftJustifyButtonVisible())); connect(centerJustifyVisible, SIGNAL(triggered()), this, SLOT(toggleCenterJustifyButtonVisible())); connect(rightJustifyVisible, SIGNAL(triggered()), this, SLOT(toggleRightJustifyButtonVisible())); connect(hlineVisible, SIGNAL(triggered()), this, SLOT(toggleHlineButtonVisible())); connect(shiftRightVisible, SIGNAL(triggered()), this, SLOT(toggleShiftRightButtonVisible())); connect(shiftLeftVisible, SIGNAL(triggered()), this, SLOT(toggleShiftLeftButtonVisible())); connect(bulletListVisible, SIGNAL(triggered()), this, SLOT(toggleBulletListButtonVisible())); connect(numberListVisible, SIGNAL(triggered()), this, SLOT(toggleNumberListButtonVisible())); connect(fontVisible, SIGNAL(triggered()), this, SLOT(toggleFontButtonVisible())); connect(fontSizeVisible, SIGNAL(triggered()), this, SLOT(toggleFontSizeButtonVisible())); connect(todoVisible, SIGNAL(triggered()), this, SLOT(toggleTodoButtonVisible())); connect(highlightVisible, SIGNAL(triggered()), this, SLOT(toggleHighlightColorVisible())); connect(fontColorVisible, SIGNAL(triggered()), this, SLOT(toggleFontColorVisible())); connect(insertTableButtonVisible, SIGNAL(triggered()), this, SLOT(toggleInsertTableButtonVisible())); connect(spellCheckButtonVisible, SIGNAL(triggered()), this, SLOT(toggleSpellCheckButtonVisible())); connect(htmlEntitiesButtonVisible, SIGNAL(triggered()), this, SLOT(toggleHtmlEntitiesButtonVisible())); undoButtonAction = this->addAction(global.getIconResource(":undoIcon"), tr("Undo")); undoButtonShortcut = new QShortcut(this); setupShortcut(undoButtonShortcut, "Edit_Undo"); redoButtonAction = this->addAction(global.getIconResource(":redoIcon"), tr("Redo")); redoButtonShortcut = new QShortcut(this); setupShortcut(redoButtonShortcut, "Edit_Redo"); redoButtonShortcut->setContext(Qt::WidgetShortcut); cutButtonAction = this->addAction(global.getIconResource(":cutIcon"), tr("Cut")); cutButtonShortcut = new QShortcut(this); setupShortcut(cutButtonShortcut, "Edit_Cut"); copyButtonAction = this->addAction(global.getIconResource(":copyIcon"), tr("Copy")); copyButtonShortcut = new QShortcut(this); setupShortcut(copyButtonShortcut, "Edit_Copy"); pasteButtonAction = this->addAction(global.getIconResource(":pasteIcon"), tr("Paste")); //this->setupShortcut(pasteButtonAction, "Edit_Paste"); // This is captured in NWebView via a keyevent statement removeFormatButtonAction = this->addAction(global.getIconResource(":eraserIcon"), tr("Remove Formatting")); removeFormatButtonShortcut = new QShortcut(this); this->setupShortcut(removeFormatButtonShortcut, "Edit_Remove_Formatting"); QLOG_DEBUG() << removeFormatButtonShortcut->key(); boldButtonWidget = new QToolButton(this); boldButtonWidget->setIcon(global.getIconResource(":boldIcon")); boldButtonWidget->setText(tr("Bold")); boldButtonAction = this->addWidget(boldButtonWidget); boldButtonShortcut = new QShortcut(this); this->setupShortcut(boldButtonShortcut, "Format_Bold"); italicButtonWidget = new QToolButton(this); italicButtonWidget->setIcon(global.getIconResource(":italicsIcon")); italicButtonWidget->setText(tr("Italics")); italicButtonWidget->setToolTip(tr("Italics")); italicButtonAction = this->addWidget(italicButtonWidget); italicButtonShortcut = new QShortcut(this); this->setupShortcut(italicButtonShortcut, "Format_Italic"); underlineButtonWidget = new QToolButton(this); underlineButtonWidget->setIcon(global.getIconResource(":underlineIcon")); underlineButtonWidget->setText(tr("Underline")); underlineButtonWidget->setToolTip(tr("Underline")); underlineButtonAction = this->addWidget(underlineButtonWidget); underlineButtonShortcut = new QShortcut(this); this->setupShortcut(underlineButtonShortcut, "Format_Underline"); strikethroughButtonAction = this->addAction(global.getIconResource(":strikethroughIcon"), tr("Strikethrough")); strikethroughButtonShortcut = new QShortcut(this); this->setupShortcut(strikethroughButtonShortcut, "Format_Strikethrough"); superscriptButtonAction = this->addAction(global.getIconResource(":superscriptIcon"), tr("Superscript")); superscriptButtonShortcut = new QShortcut(this); this->setupShortcut(superscriptButtonShortcut, "Format_Superscript"); subscriptButtonAction = this->addAction(global.getIconResource(":subscriptIcon"), tr("Subscript")); subscriptButtonShortcut = new QShortcut(this); this->setupShortcut(subscriptButtonShortcut, "Format_Subscript"); centerJustifyButtonAction = this->addAction(global.getIconResource(":centerAlignIcon"), tr("Center")); centerJustifyButtonShortcut = new QShortcut(this); this->setupShortcut(centerJustifyButtonShortcut, "Format_Alignment_Center"); rightJustifyButtonAction = this->addAction(global.getIconResource(":rightAlignIcon"), tr("Right Justify")); rightJustifyButtonShortcut = new QShortcut(this); this->setupShortcut(rightJustifyButtonShortcut, "Format_Alignment_Right"); leftJustifyButtonAction = this->addAction(global.getIconResource(":leftAlignIcon"), tr("Left Justify")); leftJustifyButtonShortcut = new QShortcut(this); this->setupShortcut(leftJustifyButtonShortcut, "Format_Alignment_Left"); hlineButtonAction = this->addAction(global.getIconResource(":hlineIcon"), tr("Horizontal Line")); hlineButtonShortcut = new QShortcut(this); this->setupShortcut(hlineButtonShortcut, "Format_Horizontal_Line"); insertDatetimeButtonWidget = new QToolButton(this); insertDatetimeButtonWidget->setIcon(global.getIconResource(":dateTime")); insertDatetimeButtonWidget->setText(tr("Insert Date & Time")); insertDatetimeButtonWidget->setToolTip(tr("Insert Date & Time")); insertDatetimeButtonAction = this->addWidget(insertDatetimeButtonWidget); insertDatetimeButtonShortcut = new QShortcut(this); insertDatetimeButtonShortcut->setKey(insertDatetimeButtonWidget->shortcut()); shiftRightButtonAction = this->addAction(global.getIconResource(":shiftRightIcon"), tr("Shift Right")); shiftRightButtonShortcut = new QShortcut(this); this->setupShortcut(shiftRightButtonShortcut, "Format_Indent_Increase"); shiftLeftButtonAction = this->addAction(global.getIconResource(":shiftLeftIcon"), tr("Shift Left")); shiftLeftButtonShortcut = new QShortcut(this); this->setupShortcut(shiftLeftButtonShortcut, "Format_Indent_Decrease"); bulletListButtonAction = this->addAction(global.getIconResource(":bulletListIcon"), tr("Bullet List")); bulletListButtonShortcut = new QShortcut(this); this->setupShortcut(bulletListButtonShortcut, "Format_List_Bullet"); numberListButtonAction = this->addAction(global.getIconResource(":numberListIcon"), tr("Number List")); numberListButtonShortcut = new QShortcut(this); this->setupShortcut(numberListButtonShortcut, "Format_List_Numbered"); fontNames = new FontNameComboBox(this); fontSizes = new FontSizeComboBox(this); loadFontNames(); fontButtonAction = addWidget(fontNames); fontSizeButtonAction = addWidget(fontSizes); fontColorMenuWidget = new ColorMenu(); fontColorButtonWidget = new QToolButton(this); fontColorButtonWidget->setAutoRaise(false); fontColorButtonWidget->setMenu(fontColorMenuWidget->getMenu()); fontColorButtonWidget->setIcon(global.getIconResource(":fontColorIcon")); fontColorButtonWidget->setToolTip(tr("Font Color")); fontColorAction = this->addWidget(fontColorButtonWidget); highlightColorMenuWidget = new ColorMenu(); highlightColorMenuWidget->setDefault(Qt::yellow); highlightColorButtonWidget = new QToolButton(this); highlightColorButtonWidget->setAutoRaise(false); highlightColorButtonWidget->setMenu(highlightColorMenuWidget->getMenu()); highlightColorButtonWidget->setIcon(global.getIconResource(":fontHighlightIcon")); highlightColorButtonWidget->setToolTip(tr("Highlight")); highlightColorAction = this->addWidget(highlightColorButtonWidget); highlightColorShortcut = new QShortcut(this); this->setupShortcut(highlightColorShortcut, "Format_Highlight"); todoButtonAction = this->addAction(global.getIconResource(":todoIcon"), tr("Todo")); todoButtonShortcut = new QShortcut(this); this->setupShortcut(todoButtonShortcut, "Edit_Insert_Todo"); spellCheckButtonAction = this->addAction(global.getIconResource(":spellCheckIcon"), tr("Spell Check")); spellCheckButtonShortcut = new QShortcut(this); this->setupShortcut(spellCheckButtonShortcut, "Tools_Spell_Check"); insertTableButtonAction = this->addAction(global.getIconResource(":gridIcon"), tr("Insert Table")); insertTableButtonShortcut = new QShortcut(this); this->setupShortcut(insertTableButtonShortcut, "Edit_Insert_Table"); htmlEntitiesButtonAction = this->addAction(global.getIconResource(":htmlentitiesIcon"), tr("Insert HTML Entities")); htmlEntitiesButtonShortcut = new QShortcut(this); setupShortcut(htmlEntitiesButtonShortcut, "Edit_Insert_Html_Entities"); htmlEntitiesButtonShortcut->setContext(Qt::WidgetShortcut); }
void FavoritesView::reloadIcons() { root->setIcon(NAME_POSITION, global.getIconResource(":favoritesIcon")); QHash<qint32, FavoritesViewItem*>::iterator i; for (i=dataStore.begin(); i!=dataStore.end(); ++i) { FavoritesViewItem *record = i.value(); if (record != NULL) { FavoritesRecord *r = &record->record; if (r != NULL) { switch (r->type) { case FavoritesRecord::Tag : record->setIcon(NAME_POSITION, global.getIconResource(":tagIcon")); break; case FavoritesRecord::Note : record->setIcon(NAME_POSITION, global.getIconResource(":newNoteIcon")); break; case FavoritesRecord::ConflictNotebook : record->setIcon(NAME_POSITION, global.getIconResource(":notebookConflictIcon")); break; case FavoritesRecord::LinkedNotebook : record->setIcon(NAME_POSITION, global.getIconResource(":notebookLinkedIcon")); break; case FavoritesRecord::LinkedStack : record->setIcon(NAME_POSITION, global.getIconResource(":silhouetteIcon")); break; case FavoritesRecord::LocalNotebook : record->setIcon(NAME_POSITION, global.getIconResource(":notebookLocalIcon")); break; case FavoritesRecord::Search : record->setIcon(NAME_POSITION, global.getIconResource(":searchIcon")); break; case FavoritesRecord::SharedNotebook : record->setIcon(NAME_POSITION, global.getIconResource(":notebookSharedIcon")); break; case FavoritesRecord::SynchronizedNotebook : record->setIcon(NAME_POSITION, global.getIconResource(":notebookSmallIcon")); break; case FavoritesRecord::NotebookStack : record->setIcon(NAME_POSITION, global.getIconResource(":stackIcon")); break; } } } } }
FavoritesView::FavoritesView(QWidget *parent) : QTreeWidget(parent) { setAcceptDrops(true); setDragEnabled(true); setDropIndicatorShown(true); setSelectionMode(QAbstractItemView::SingleSelection); dataStore.clear(); targetStore.clear(); this->setFont(global.getGuiFont(font())); filterPosition = -1; maxCount = 0; // Highest count of any notebook. Used in calculating column width // setup options this->setEditTriggers(QAbstractItemView::NoEditTriggers); this->setSelectionBehavior(QAbstractItemView::SelectRows); this->setSelectionMode(QAbstractItemView::SingleSelection); this->setDragDropMode(QAbstractItemView::InternalMove); this->setRootIsDecorated(true); this->setSortingEnabled(true); this->header()->setVisible(false); this->setStyleSheet("QTreeView {border-image:none; image:none;} "); root = new FavoritesViewItem(0); root->setData(NAME_POSITION, Qt::UserRole, "root"); root->setData(NAME_POSITION, Qt::DisplayRole, tr("Shortcuts")); QFont rootFont = root->font(NAME_POSITION); rootFont.setBold(true); root->setFont(NAME_POSITION, rootFont); root->setIcon(NAME_POSITION, global.getIconResource(":favoritesIcon")); root->setRootColor(false); expandedImage = new QImage(":expandedIcon"); collapsedImage = new QImage(":collapsedIcon"); this->setAcceptDrops(true); this->setItemDelegate(new FavoritesViewDelegate()); this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); this->setFrameShape(QFrame::NoFrame); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); this->setMinimumHeight(1); this->addTopLevelItem(root); this->rebuildFavoritesTreeNeeded = true; this->loadData(); context.addSeparator(); deleteAction = context.addAction(tr("Remove from shortcuts")); deleteAction->setShortcut(QKeySequence(Qt::Key_Delete)); deleteShortcut = new QShortcut(this); deleteShortcut->setKey(QKeySequence(Qt::Key_Delete)); deleteShortcut->setContext(Qt::WidgetShortcut); connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteRequested())); connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(calculateHeight())); connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, SLOT(calculateHeight())); connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(buildSelection())); connect(deleteShortcut, SIGNAL(activated()), this, SLOT(deleteRequested())); root->setExpanded(true); this->setProperty("animated", false); resetSize(); }
ExternalBrowse::ExternalBrowse(qint32 lid, QWidget *parent) : QMdiSubWindow(parent) { setAttribute(Qt::WA_QuitOnClose, false); this->setWindowTitle(tr("NixNote")); setWindowIcon(global.getIconResource(":windowIcon")); browser = new NBrowserWindow(this); setWidget(browser); // Setup shortcuts focusTitleShortcut = new QShortcut(this); focusTitleShortcut->setContext(Qt::WidgetShortcut); this->setupShortcut(focusTitleShortcut, "Focus_Title"); connect(focusTitleShortcut, SIGNAL(activated()), &browser->noteTitle, SLOT(setFocus())); focusNoteShortcut = new QShortcut(this); focusNoteShortcut->setContext(Qt::WidgetShortcut); this->setupShortcut(focusNoteShortcut, "Focus_Note"); connect(focusNoteShortcut, SIGNAL(activated()), browser->editor, SLOT(setFocus())); fileSaveShortcut = new QShortcut(this); fileSaveShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(focusNoteShortcut, "File_Save_Content"); connect(fileSaveShortcut, SIGNAL(activated()), browser, SLOT(saveNoteContent())); focusTagShortcut = new QShortcut(this); focusTagShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(focusTagShortcut, "Focus_Tag"); connect(focusTagShortcut, SIGNAL(activated()), browser, SLOT(newTagFocusShortcut())); focusUrlShortcut = new QShortcut(this); focusUrlShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(focusUrlShortcut, "Focus_Url"); connect(focusUrlShortcut, SIGNAL(activated()), browser, SLOT(urlFocusShortcut())); focusAuthorShortcut = new QShortcut(this); focusAuthorShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(focusAuthorShortcut, "Focus_Author"); connect(focusAuthorShortcut, SIGNAL(activated()), browser, SLOT(authorFocusShortcut())); focusNotebookShortcut = new QShortcut(this); focusNotebookShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(focusNotebookShortcut, "Focus_Notebook"); connect(focusNotebookShortcut, SIGNAL(activated()), browser, SLOT(notebookFocusShortcut())); focusFontShortcut = new QShortcut(this); focusFontShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(focusFontShortcut, "Focus_Font"); connect(focusFontShortcut, SIGNAL(activated()), browser, SLOT(fontFocusShortcut())); focusFontSizeShortcut = new QShortcut(this); focusFontSizeShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(focusFontSizeShortcut, "Focus_Font_Size"); connect(focusFontSizeShortcut, SIGNAL(activated()), browser, SLOT(fontSizeFocusShortcut())); findShortcut = new QShortcut(this); findShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(findShortcut, "Edit_Search_Find"); connect(findShortcut, SIGNAL(activated()), browser, SLOT(findShortcut())); findReplaceShortcut = new QShortcut(this); findReplaceShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(findReplaceShortcut, "Edit_Search_Find_Replace"); connect(findReplaceShortcut, SIGNAL(activated()), browser, SLOT(findReplaceShortcut())); findNextShortcut = new QShortcut(this); findNextShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(findNextShortcut, "Edit_Search_Find_Next"); connect(findNextShortcut, SIGNAL(activated()), browser, SLOT(findNextShortcut())); findPrevShortcut = new QShortcut(this); findPrevShortcut->setContext(Qt::WidgetWithChildrenShortcut); this->setupShortcut(findPrevShortcut, "Edit_Search_Find_Prev"); connect(findPrevShortcut, SIGNAL(activated()), browser, SLOT(findPrevShortcut())); // Load actual note browser->setContent(lid); }
void LocationEditor::reloadIcons() { this->setIcon(global.getIconResource(":navigationIcon")); }
void NAttributeTree::reloadIcons() { root->setIcon(0,global.getIconResource(":attributesIcon")); }
void NTagView::reloadIcons() { root->setIcon(NAME_POSITION,global.getIconResource(":tagIcon")); }
// Constructor NTagView::NTagView(QWidget *parent) : QTreeWidget(parent) { accountFilter = 0; this->setFont(global.getGuiFont(font())); filterPosition = 0; maxCount = 0; // setup options this->setEditTriggers(QAbstractItemView::NoEditTriggers); this->setSelectionBehavior(QAbstractItemView::SelectRows); this->setSelectionMode(QAbstractItemView::ExtendedSelection); this->setRootIsDecorated(true); this->setSortingEnabled(false); this->header()->setVisible(false); //this->setStyleSheet("QTreeWidget { background:transparent; border:none; margin:0px; padding: 0px; }"); // Build the root item root = new NTagViewItem(this); root->setIcon(NAME_POSITION,global.getIconResource(":tagIcon")); root->setData(NAME_POSITION, Qt::UserRole, "root"); root->setData(NAME_POSITION, Qt::DisplayRole, tr("Tags from Personal")); root->setExpanded(true); QFont rootFont = root->font(NAME_POSITION); rootFont.setBold(true); root->setFont(NAME_POSITION, rootFont); this->setMinimumHeight(1); this->addTopLevelItem(root); this->rebuildTagTreeNeeded = true; this->loadData(); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(calculateHeight())); connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, SLOT(calculateHeight())); connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(buildSelection())); setAcceptDrops(true); setDragEnabled(true); global.settings->beginGroup("SaveState"); hideUnassigned = global.settings->value("hideUnassigned", false).toBool(); global.settings->endGroup(); addAction = context.addAction(tr("Create New Tag")); addAction->setShortcut(QKeySequence(Qt::Key_Insert)); addAction->setShortcutContext(Qt::WidgetShortcut); addShortcut = new QShortcut(this); addShortcut->setKey(QKeySequence(Qt::Key_Insert)); addShortcut->setContext(Qt::WidgetShortcut); context.addSeparator(); deleteAction = context.addAction(tr("Delete")); deleteAction->setShortcut(QKeySequence(Qt::Key_Delete)); deleteShortcut = new QShortcut(this); deleteShortcut->setKey(QKeySequence(Qt::Key_Delete)); deleteShortcut->setContext(Qt::WidgetShortcut); renameAction = context.addAction(tr("Rename")); renameAction->setShortcutContext(Qt::WidgetShortcut); mergeAction = context.addAction(tr("Merge")); context.addSeparator(); hideUnassignedAction = context.addAction(tr("Hide Unassigned")); hideUnassignedAction->setCheckable(true); hideUnassignedAction->setChecked(hideUnassigned); connect(hideUnassignedAction, SIGNAL(triggered()), this, SLOT(hideUnassignedTags())); context.addSeparator(); propertiesAction = context.addAction(tr("Properties")); connect(addAction, SIGNAL(triggered()), this, SLOT(addRequested())); connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteRequested())); connect(renameAction, SIGNAL(triggered()), this, SLOT(renameRequested())); connect(propertiesAction, SIGNAL(triggered()), this, SLOT(propertiesRequested())); connect(mergeAction, SIGNAL(triggered()), this, SLOT(mergeRequested())); connect(addShortcut, SIGNAL(activated()), this, SLOT(addRequested())); connect(deleteShortcut, SIGNAL(activated()), this, SLOT(deleteRequested())); this->setItemDelegate(new NTagViewDelegate()); this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); this->setFrameShape(QFrame::NoFrame); expandedImage = new QImage(":expandedIcon"); collapsedImage = new QImage(":collapsedIcon"); }
EmailDialog::EmailDialog(QWidget *parent) : QDialog(parent) { setWindowIcon(global.getIconResource(":emailIcon")); sendPressed = false; cancelPressed = true; setWindowTitle(tr("Send Email")); sendButton = new QPushButton(tr("Send")); cancelButton = new QPushButton(tr("Cancel")); QGridLayout *grid = new QGridLayout(this); setLayout(grid); QGridLayout *addressGrid = new QGridLayout(); QGridLayout *noteGrid = new QGridLayout(); QGridLayout *buttonGrid = new QGridLayout(); grid->addLayout(addressGrid, 0,0); grid->addLayout(noteGrid, 1,0); grid->addLayout(buttonGrid,2,0); toLabel = new QLabel(this); toLabel->setText(tr("To:")); bccLabel = new QLabel(this); bccLabel->setText(tr("BCC:")); ccLabel = new QLabel(this); ccLabel->setText(tr("CC:")); subjectLabel = new QLabel(this); subjectLabel->setText(tr("Subject:")); noteLabel = new QLabel(this); noteLabel->setText(tr("Note:")); ccSelf = new QCheckBox(this); toAddress = new QLineEdit(this); ccAddress = new QLineEdit(this); bccAddress = new QLineEdit(this); subject = new QLineEdit(this); note = new QPlainTextEdit(this); int row = 0; addressGrid->addWidget(toLabel, row, 0); addressGrid->addWidget(toAddress, row++, 1); addressGrid->addWidget(ccLabel, row, 0); addressGrid->addWidget(ccAddress, row++, 1); addressGrid->addWidget(bccLabel, row, 0); addressGrid->addWidget(bccAddress, row++, 1); ccSelf->setText(tr("CC me on this email")); noteGrid->addWidget(ccSelf, 0,0); addressGrid->addWidget(subjectLabel, row, 0); addressGrid->addWidget(subject, row++,1); noteGrid->addWidget(noteLabel, 1, 0); noteGrid->addWidget(note, 2,0); buttonGrid->addWidget(cancelButton, 0,0); buttonGrid->addWidget(sendButton, 0,1); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonPressed())); connect(sendButton, SIGNAL(clicked()), this, SLOT(sendButtonPressed())); connect(toAddress, SIGNAL(textChanged(QString)), this, SLOT(toAddressChanged())); connect(ccAddress, SIGNAL(textChanged(QString)), this, SLOT(toAddressChanged())); connect(bccAddress, SIGNAL(textChanged(QString)), this, SLOT(toAddressChanged())); connect(ccSelf, SIGNAL(toggled(bool)), this, SLOT(toAddressChanged())); cancelButton->setAutoDefault(false); sendButton->setEnabled(false); sendButton->setAutoDefault(true); sendButton->setAutoExclusive(true); toAddress->setFocus(); }