// 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()));
}
Example #2
0
void NMainMenuBar::createThemeMenu(QMenu *parentMenu) {
    QMenu *menu = parentMenu->addMenu(tr("Theme"));
    QStringList list = global.getThemeNames();
    QFont f = global.getGuiFont(QFont());

    global.settings->beginGroup(INI_GROUP_APPEARANCE);
    QString userTheme = global.settings->value("themeName", DEFAULT_THEME_NAME).toString();
    global.settings->endGroup();


    // Setup themes (we expect to find the DEFAULT_THEME_NAME theme as first one)
    for (int i = 0; i < list.size(); i++) {
        QString themeName(list[i]);
        if ((i == 0) && (QString::compare(themeName, DEFAULT_THEME_NAME, Qt::CaseInsensitive) != 0)) {
            QLOG_ERROR() << "First theme is expected to be " << DEFAULT_THEME_NAME;
        }


        QAction *themeAction = new QAction(themeName, this);
        themeAction->setData(themeName);
        themeAction->setCheckable(true);
        themeAction->setFont(f);
        connect(themeAction, SIGNAL(triggered()), parent, SLOT(reloadIcons()));
        if (themeName == userTheme) {
            themeAction->setChecked(true);
        }
        themeActions.append(themeAction);
    }
    menu->addActions(themeActions);
    menu->setFont(f);
}
Example #3
0
void NMainMenuBar::createSortMenu(QMenu *parentMenu) {
    sortMenu = parentMenu->addMenu(tr("Sort notes by"));

    QFont f = global.getGuiFont(QFont());
    QActionGroup *menuActionGroup = new QActionGroup(this);
    menuActionGroup->setExclusive(true);

    addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date updated [desc]"), INI_VALUE_SORTORDER_DEFAULT);
    addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date updated [asc]"), "relevance desc, dateUpdated asc");

    addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date created [desc]"), "relevance desc, dateCreated desc");
    addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date created [asc]"), "relevance desc, dateCreated asc");

    addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Title [desc]"), "relevance desc, title desc");
    addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Title [asc]"), "relevance desc, title asc");
    sortMenu->addSeparator();

    addSortAction(sortMenu, menuActionGroup, f, tr("Date updated [desc]"), "dateUpdated desc");
    addSortAction(sortMenu, menuActionGroup, f, tr("Date updated [asc]"), "dateUpdated asc");

    addSortAction(sortMenu, menuActionGroup, f, tr("Date created [desc]"), "dateCreated desc");
    addSortAction(sortMenu, menuActionGroup, f, tr("Date created [asc]"), "dateCreated asc");

    addSortAction(sortMenu, menuActionGroup, f, tr("Title [desc]"), "title desc");
    addSortAction(sortMenu, menuActionGroup, f, tr("Title [asc]"), "title asc");

    addSortAction(sortMenu, menuActionGroup, f, tr("Size [desc]"), "size desc, dateUpdated desc");
    addSortAction(sortMenu, menuActionGroup, f, tr("Has todo [desc]"), "hasTodo desc, dateUpdated desc");
    addSortAction(sortMenu, menuActionGroup, f, tr("Unsynced first"), "isDirty desc, dateUpdated desc");

    sortMenu->setFont(f);
}
LocationEditor::LocationEditor(QWidget *parent) :
    QToolButton(parent)
{
    QPalette pal;
    pal.setColor(backgroundRole(), QPalette::Base);
    setPalette(pal);

    this->setFont(global.getGuiFont(font()));

    inactiveColor = "QToolButton {background-color: transparent; border-radius: 0px; border:none; margin 0px; padding: 4px} ";
    this->setCursor(Qt::PointingHandCursor);
    this->setStyleSheet(inactiveColor);

    defaultText = QString(tr("Click to set location..."));
    this->setText(defaultText);
    actionMenu = new QMenu();
    editAction = actionMenu->addAction(tr("Edit..."));
    clearAction = actionMenu->addAction(tr("Clear"));
    viewAction = actionMenu->addAction(tr("View on map"));
    connect(editAction, SIGNAL(triggered()), this, SLOT(buttonClicked()));
    connect(viewAction, SIGNAL(triggered()), this, SLOT(viewClicked()));
    connect(clearAction, SIGNAL(triggered()), this, SLOT(clearClicked()));
    setAutoRaise(false);
    setMenu(actionMenu);
    this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    this->reloadIcons();
    connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()));

    hide();
}
// Load the list of font names
void EditorButtonBar::loadFontNames() {
    if (global.forceWebFonts){
        QStringList fontFamilies;
        fontFamilies.append("Gotham");
        fontFamilies.append("Georgia");
        fontFamilies.append("Helvetica");
        fontFamilies.append("Courier New");
        fontFamilies.append("Times New Roman");
        fontFamilies.append("Times");
        fontFamilies.append("Trebuchet");
        fontFamilies.append("Verdana");
        fontFamilies.sort();
        bool first = true;

        for (int i = 0; i < fontFamilies.size(); i++) {
            fontNames->addItem(fontFamilies[i], fontFamilies[i].toLower());
            QFont f;
            global.getGuiFont(f);
            f.setFamily(fontFamilies[i]);
            fontNames->setItemData(i, QVariant(f), Qt::FontRole);
            if (first) {
                loadFontSizeComboBox(fontFamilies[i]);
                first=false;
            }
        }
        return;
    }

    // Load up the list of font names
    QFontDatabase fonts;
    QStringList fontFamilies = fonts.families();
    fontFamilies.append(tr("Times"));
    fontFamilies.sort();
    bool first = true;

    for (int i = 0; i < fontFamilies.size(); i++) {
        fontNames->addItem(fontFamilies[i], fontFamilies[i].toLower());
        QFont f;
        global.getGuiFont(f);
        f.setFamily(fontFamilies[i]);
        fontNames->setItemData(i, QVariant(f), Qt::FontRole);
        if (first) {
            loadFontSizeComboBox(fontFamilies[i]);
            first=false;
        }
    }
}
Example #6
0
LocalePreferences::LocalePreferences(QWidget *parent) :
    QWidget(parent)
{
    mainLayout = new QGridLayout(this);
    mainLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    setLayout(mainLayout);
    QDate date = QDate::currentDate();
    QTime time = QTime::currentTime();

    dateFormatLabel = new QLabel(tr("Date Format"), this);
    dateFormatLabel->setAlignment(Qt::AlignRight | Qt::AlignCenter);
    dateFormat = new QComboBox(this);
    dateFormat->addItem(tr("MM/dd/yy - ") + date.toString("MM/dd/yy"), MMddyy);
    dateFormat->addItem(tr("MM/dd/yyyy - ")+ date.toString("MM/dd/yyyy"), MMddyyyy);
    dateFormat->addItem(tr("M/dd/yyyy - ")+ date.toString("M/dd/yyyy"), Mddyyyy);
    dateFormat->addItem(tr("M/d/yyyy - ")+ date.toString("M/d/yyyy"), Mdyyyy);
    dateFormat->addItem(tr("dd/MM/yy - ")+ date.toString("dd/MM/yy"), ddMMyy);
    dateFormat->addItem(tr("d/M/yy - ")+ date.toString("d/M/yy"), dMyy);
    dateFormat->addItem(tr("dd/MM/yyyy - ")+ date.toString("dd/MM/yyyy"), ddMMyyyy);
    dateFormat->addItem(tr("d/M/yyyy - ")+ date.toString("d/M/yyyy"), dMyyyy);
    dateFormat->addItem(tr("yyyy-MM-dd - ")+ date.toString("yyyy-MM-dd"), yyyyMMdd);
    dateFormat->addItem(tr("yy-MM-dd - ")+ date.toString("yy-MM-dd"), yyyyMMdd);


    timeFormatLabel = new QLabel(tr("Time Format"), this);
    timeFormatLabel->setAlignment(Qt::AlignRight | Qt::AlignCenter);
    timeFormat = new QComboBox(this);
    timeFormat->addItem(tr("HH:mm:ss - ")+time.toString("HH:mm:ss"), HHmmss);
    timeFormat->addItem(tr("HH:mm:ss a - ")+time.toString("HH:mm:ss a"), HHmmssa);
    timeFormat->addItem(tr("HH:mm - ")+time.toString("HH:mm"), HHmm);
    timeFormat->addItem(tr("HH:mm a - ")+time.toString("HH:mm a"), HHmma);
    timeFormat->addItem(tr("hh:mm:ss - ")+time.toString("hh:mm:ss"), hhmmss);
    timeFormat->addItem(tr("hh:mm:ss a- ")+time.toString("hh:mm:ss a"), hhmmssa);
    timeFormat->addItem(tr("h:mm:ss a - ")+time.toString("h:mm:ss a"), hmmssa);
    timeFormat->addItem(tr("hh:mm - ")+time.toString("HH:mm"), hhmm);
    timeFormat->addItem(tr("hh:mm a - ")+time.toString("hh:mm a"), hhmma);
    timeFormat->addItem(tr("h:mm a - ")+time.toString("h:mm a"), hmma);

    mainLayout->addWidget(dateFormatLabel,0,0);
    mainLayout->addWidget(dateFormat,0,1);
    mainLayout->addWidget(timeFormatLabel,1,0);
    mainLayout->addWidget(timeFormat, 1,1);

    global.settings->beginGroup("Locale");
    int datei = global.settings->value("dateFormat", MMddyy).toInt();
    int timei = global.settings->value("timeFormat", HHmmss).toInt();
    global.settings->endGroup();
    int index = dateFormat->findData(datei);
    dateFormat->setCurrentIndex(index);
    index = timeFormat->findData(timei);
    timeFormat->setCurrentIndex(index);
    this->setFont(global.getGuiFont(font()));
}
Example #7
0
NMainMenuBar::NMainMenuBar(QWidget *parent) :
    QMenuBar(parent) {
    this->parent = (NixNote *) parent;
    QFont f = global.getGuiFont(QFont());
    this->setFont(f);

    setupFileMenu();
    setupEditMenu();
    setupViewMenu();
    setupNoteMenu();
    setupToolsMenu();
    setupHelpMenu();
}
Example #8
0
EnCryptDialog::EnCryptDialog(QWidget *parent) :
    QDialog(parent)
{

    wasOkPressed = false;
    setWindowTitle(tr("Encrypt Text"));
    //setWindowIcon(new QIcon(iconPath+"password.png"));
    QGridLayout *grid = new QGridLayout(this);
    QGridLayout *input = new QGridLayout(this);
    QGridLayout *msgGrid = new QGridLayout(this);
    QGridLayout *button = new QGridLayout(this);
    setLayout(grid);


    hint.setText("");
    password.setText("");
    password.setEchoMode(QLineEdit::Password);
    password2.setText("");
    password2.setEchoMode(QLineEdit::Password);


    input->addWidget(new QLabel(tr("Password"), this), 1,1);
    input->addWidget(&password, 1, 2);
    input->addWidget(new QLabel(tr("Verify"), this), 2,1);
    input->addWidget(&password2, 2, 2);
    input->addWidget(new QLabel(tr("Hint"), this), 3,1);
    input->addWidget(&hint, 3, 2);
    input->addWidget(new QLabel(tr("Remember Password")), 4,1);
    input->addWidget(&rememberPassword, 4,2);
    input->setContentsMargins(10, 10,  -10, -10);
    grid->addLayout(input, 1,1);

    msgGrid->addWidget(&error, 1, 1);
    grid->addLayout(msgGrid, 2, 1);

    ok.setText(tr("OK"));
    connect(&ok, SIGNAL(clicked()), this, SLOT(okButtonPressed()));
    ok.setEnabled(false);

    QPushButton *cancel = new QPushButton(tr("Cancel"), this);
    connect(cancel, SIGNAL(clicked()), this, SLOT(cancelButtonPressed()));
    button->addWidget(&ok, 1, 1);
    button->addWidget(cancel, 1,2);
    grid->addLayout(button, 3, 1);

    connect(&password, SIGNAL(textChanged(QString)), this, SLOT(validateInput()));
    connect(&password2, SIGNAL(textChanged(QString)), this, SLOT(validateInput()));
    connect(&hint, SIGNAL(textChanged(QString)), this, SLOT(validateInput()));
    this->setFont(global.getGuiFont(font()));

}
TreeWidgetEditor::TreeWidgetEditor(QTreeWidget *parent) :
    QLineEdit(parent)
{
    this->parent = parent;
    this->setFont(global.getGuiFont(font()));
    lid = 0;
    stackName = "";
    connect(this, SIGNAL(returnPressed()), SLOT(textChanged()));

    QString css = global.getThemeCss("treeWidgetEditorCss");
    if (css!="")
        this->setStyleSheet(css);

}
Example #10
0
void NMainMenuBar::setupNoteMenu() {

    noteMenu = this->addMenu(tr("&Note"));
    QFont f = global.getGuiFont(QFont());
    noteMenu->setFont(f);

    newNoteAction = new QAction(tr("New &Note"), noteMenu);
    setupShortcut(newNoteAction, QString("File_Note_Add"));
    noteMenu->addAction(newNoteAction);
    connect(newNoteAction, SIGNAL(triggered()), parent, SLOT(newNote()));

    duplicateNoteAction = new QAction(tr("Dupl&icate Note"), noteMenu);
    setupShortcut(duplicateNoteAction, QString("File_Note_Duplicate"));
    noteMenu->addAction(duplicateNoteAction);
    connect(duplicateNoteAction, SIGNAL(triggered()), parent, SLOT(duplicateCurrentNote()));

    deleteNoteAction = new QAction(tr("&Delete"), noteMenu);
    setupShortcut(deleteNoteAction, QString("File_Note_Delete"));
    noteMenu->addAction(deleteNoteAction);
    connect(deleteNoteAction, SIGNAL(triggered()), parent, SLOT(deleteCurrentNote()));

    reindexNoteAction = new QAction(tr("Reindex Note"), noteMenu);
    setupShortcut(reindexNoteAction, QString("File_Note_Reindex"));
    noteMenu->addAction(reindexNoteAction);
    connect(reindexNoteAction, SIGNAL(triggered()), parent, SLOT(reindexCurrentNote()));

    if (parent->hunspellPluginAvailable) {
        noteMenu->addSeparator();
        spellCheckAction = new QAction(tr("&Spell Check"), noteMenu);
        // setupShortcut(spellCheckAction, QString("Tools_Spell_Check"));  This shortcut is done by the editor button bar
        noteMenu->addAction(spellCheckAction);
        connect(spellCheckAction, SIGNAL(triggered()), parent, SLOT(spellCheckCurrentNote()));
    }


    noteMenu->addSeparator();

    pinNoteAction = new QAction(tr("&Pin Note"), noteMenu);
    setupShortcut(pinNoteAction, QString("NOTE_PIN"));
    noteMenu->addAction(pinNoteAction);
    connect(pinNoteAction, SIGNAL(triggered()), parent, SLOT(pinCurrentNote()));

    unpinNoteAction = new QAction(tr("&UnPin Note"), noteMenu);
    setupShortcut(unpinNoteAction, QString("NOTE_UNPIN"));
    noteMenu->addAction(unpinNoteAction);
    connect(unpinNoteAction, SIGNAL(triggered()), parent, SLOT(unpinCurrentNote()));

}
Example #11
0
NTitleEditor::NTitleEditor(QWidget *parent) :
    QLineEdit(parent)
{
    // Setup the note title editor
    QPalette pal;
    //pal.setColor(QPalette::Text, QColor(102,153,255));
    pal.setColor(QPalette::Text, QColor(14,28,209));
    pal.setColor(backgroundRole(), QPalette::Base);
    setPalette(pal);

    inactiveColor = "QLineEdit {background-color: transparent; border-radius: 0px;} QLineEdit:hover {border: 1px solid #808080; background-color: white; border-radius: 4px;} ";
    activeColor = "QLineEdit {border: 1px solid #808080; background-color: white; border-radius: 4px;} ";
    this->setStyleSheet(inactiveColor);
    connect(this, SIGNAL(textChanged(QString)), this, SLOT(titleChanged(QString)));

    this->setFont(global.getGuiFont(font()));
}
Example #12
0
NTrashTree::NTrashTree(QWidget *parent) :
    QTreeWidget(parent)
{
    this->count = 0;
    this->setFont(global.getGuiFont(font()));

    filterPosition = -1;
    // 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->setContentsMargins(10,10,10,10);
    //this->setStyleSheet("QTreeWidget {  border: none; background-color:transparent; }");

    // Build the root item
    QIcon icon(":trashIcon");
    root = new QTreeWidgetItem(this);
    root->setIcon(0,icon);
    root->setData(0, Qt::UserRole, "root");
    root->setData(0, Qt::DisplayRole, tr("Trash"));
    QFont font = root->font(0);
    font.setBold(true);
    root->setFont(0,font);
    this->setMinimumHeight(1);
    this->addTopLevelItem(root);
    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()));

    restoreAction = contextMenu.addAction(tr("Restore Deleted Notes"));
    connect(restoreAction, SIGNAL(triggered()), SLOT(restoreAll()));
    contextMenu.addSeparator();
    expungeAction = contextMenu.addAction(tr("Empty Trash"));
    connect(expungeAction, SIGNAL(triggered()), this, SLOT(expungeAll()));

    setItemDelegate(new NTrashViewDelegate());
    this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    this->setFrameShape(QFrame::NoFrame);
}
Example #13
0
SearchPreferences::SearchPreferences(QWidget *parent) :
    QWidget(parent)
{
    QGridLayout *mainLayout = new QGridLayout(this);
    setLayout(mainLayout);

    syncAttachments = new QCheckBox(tr("Index Attachments"));
    mainLayout->addWidget(syncAttachments,0,0);
    syncAttachments->setChecked(global.synchronizeAttachments());

    weight = new QSpinBox(this);
    mainLayout->addWidget(new QLabel(tr("Minimum Image Recognition Weight")), 1,0);
    mainLayout->addWidget(weight,1,1);
    weight->setMinimum(1);
    weight->setMaximum(100);
    weight->setValue(global.getMinimumRecognitionWeight());
    this->setFont(global.getGuiFont(font()));

}
// Load the list of font names
void EditorButtonBar::loadFontNames() {
    QFontDatabase fonts;
    QStringList fontFamilies = fonts.families();
    fontFamilies.append(tr("Times"));
    fontFamilies.sort();
    bool first = true;
    //QFontDatabase fdb;
    for (int i = 0; i < fontFamilies.size(); i++) {
        fontNames->addItem(fontFamilies[i], fontFamilies[i].toLower());
        QFont f;
        global.getGuiFont(f);
        f.setFamily(fontFamilies[i]);
        fontNames->setItemData(i, QVariant(f), Qt::FontRole);
        if (first) {
            loadFontSizeComboBox(fontFamilies[i]);
            first=false;
        }
    }
}
Example #15
0
AboutDialog::AboutDialog(QDialog *parent) :
    QDialog(parent)
{
    QVBoxLayout *mainLayout = new QVBoxLayout();
    this->setLayout(mainLayout);
    QWebView *page = new QWebView();
    QPushButton *okButton = new QPushButton();
    okButton->setText(tr("OK"));
    mainLayout->addWidget(page);
    QHBoxLayout *buttonLayout = new QHBoxLayout();
    QSpacerItem *spacer1 = new QSpacerItem(100000,1, QSizePolicy::Maximum);
    QSpacerItem *spacer2 = new QSpacerItem(100000,1, QSizePolicy::Maximum);
    buttonLayout->addSpacerItem(spacer1);
    buttonLayout->addWidget(okButton);
    buttonLayout->addSpacerItem(spacer2);
    mainLayout->addLayout(buttonLayout);
    this->setLayout(mainLayout);
    QString file = global.fileManager.getProgramDirPath("") + "/help/about.html";
    QFile f(file);
    if(!f.open(QFile::ReadOnly))
        return;
    QTextStream is(&f);
    QString data = is.readAll();
    QString translationInformation =
            tr("Note to translators: For translation credit, change this message to your name & contact information and it will appear in the About dialog box. HTML Formatting is available.");
    QString translationStaticInformation =
            "Note to translators: For translation credit, change this message to your name & contact information and it will appear in the About dialog box. HTML Formatting is available.";
    if (translationInformation == translationStaticInformation) {
        data.replace("__TRANSLATION__", "");
    } else {
        data = data.replace("__TRANSLATION__", translationInformation);
    }
#ifndef _WIN32
    data = data.replace("__LOGO__", "file://"+global.fileManager.getImageDirPath("")+"splash_logo.png");
#else
    data = data.replace("__LOGO__", "file:///"+global.fileManager.getImageDirPath("").replace("\\","/")+"splash_logo.png");
#endif
    page->setHtml(data);
    connect(okButton, SIGNAL(clicked()), this, SLOT(close()));
    this->resize(600,500);
    this->setFont(global.getGuiFont(font()));
}
PreferencesDialog::PreferencesDialog(QWidget *parent) :
    QDialog(parent)
{
    okButtonPressed = false;
    setWindowTitle(tr("User Settings"));
    mainLayout = new QVBoxLayout();
    setLayout(mainLayout);

    tabs = new QTabWidget(this);
    mainLayout->addWidget(tabs);
    this->setFont(global.getGuiFont(font()));

    this->setupAppearancePanel();
    this->setupLocalePanel();
    this->setupSyncPanel();
    this->setupSearchPanel();
    this->setupDebugPanel();

    cancelButton = new QPushButton(tr("Cancel"), this);
    okButton = new QPushButton(tr("OK"), this);

    connect(okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));

    QSpacerItem *spacer1 = new QSpacerItem(0,0,QSizePolicy::MinimumExpanding);
    QSpacerItem *spacer2 = new QSpacerItem(0,0,QSizePolicy::MinimumExpanding);


    buttonLayout = new QHBoxLayout();
    buttonLayout->addSpacerItem(spacer1);
    buttonLayout->addWidget(okButton);
    buttonLayout->addWidget(cancelButton);
    buttonLayout->addSpacerItem(spacer2);
    buttonLayout->setStretch(0,100);
    buttonLayout->setStretch(3,100);

    mainLayout->addLayout(buttonLayout);

    connect(appearancePanel->showTrayIcon, SIGNAL(clicked(bool)),
            syncPanel->enableSyncNotifications, SLOT(setEnabled(bool)));
    syncPanel->enableSyncNotifications->setEnabled(appearancePanel->showTrayIcon->isChecked());
}
Example #17
0
AboutDialog::AboutDialog(QDialog *parent) :
    QDialog(parent) {
    QVBoxLayout *mainLayout = new QVBoxLayout();
    this->setLayout(mainLayout);
    QWebView *page = new QWebView();
    QPushButton *okButton = new QPushButton();
    okButton->setText(tr("OK"));
    mainLayout->addWidget(page);
    QHBoxLayout *buttonLayout = new QHBoxLayout();
    QSpacerItem *spacer1 = new QSpacerItem(100000, 1, QSizePolicy::Maximum);
    QSpacerItem *spacer2 = new QSpacerItem(100000, 1, QSizePolicy::Maximum);
    buttonLayout->addSpacerItem(spacer1);
    buttonLayout->addWidget(okButton);
    buttonLayout->addSpacerItem(spacer2);
    mainLayout->addLayout(buttonLayout);
    this->setLayout(mainLayout);
    const QString programDataDir = global.fileManager.getProgramDataDir();
    QString versionStr = tr("Version: ") + global.fileManager.getProgramVersionPrintable();

    QString aboutFileName = programDataDir + "help/about.html";
    QString data = global.fileManager.readFile(aboutFileName);

    #define TR_TX "Note to translators: For translation credit, change this message to your name & contact information and it will appear in the About dialog box. HTML Formatting is available."
    QString translationInformation = tr(TR_TX);
    QString translationStaticInformation = TR_TX;
    if (translationInformation == translationStaticInformation) {
        data.replace("__TRANSLATION__", "");
    } else {
        data = data.replace("__TRANSLATION__", translationInformation);
    }

    data.replace("__VERSION__", versionStr);
    data = data.replace("__LOGO__", "file://" + global.fileManager.getImageDirPath("") + "splash_logo.png");

    page->setHtml(data);
    connect(okButton, SIGNAL(clicked()), this, SLOT(close()));
    this->resize(600, 500);
    this->setFont(global.getGuiFont(font()));
}
Example #18
0
AboutDialog::AboutDialog(QDialog *parent) :
    QDialog(parent)
{
    QVBoxLayout *mainLayout = new QVBoxLayout();
    this->setLayout(mainLayout);
    QWebView *page = new QWebView();
    QPushButton *okButton = new QPushButton();
    okButton->setText(tr("OK"));
    mainLayout->addWidget(page);
    QHBoxLayout *buttonLayout = new QHBoxLayout();
    QSpacerItem *spacer1 = new QSpacerItem(100000,1, QSizePolicy::Maximum);
    QSpacerItem *spacer2 = new QSpacerItem(100000,1, QSizePolicy::Maximum);
    buttonLayout->addSpacerItem(spacer1);
    buttonLayout->addWidget(okButton);
    buttonLayout->addSpacerItem(spacer2);
    mainLayout->addLayout(buttonLayout);
    this->setLayout(mainLayout);
    QString file = "file://" + global.fileManager.getProgramDirPath("") + "/help/about.html";
    page->load(file);
    connect(okButton, SIGNAL(clicked()), this, SLOT(close()));
    this->resize(600,500);
    this->setFont(global.getGuiFont(font()));
}
LocalePreferences::LocalePreferences(QWidget *parent) :
    QWidget(parent)
{
    mainLayout = new QGridLayout(this);
    mainLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    setLayout(mainLayout);
    QDate date = QDate::currentDate();
    QTime time = QTime::currentTime();

    translationLabel = new QLabel("Language *");
    translationLabel->setAlignment(Qt::AlignRight | Qt::AlignCenter);
    translationCombo = new QComboBox(this);
    translationCombo->addItem(tr("<System Default>"), QLocale::system().name());
    translationCombo->addItem(tr("Catalan"), "ca");
    translationCombo->addItem(tr("Czech"), "cs_CZ");
    translationCombo->addItem(tr("Danish"), "da");
    translationCombo->addItem(tr("German"), "de");
    translationCombo->addItem(tr("English (US)"), "en_US");
    translationCombo->addItem(tr("English (UK)"), "en_GB");
    translationCombo->addItem(tr("Spanish"), "es");
    translationCombo->addItem(tr("French"), "fr");
    translationCombo->addItem(tr("Japanese"), "ja");
    translationCombo->addItem(tr("Polish"), "pl");
    translationCombo->addItem(tr("Portugese"), "pt");
    translationCombo->addItem(tr("Russian"), "ru");
    translationCombo->addItem(tr("Slovak"), "sk");
    translationCombo->addItem(tr("Chinese"), "zh_CN");
    translationCombo->addItem(tr("Chinese (Taiwan)"), "zh_TW");
    QLabel *restartLabel = new QLabel(tr("*Note: Restart required"),this);


    dateFormatLabel = new QLabel(tr("Date Format"), this);
    dateFormatLabel->setAlignment(Qt::AlignRight | Qt::AlignCenter);
    dateFormatCombo = new QComboBox(this);
    const QStringList dateFormats = global.getDateFormats();
    for (int i = 0; i < dateFormats.size(); i++) {
        const QString fmt = dateFormats.at(i);
        dateFormatCombo->addItem(fmt + QStringLiteral(" - ") + date.toString(fmt), i + 1);
    }


    timeFormatLabel = new QLabel(tr("Time Format"), this);
    timeFormatLabel->setAlignment(Qt::AlignRight | Qt::AlignCenter);
    timeFormatCombo = new QComboBox(this);
    const QStringList timeFormats = global.getTimeFormats();
    for (int i = 0; i < timeFormats.size(); i++) {
        const QString fmt = timeFormats.at(i);
        timeFormatCombo->addItem(fmt + QStringLiteral(" - ") + time.toString(fmt), i + 1);
    }

    mainLayout->addWidget(translationLabel,0,0);
    mainLayout->addWidget(translationCombo,0,1);
    mainLayout->addWidget(dateFormatLabel,1,0);
    mainLayout->addWidget(dateFormatCombo,1,1);
    mainLayout->addWidget(timeFormatLabel,2,0);
    mainLayout->addWidget(timeFormatCombo,2,1);
    mainLayout->addWidget(restartLabel,3,0);

    global.settings->beginGroup(INI_GROUP_LOCALE);
    QString translationi = global.settings->value("translation", "").toString();
    int datei = global.settings->value("dateFormat", 1).toInt();
    int timei = global.settings->value("timeFormat", 1).toInt();
    global.settings->endGroup();

    int index = dateFormatCombo->findData(datei);
    dateFormatCombo->setCurrentIndex(index);

    index = timeFormatCombo->findData(timei);
    timeFormatCombo->setCurrentIndex(index);

    index = translationCombo->findData(translationi);
    translationCombo->setCurrentIndex(index);
    this->setFont(global.getGuiFont(font()));
}
Example #20
0
// Override the constructor so we always use a NWebPage
// rather than a QWebPage
NWebView::NWebView(NBrowserWindow *parent) :
    QWebView(parent)
{
    this->parent = parent;
    editorPage = new NWebPage(this);
    setPage(editorPage);
    isDirty = false;
    this->setFont(global.getGuiFont(font()));

    contextMenu = new QMenu(this);
    openAction = new QAction(tr("Open"), this);
    contextMenu->addAction(openAction);
    contextMenu->addSeparator();
    contextMenu->setFont(global.getGuiFont(font()));

    cutAction = new QAction(tr("Cut"), this);
    this->setupShortcut(cutAction, "Edit_Cut");
    contextMenu->addAction(cutAction);
    connect(cutAction, SIGNAL(triggered()), parent, SLOT(cutButtonPressed()));

    copyAction = new QAction(tr("Copy"), this);
    this->setupShortcut(copyAction, "Edit_Copy");
    contextMenu->addAction(copyAction);
    connect(copyAction, SIGNAL(triggered()), parent, SLOT(copyButtonPressed()));

    pasteAction = new QAction(tr("Paste"), this);
    setupShortcut(pasteAction, "Edit_Paste");
    contextMenu->addAction(pasteAction);
    connect(pasteAction, SIGNAL(triggered()), parent, SLOT(pasteButtonPressed()));

    pasteWithoutFormatAction = new QAction(tr("Paste as Unformatted Text"), this);
    this->setupShortcut(pasteWithoutFormatAction, "Edit_Paste_Without_Formatting");
    contextMenu->addAction(pasteWithoutFormatAction);
    connect(pasteWithoutFormatAction, SIGNAL(triggered()), parent, SLOT(pasteWithoutFormatButtonPressed()));

    removeFormattingAction = new QAction(tr("Remove Formatting"), this);
    this->setupShortcut(removeFormattingAction, "Edit_Remove_Formatting");
    contextMenu->addAction(removeFormattingAction);
    connect(removeFormattingAction, SIGNAL(triggered()), parent, SLOT(removeFormatButtonPressed()));

    contextMenu->addSeparator();

    QMenu *colorMenu = new QMenu(tr("Background Color"), this);
    colorMenu->setFont(global.getGuiFont(font()));
    QAction *action = setupColorMenuOption(tr("White"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundWhite()));
    action = setupColorMenuOption(tr("Red"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundRed()));
    action = setupColorMenuOption(tr("Blue"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundBlue()));
    action = setupColorMenuOption(tr("Green"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundGreen()));
    action = setupColorMenuOption(tr("Yellow"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundYellow()));
    action = setupColorMenuOption(tr("Black"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundBlack()));
    action = setupColorMenuOption(tr("Grey"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundGrey()));
    action = setupColorMenuOption(tr("Purple"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundPurple()));
    action = setupColorMenuOption(tr("Brown"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundBrown()));
    action = setupColorMenuOption(tr("Orange"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundOrange()));
    action = setupColorMenuOption(tr("Powder Blue"));
    colorMenu->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundPowderBlue()));

    contextMenu->addMenu(colorMenu);
    contextMenu->addSeparator();

    todoAction = new QAction(tr("To-do"), this);
    contextMenu->addAction(todoAction);
    this->setupShortcut(todoAction, "Edit_Insert_Todo");
    connect(todoAction, SIGNAL(triggered()), parent, SLOT(todoButtonPressed()));

    contextMenu->addSeparator();

    insertHtmlEntitiesAction = new QAction(tr("HTML Entities"),this);
    contextMenu->addAction(insertHtmlEntitiesAction);
    this->setupShortcut(insertHtmlEntitiesAction, "Edit_Insert_Html_Entities");
    connect(insertHtmlEntitiesAction, SIGNAL(triggered()), parent, SLOT(insertHtmlEntities()));

    contextMenu->addSeparator();

    encryptAction = new QAction(tr("Encrypted Selected Text"), this);
    contextMenu->addAction(encryptAction);
    this->setupShortcut(encryptAction, "Edit_EncryptText");
    connect(encryptAction, SIGNAL(triggered()), parent, SLOT(encryptButtonPressed()));

    insertLinkAction = new QAction(tr("Insert Hyperlink"), this);
    contextMenu->addAction(insertLinkAction);
    this->setupShortcut(insertLinkAction, "Edit_InsertHyperlink");
    connect(insertLinkAction, SIGNAL(triggered()),parent, SLOT(insertLinkButtonPressed()));    

    insertQuickLinkAction = new QAction(tr("Quick Link"), this);
    contextMenu->addAction(insertQuickLinkAction);
    this->setupShortcut(insertQuickLinkAction, "Edit_InsertQuickLink");
    connect(insertQuickLinkAction, SIGNAL(triggered()),parent, SLOT(insertQuickLinkButtonPressed()));

    removeLinkAction = new QAction(tr("Remove Hyperlink"), this);
    contextMenu->addAction(removeLinkAction);
    this->setupShortcut(removeLinkAction, "Edit_RemoveHyperlink");
    connect(removeLinkAction, SIGNAL(triggered()),parent, SLOT(removeLinkButtonPressed()));

    attachFileAction = new QAction(tr("Attach File"), this);
    contextMenu->addAction(attachFileAction);
    this->setupShortcut(attachFileAction, "Edit_Attach_File");
    connect(attachFileAction, SIGNAL(triggered()),parent, SLOT(attachFile()));
    contextMenu->addSeparator();

    insertLatexAction = new QAction(tr("Insert LaTeX Formula"), this);
    contextMenu->addAction(insertLatexAction);
    this->setupShortcut(insertLatexAction, "Edit_Insert_Latex");
    connect(insertLatexAction, SIGNAL(triggered()),parent, SLOT(insertLatexButtonPressed()));
    contextMenu->addSeparator();

    tableMenu = new QMenu(tr("Table"), this);
    tableMenu->setFont(global.getGuiFont(font()));
    contextMenu->addMenu(tableMenu);
    insertTableAction = new QAction(tr("Insert Table"), this);
    this->setupShortcut(insertTableAction, "Edit_Insert_Table");
    tableMenu->addAction(insertTableAction);
    connect(insertTableAction, SIGNAL(triggered()), parent, SLOT(insertTableButtonPressed()));
    tableMenu->addSeparator();
    insertTableRowAction = new QAction(tr("Insert Row"), this);
    this->setupShortcut(insertTableRowAction, "Edit_Insert_Table_Row");
    tableMenu->addAction(insertTableRowAction);
    connect(insertTableRowAction, SIGNAL(triggered()), parent, SLOT(insertTableRowButtonPressed()));
    insertTableColumnAction = new QAction(tr("Insert Column"), this);
    this->setupShortcut(insertTableColumnAction, "Edit_Insert_Table_Column");
    tableMenu->addAction(insertTableColumnAction);
    connect(insertTableColumnAction, SIGNAL(triggered()), parent, SLOT(insertTableColumnButtonPressed()));
    tableMenu->addSeparator();
    deleteTableRowAction = new QAction(tr("Delete Row"), this);
    tableMenu->addAction(deleteTableRowAction);
    this->setupShortcut(deleteTableRowAction, "Edit_Delete_Table_Row");
    connect(deleteTableRowAction, SIGNAL(triggered()), parent, SLOT(deleteTableRowButtonPressed()));
    deleteTableColumnAction = new QAction(tr("Delete Column"), this);
    tableMenu->addAction(deleteTableColumnAction);
    this->setupShortcut(deleteTableColumnAction, "Edit_Delete_Table_Column");
    connect(deleteTableColumnAction, SIGNAL(triggered()), parent, SLOT(deleteTableColumnButtonPressed()));
    contextMenu->addSeparator();

    imageMenu = new QMenu(tr("Image"), this);
    imageMenu->setFont(global.getGuiFont(font()));
    contextMenu->addMenu(imageMenu);
    downloadImageAction()->setText(tr("Save Image"));
    imageMenu->addAction(downloadImageAction());
    // Don't connect this signal.  The download attachmen signal will handle it.  Otherwise
    // the signal fires twice.
    //connect(editorPage, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));

    imageMenu->addSeparator();

    rotateImageLeftAction = new QAction(tr("Rotate Left"), this);
    imageMenu->addAction(rotateImageLeftAction);
    this->setupShortcut(rotateImageLeftAction, "Edit_Image_Rotate_Left");
    connect(rotateImageLeftAction, SIGNAL(triggered()), parent, SLOT(rotateImageLeftButtonPressed()));
    rotateImageRightAction = new QAction(tr("Rotate Right"), this);
    this->setupShortcut(rotateImageRightAction, "Edit_Image_Rotate_Right");
    imageMenu->addAction(rotateImageRightAction);
    connect(rotateImageRightAction, SIGNAL(triggered()), parent, SLOT(rotateImageRightButtonPressed()));
    contextMenu->addSeparator();

    downloadAttachmentAction()->setText(tr("Save Attachment"));
    contextMenu->addAction(downloadAttachmentAction());
    connect(editorPage, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));

    connect(editorPage, SIGNAL(contentsChanged()), this, SLOT(editAlert()));
    editorPage->setContentEditable(true);

    // Set some of the menus as disabled until a user selects an image or attachment
    downloadAttachmentAction()->setEnabled(false);
    rotateImageRightAction->setEnabled(false);
    rotateImageLeftAction->setEnabled(false);
    openAction->setEnabled(false);
    downloadImageAction()->setEnabled(false);

    connect(this->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(exposeToJavascript()));

        //this->setStyleSheet("QWebView,html,body { background-color : red; foreground-color : white; }");
    QString qss = global.fileManager.getQssDirPathUser("");
    if (qss == "")
        qss = global.fileManager.getQssDirPath("");
    this->settings()->setUserStyleSheetUrl(QUrl("file://"+qss+"editor.css"));

}
AppearancePreferences::AppearancePreferences(QWidget *parent) :
    QWidget(parent)
{
    mainLayout = new QGridLayout();
    mainLayout->setAlignment(Qt::AlignTop);
    setLayout(mainLayout);
    int middleClickIndex = global.getMiddleClickAction();

    showTrayIcon = new QCheckBox(tr("Show tray icon"), this);
    showPDFs = new QCheckBox(tr("Display PDFs inline"), this);
    showSplashScreen = new QCheckBox(tr("Show splash screen on startup"), this);
    autoStart = new QCheckBox(tr("Start automatically at login"), this);
    showMissedReminders = new QCheckBox(tr("Show missed reminders on startup"), this);
    startMinimized = new QCheckBox(tr("Always Start minimized"), this);
    dynamicTotals = new QCheckBox(tr("Show notebook and tag totals"), this);
    autoHideEditorButtonbar = new QCheckBox(tr("Auto-Hide editor toolbar"), this);
    autoHideEditorButtonbar->setChecked(global.autoHideEditorToolbar);
    disableEditingOnStartup = new QCheckBox(tr("Disable note editing on statup"), this);

    traySingleClickAction = new QComboBox();
    traySingleClickAction->addItem(tr("Show/Hide NixNote"), 0);
    traySingleClickAction->addItem(tr("New Text Note"), 1);
    traySingleClickAction->addItem(tr("New Quick Note"), 2);
    traySingleClickAction->addItem(tr("Screen Capture"), 3);

    trayMiddleClickAction = new QComboBox();
    trayMiddleClickAction->addItem(tr("Show/Hide NixNote"), 0);
    trayMiddleClickAction->addItem(tr("New Text Note"), 1);
    trayMiddleClickAction->addItem(tr("New Quick Note"), 2);
    trayMiddleClickAction->addItem(tr("Screen Capture"), 3);

    mouseMiddleClickAction = new QComboBox();
    mouseMiddleClickAction->addItem(tr("Open New Tab"), MOUSE_MIDDLE_CLICK_NEW_TAB);
    mouseMiddleClickAction->addItem(tr("Open New Window"), MOUSE_MIDDLE_CLICK_NEW_WINDOW);
    mouseMiddleClickAction->setCurrentIndex(middleClickIndex);


    defaultGuiFontSizeChooser = new QComboBox();
    defaultFontChooser = new QComboBox();
    defaultFontSizeChooser = new QComboBox();
    connect(defaultFontChooser, SIGNAL(currentIndexChanged(QString)), this, SLOT(loadFontSizes(QString)));
    loadFontNames(defaultFontChooser, global.defaultFont);

    defaultGuiFontChooser = new QComboBox();
    connect(defaultGuiFontChooser, SIGNAL(currentIndexChanged(QString)), this, SLOT(loadGuiFontSizes(QString)));
    loadFontNames(defaultGuiFontChooser, global.defaultGuiFont);

    windowThemeChooser = new QComboBox();
    windowThemeChooser->addItem(tr("System Default"));
    windowThemeChooser->addItems(global.getThemeNames());


    defaultNotebookOnStartupLabel = new QLabel(tr("Startup Behavior"),this);
    defaultNotebookOnStartup = new QComboBox();
    defaultNotebookOnStartup->addItem(tr("Restore Selection Criteria"), UseLastViewedNotebook);
    defaultNotebookOnStartup->addItem(tr("Select Default Notebook"), UseDefaultNotebook);
    defaultNotebookOnStartup->addItem(tr("View All Notebooks"), UseAllNotebooks);

    int row=0;
    minimizeToTray = NULL;
    closeToTray = NULL;
    mainLayout->addWidget(showTrayIcon,row++,0);
    if (QSystemTrayIcon::isSystemTrayAvailable()) {
        minimizeToTray = new QCheckBox(tr("Minimize to tray"));
        closeToTray = new QCheckBox(tr("Close to tray"));
        mainLayout->addWidget(minimizeToTray, row++, 0);
        mainLayout->addWidget(closeToTray, row++, 0);
    }
    mainLayout->addWidget(showSplashScreen, row++,0);
    mainLayout->addWidget(autoHideEditorButtonbar, row++, 0);
    mainLayout->addWidget(showPDFs, row++,0);
    mainLayout->addWidget(showMissedReminders, row++, 0);
    mainLayout->addWidget(dynamicTotals, row++, 0);
    mainLayout->addWidget(startMinimized, row++, 0);
    mainLayout->addWidget(autoStart, row++, 0);
    mainLayout->addWidget(disableEditingOnStartup, row++, 0);
    mainLayout->addWidget(defaultNotebookOnStartupLabel,row,0);
    mainLayout->addWidget(defaultNotebookOnStartup, row++,1);

    mainLayout->addWidget(new QLabel(tr("Middle Click Open Behavior")), row,0);
    mainLayout->addWidget(mouseMiddleClickAction, row++, 1);

    mainLayout->addWidget(new QLabel(tr("Tray Icon Click Action")), row, 0);
    mainLayout->addWidget(traySingleClickAction, row++, 1);

    mainLayout->addWidget(new QLabel(tr("Tray Icon Middle Click Action")), row, 0);
    mainLayout->addWidget(trayMiddleClickAction, row++, 1);

    mainLayout->addWidget(new QLabel(tr("Default GUI Font*")), row, 0);
    mainLayout->addWidget(defaultGuiFontChooser, row++, 1);

    mainLayout->addWidget(new QLabel(tr("Default GUI Font Size*")), row, 0);
    mainLayout->addWidget(defaultGuiFontSizeChooser, row++, 1);

    mainLayout->addWidget(new QLabel(tr("Default Editor Font*")), row, 0);
    mainLayout->addWidget(defaultFontChooser, row++, 1);

    mainLayout->addWidget(new QLabel(tr("Default Editor Font Size*")), row, 0);
    mainLayout->addWidget(defaultFontSizeChooser, row++, 1);

    mainLayout->addWidget(new QLabel(""), row++, 0);
    mainLayout->addWidget(new QLabel(tr("* May require restart on some systems.")), row++, 0);

    global.settings->beginGroup("Appearance");

    disableEditingOnStartup->setChecked(global.settings->value("disableEditingOnStartup",false).toBool());
    int idx  = global.settings->value("traySingleClickAction", 0).toInt();
    idx = traySingleClickAction->findData(idx, Qt::UserRole);
    traySingleClickAction->setCurrentIndex(idx);
    idx  = global.settings->value("trayMiddleClickAction", 0).toInt();
    idx = traySingleClickAction->findData(idx, Qt::UserRole);
    trayMiddleClickAction->setCurrentIndex(idx);

    showTrayIcon->setChecked(global.settings->value("showTrayIcon", false).toBool());
    showPDFs->setChecked(global.settings->value("showPDFs", true).toBool());
    showSplashScreen->setChecked(global.settings->value("showSplashScreen", false).toBool());
    showMissedReminders->setChecked(global.settings->value("showMissedReminders", false).toBool());
    startMinimized->setChecked(global.settings->value("startMinimized", false).toBool());
    if (global.countBehavior == Global::CountAll)
        dynamicTotals->setChecked(true);
    else
        dynamicTotals->setChecked(false);
    autoStart->setChecked(global.settings->value("autoStart", false).toBool());
    int defaultNotebook = global.settings->value("startupNotebook", UseLastViewedNotebook).toInt();
    defaultNotebookOnStartup->setCurrentIndex(defaultNotebook);
    global.settings->endGroup();

    connect(showTrayIcon, SIGNAL(clicked(bool)), this, SLOT(showTrayIconChanged(bool)));

    if (minimizeToTray != NULL) {
        minimizeToTray->setChecked(global.minimizeToTray());
        if (!showTrayIcon->isChecked())
            minimizeToTray->setEnabled(false);
    }
    if (closeToTray != NULL) {
        closeToTray->setChecked(global.closeToTray());
        if (!showTrayIcon->isChecked())
            closeToTray->setEnabled(false);
    }

    this->setFont(global.getGuiFont(font()));
}
Example #22
0
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();
}
Example #23
0
void NMainMenuBar::setupEditMenu() {
    editMenu = this->addMenu(tr("&Edit"));
    QFont f = global.getGuiFont(QFont());
    editMenu->setFont(f);

    undoAction = new QAction(tr("&Undo"), this);
    setupShortcut(undoAction, QString("Edit_Undo"));
    editMenu->addAction(undoAction);

    redoAction = new QAction(tr("&Redo"), this);
    setupShortcut(redoAction, QString("Edit_Redo"));
    editMenu->addAction(redoAction);

    editMenu->addSeparator();

    cutAction = new QAction(tr("&Cut"), this);
    setupShortcut(cutAction, QString("Edit_Cut"));
    editMenu->addAction(cutAction);

    copyAction = new QAction(tr("C&opy"), this);
    setupShortcut(copyAction, QString("Edit_Copy"));
    editMenu->addAction(copyAction);

    pasteAction = new QAction(tr("&Paste"), this);
    setupShortcut(pasteAction, QString("Edit_Paste"));
    editMenu->addAction(pasteAction);

    pasteAsTextAction = new QAction(tr("Pas&te as Unformatted Text"), this);
    setupShortcut(pasteAsTextAction, QString("Edit_Paste_Without_Formatting"));
    editMenu->addAction(pasteAsTextAction);

    removeFormattingAction = new QAction(tr("Remo&ve Formatting"), this);
    //setupShortcut(removeFormjattingAction, QString("Edit_Remove_Formatting")); // For some reason this one makes the editorButtonBar one ambiguous
    editMenu->addAction(removeFormattingAction);

    editMenu->addSeparator();

    selectAllAction = new QAction(tr("Select &All"), this);
    setupShortcut(selectAllAction, QString("Edit_Select_All"));
    editMenu->addAction(selectAllAction);

    editMenu->addSeparator();

    findReplaceMenu = editMenu->addMenu(tr("F&ind and Replace"));
    findReplaceMenu->setFont(f);

    searchNotesAction = new QAction(tr("&Search Notes"), this);
    setupShortcut(searchNotesAction, QString("Edit_Search_Notes"));
    findReplaceMenu->addAction(searchNotesAction);
    connect(searchNotesAction, SIGNAL(triggered()), parent->searchText, SLOT(setFocus()));

    resetSearchAction = new QAction(tr("&Reset Search"), this);
    setupShortcut(resetSearchAction, QString("Edit_Reset_Search"));
    findReplaceMenu->addAction(resetSearchAction);
    connect(resetSearchAction, SIGNAL(triggered()), parent, SLOT(resetView()));

    findReplaceMenu->addSeparator();

    searchFindAction = new QAction(tr("&Find in Note"), this);
    setupShortcut(searchFindAction, QString("Edit_Search_Find"));
    findReplaceMenu->addAction(searchFindAction);
    connect(searchFindAction, SIGNAL(triggered()), parent, SLOT(findInNote()));


    searchFindNextAction = new QAction(tr("Find &Next"), this);
    setupShortcut(searchFindNextAction, QString("Edit_Search_Find_Next"));
    findReplaceMenu->addAction(searchFindNextAction);
    connect(searchFindNextAction, SIGNAL(triggered()), parent, SLOT(findNextInNote()));

    searchFindPrevAction = new QAction(tr("Find &Previous"), this);
    setupShortcut(searchFindPrevAction, QString("Edit_Search_Find_Prev"));
    findReplaceMenu->addAction(searchFindPrevAction);
    connect(searchFindPrevAction, SIGNAL(triggered()), parent, SLOT(findPrevInNote()));

    findReplaceMenu->addSeparator();

    searchFindReplaceAction = new QAction(tr("Replace &Within Note..."), this);
    setupShortcut(searchFindReplaceAction, QString("Edit_Search_Find_Replace"));
    findReplaceMenu->addAction(searchFindReplaceAction);
    connect(searchFindReplaceAction, SIGNAL(triggered()), parent, SLOT(findReplaceInNote()));

    editMenu->addSeparator();

    createThemeMenu(editMenu);

    preferencesAction = new QAction(tr("Preferences"), this);
    preferencesAction->setMenuRole(QAction::PreferencesRole);
    setupShortcut(preferencesAction, QString("Edit_Preferences"));
    editMenu->addAction(preferencesAction);
    connect(preferencesAction, SIGNAL(triggered()), parent, SLOT(openPreferences()));

}
Example #24
0
void NMainMenuBar::setupFileMenu() {
    QFont f = global.getGuiFont(QFont());
    this->setFont(f);

    fileMenu = this->addMenu(tr("&File"));
    fileMenu->setFont(f);


    emailAction = new QAction(tr("Email Note"), this);
    emailAction->setToolTip(tr("Email a copy of this note"));
    connect(emailAction, SIGNAL(triggered()), parent, SLOT(emailNote()));
    setupShortcut(emailAction, QString("File_Email"));
    fileMenu->addAction(emailAction);


    printPreviewAction = new QAction(tr("Print Preview Note"), this);
    printPreviewAction->setToolTip(tr("Print preview of this note"));
    connect(printPreviewAction, SIGNAL(triggered()), parent, SLOT(printPreviewNote()));
    setupShortcut(printPreviewAction, QString("File_Print_Preview"));
    fileMenu->addAction(printPreviewAction);
    //printPreviewAction->setVisible(false);  // for some reason images don't show up in print preview, so this is useless.  Check again in Qt5

    printAction = new QAction(tr("&Print Note"), this);
    printAction->setToolTip(tr("Print this note"));
    connect(printAction, SIGNAL(triggered()), parent, SLOT(printNote()));
    setupShortcut(printAction, QString("File_Print"));
    fileMenu->addAction(printAction);
    fileMenu->addSeparator();


    backupDatabaseAction = new QAction(tr("&Backup Database"), this);
    backupDatabaseAction->setToolTip(tr("Backup database to a file"));
    connect(backupDatabaseAction, SIGNAL(triggered()), parent, SLOT(databaseBackup()));
    setupShortcut(backupDatabaseAction, QString("File_Backup_Database"));
    fileMenu->addAction(backupDatabaseAction);

    restoreDatabaseAction = new QAction(tr("&Restore Database"), this);
    restoreDatabaseAction->setToolTip(tr("Restore from a backup"));
    connect(restoreDatabaseAction, SIGNAL(triggered()), parent, SLOT(databaseRestore()));
    setupShortcut(restoreDatabaseAction, QString("File_Restore_Database"));
    fileMenu->addAction(restoreDatabaseAction);

    fileMenu->addSeparator();

    exportNoteAction = new QAction(tr("&Export to NixNote Export"), this);
    exportNoteAction->setToolTip(tr("Export selected notes to a NNEX file"));
    connect(exportNoteAction, SIGNAL(triggered()), parent, SLOT(noteExport()));
    setupShortcut(exportNoteAction, QString("File_Note_Export"));
    fileMenu->addAction(exportNoteAction);

    exportAsPdfAction = new QAction(tr("&Export notes as PDF"), this);
    exportAsPdfAction->setToolTip(tr("Export selected notes to a PDF file"));
    connect(exportAsPdfAction, SIGNAL(triggered()), parent, SLOT(onExportAsPdf()));
    setupShortcut(exportAsPdfAction, QString("File_Note_Export_Pdf"));
    fileMenu->addAction(exportAsPdfAction);

    importNoteAction = new QAction(tr("&Import notes"), this);
    importNoteAction->setToolTip(tr("Import notes from an export file"));
    connect(importNoteAction, SIGNAL(triggered()), parent, SLOT(noteImport()));
    setupShortcut(importNoteAction, QString("File_Note_Import"));
    fileMenu->addAction(importNoteAction);

    fileMenu->addSeparator();
    QList<QString> names = global.accountsManager->nameList();
    QList<int> ids = global.accountsManager->idList();
    QList<QPair<int, QString>> pairList;
    for (int i = 0; i < ids.size(); i++) {
        pairList.append(QPair<int, QString>(ids[i], names[i]));
    }
    qSort(pairList.begin(), pairList.end(), QPairFirstComparer());
    for (int i = 0; i < ids.size(); i++) {
        QAction *accountAction = new QAction(pairList[i].second + " - (" + QString::number(pairList[i].first) + ")",
                                             this);
        accountAction->setData(pairList[i].first);
        accountAction->setCheckable(true);
        if (global.accountsManager->currentId == pairList[i].first)
            accountAction->setChecked(true);
        else {
            accountAction->setText(
                tr("Switch to ") + pairList[i].second + " - (" + QString::number(pairList[i].first) + ")");
        }
        fileMenu->addAction(accountAction);
        connect(accountAction, SIGNAL(triggered()), parent, SLOT(switchUser()));
        userAccountActions.append(accountAction);
    }

    addUserAction = new QAction(tr("&Add Another User..."), this);
    fileMenu->addAction(addUserAction);
    connect(addUserAction, SIGNAL(triggered()), parent, SLOT(addAnotherUser()));

    userMaintenanceAction = new QAction(tr("&User Account Maintenance"), this);
    fileMenu->addAction(userMaintenanceAction);
    connect(userMaintenanceAction, SIGNAL(triggered()), parent, SLOT(userMaintenance()));

    fileMenu->addSeparator();

    openCloseAction = new QAction(tr("&Open/Close Notebooks"), this);
    openCloseAction->setToolTip(tr("Open/Close Notebooks"));
    connect(openCloseAction, SIGNAL(triggered()), parent, SLOT(openCloseNotebooks()));
    setupShortcut(quitAction, QString("File_Notebook_OpenClose"));
    fileMenu->addAction(openCloseAction);

    fileMenu->addSeparator();

    quitAction = new QAction(tr("Quit"), this);
    quitAction->setToolTip(tr("Quit the program"));
    connect(quitAction, SIGNAL(triggered()), parent, SLOT(quitNixNote()));

    quitAction->setShortcut(QKeySequence::Close);
    quitAction->setIcon(QIcon::fromTheme("exit"));
    setupShortcut(quitAction, QString("File_Exit"));
    fileMenu->addAction(quitAction);

    QString menuCss = global.getThemeCss("menuCss");
    if (menuCss != "")
        this->setStyleSheet(menuCss);
}
Example #25
0
void NMainMenuBar::setupViewMenu() {
    viewMenu = this->addMenu(tr("&View"));
    QFont f = global.getGuiFont(QFont());
    viewMenu->setFont(f);

    viewNoteListWide = new QAction(tr("Wide Note List"), this);
    setupShortcut(viewNoteListWide, "View_Note_List_Wide");
    viewMenu->addAction(viewNoteListWide);
    viewNoteListWide->setCheckable(true);

    viewNoteListNarrow = new QAction(tr("Narrow Note List"), this);
    setupShortcut(viewNoteListNarrow, "View_Note_List_Narrow");
    viewNoteListNarrow->setCheckable(true);
    viewMenu->addAction(viewNoteListNarrow);
    connect(viewNoteListNarrow, SIGNAL(triggered()), parent, SLOT(viewNoteListNarrow()));
    connect(viewNoteListWide, SIGNAL(triggered()), parent, SLOT(viewNoteListWide()));

    viewSourceAction = new QAction(tr("&Show Source"), this);
    setupShortcut(viewSourceAction, "View_Source");
    viewMenu->addAction(viewSourceAction);

    viewHistoryAction = new QAction(tr("Note &History"), this);
    setupShortcut(viewHistoryAction, "View_Note_History");
    viewMenu->addAction(viewHistoryAction);

    viewMenu->addSeparator();

    viewPresentationModeAction = new QAction(tr("&Presentation Mode"), this);
    setupShortcut(viewPresentationModeAction, "View_Presentation_Mode");
    viewMenu->addAction(viewPresentationModeAction);

    viewLeftPanel = new QAction(tr("Show &Left Panel"), this);
    setupShortcut(viewLeftPanel, "View_Show_Left_Side");
    viewLeftPanel->setCheckable(true);
    viewLeftPanel->setChecked(true);
    viewMenu->addAction(viewLeftPanel);
    connect(viewLeftPanel, SIGNAL(triggered()), parent, SLOT(toggleLeftPanel()));

    viewFavoritesTree = new QAction(tr("Show &Favorites"), this);
    setupShortcut(viewFavoritesTree, "View_Show_Favorites_List");
    viewFavoritesTree->setCheckable(true);
    viewFavoritesTree->setChecked(true);
    viewMenu->addAction(viewFavoritesTree);
    connect(viewFavoritesTree, SIGNAL(triggered()), parent, SLOT(toggleFavoritesTree()));

    viewNotebookTree = new QAction(tr("Show &Notebooks"), this);
    setupShortcut(viewNotebookTree, "View_Show_Notebook_List");
    viewNotebookTree->setCheckable(true);
    viewNotebookTree->setChecked(true);
    viewMenu->addAction(viewNotebookTree);
    connect(viewNotebookTree, SIGNAL(triggered()), parent, SLOT(toggleNotebookTree()));

    viewTagTree = new QAction(tr("Show Ta&gs"), this);
    setupShortcut(viewTagTree, "View_Show_Tag_List");
    viewTagTree->setCheckable(true);
    viewTagTree->setChecked(true);
    viewMenu->addAction(viewTagTree);
    connect(viewTagTree, SIGNAL(triggered()), parent, SLOT(toggleTagTree()));

    viewSearchTree = new QAction(tr("Show Sa&ved Searches"), this);
    setupShortcut(viewSearchTree, "View_Show_Saved_Search_List");
    viewSearchTree->setCheckable(true);
    viewSearchTree->setChecked(true);
    viewMenu->addAction(viewSearchTree);
    connect(viewSearchTree, SIGNAL(triggered()), parent, SLOT(toggleSavedSearchTree()));

    viewAttributesTree = new QAction(tr("Show &Attribute Filter"), this);
    setupShortcut(viewAttributesTree, "View_Attributes_List");
    viewAttributesTree->setCheckable(true);
    viewAttributesTree->setChecked(true);
    viewMenu->addAction(viewAttributesTree);
    connect(viewAttributesTree, SIGNAL(triggered()), parent, SLOT(toggleAttributesTree()));

    viewTrashTree = new QAction(tr("Show T&rash"), this);
    setupShortcut(viewTrashTree, "View_Trash");
    viewTrashTree->setCheckable(true);
    viewTrashTree->setChecked(true);
    viewMenu->addAction(viewTrashTree);
    connect(viewTrashTree, SIGNAL(triggered()), parent, SLOT(toggleTrashTree()));

    viewNoteList = new QAction(tr("Show N&ote List"), this);
    setupShortcut(viewNoteList, "View_Show_Note_List");
    viewNoteList->setCheckable(true);
    viewNoteList->setChecked(true);
    viewMenu->addAction(viewNoteList);
    connect(viewNoteList, SIGNAL(triggered()), parent, SLOT(toggleNoteList()));

    viewNotePanel = new QAction(tr("Show Note &Panel"), this);
    setupShortcut(viewNotePanel, "View_Show_Note_Panel");
    viewNotePanel->setCheckable(true);
    viewNotePanel->setChecked(true);
    viewMenu->addAction(viewNotePanel);
    connect(viewNotePanel, SIGNAL(triggered()), parent, SLOT(toggleTabWindow()));

    viewMenu->addSeparator();

    viewExtendedInformation = new QAction(tr("View Note &Info"), this);
    setupShortcut(viewExtendedInformation, "View_Extended_Information");
    viewMenu->addAction(viewExtendedInformation);

    viewToolbar = new QAction(tr("View &Toolbar"), this);
    setupShortcut(viewToolbar, "View_Toolbar");
    viewMenu->addAction(viewToolbar);
    viewToolbar->setCheckable(true);
    viewToolbar->setChecked(true);
    connect(viewToolbar, SIGNAL(triggered()), parent, SLOT(toggleToolbar()));

    viewStatusbar = new QAction(tr("View Status&bar"), this);
    setupShortcut(viewStatusbar, "View_Statusbar");
    viewMenu->addAction(viewStatusbar);
    viewStatusbar->setCheckable(true);
    connect(viewStatusbar, SIGNAL(triggered()), parent, SLOT(toggleStatusbar()));

    createSortMenu(viewMenu);
}
Example #26
0
NAttributeTree::NAttributeTree(QWidget *parent) :
    QTreeWidget(parent)
{
    this->setFont(global.getGuiFont(font()));

    filterPosition = -1;
    // setup options
    this->setEditTriggers(QAbstractItemView::NoEditTriggers);
    this->setSelectionBehavior(QAbstractItemView::SelectRows);
    this->setSelectionMode(QAbstractItemView::SingleSelection);
    this->setRootIsDecorated(true);
    this->setSortingEnabled(false);
    this->header()->setVisible(false);
    //this->setStyleSheet("QTreeWidget {  border: none; background-color:transparent; }");

    // Build the root item
    root = new QTreeWidgetItem(this);
    QIcon icon(":attributes.png");
    root->setIcon(0,icon);
    root->setData(0, Qt::UserRole, "root");
    root->setData(0, Qt::DisplayRole, tr("Attributes"));
    QFont font = root->font(0);
    font.setBold(true);
    root->setFont(0,font);
    this->setMinimumHeight(1);
    this->addTopLevelItem(root);
    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()));

    // Allocate memory for everything needed

    createdRoot = new QTreeWidgetItem(root);
    lastUpdatedRoot = new QTreeWidgetItem(root);
    containsRoot = new QTreeWidgetItem(root);
    sourceRoot = new QTreeWidgetItem(root);

    createdSinceRoot = new QTreeWidgetItem(createdRoot);
    createdSinceToday = new QTreeWidgetItem(createdSinceRoot);
    createdSinceYesterday = new QTreeWidgetItem(createdSinceRoot);
    createdSinceThisWeek = new QTreeWidgetItem(createdSinceRoot);
    createdSinceLastWeek = new QTreeWidgetItem(createdSinceRoot);
    createdSinceThisMonth = new QTreeWidgetItem(createdSinceRoot);
    createdSinceLastMonth = new QTreeWidgetItem(createdSinceRoot);
    createdSinceThisYear = new QTreeWidgetItem(createdSinceRoot);
    createdSinceLastYear = new QTreeWidgetItem(createdSinceRoot);

    createdBeforeRoot = new QTreeWidgetItem(createdRoot);
    createdBeforeToday = new QTreeWidgetItem(createdBeforeRoot);
    createdBeforeYesterday = new QTreeWidgetItem(createdBeforeRoot);
    createdBeforeThisWeek = new QTreeWidgetItem(createdBeforeRoot);
    createdBeforeLastWeek = new QTreeWidgetItem(createdBeforeRoot);
    createdBeforeThisMonth = new QTreeWidgetItem(createdBeforeRoot);
    createdBeforeLastMonth = new QTreeWidgetItem(createdBeforeRoot);
    createdBeforeThisYear = new QTreeWidgetItem(createdBeforeRoot);
    createdBeforeLastYear = new QTreeWidgetItem(createdBeforeRoot);

    lastUpdatedSinceRoot = new QTreeWidgetItem(lastUpdatedRoot);
    lastUpdatedSinceToday = new QTreeWidgetItem(lastUpdatedSinceRoot);
    lastUpdatedSinceYesterday = new QTreeWidgetItem(lastUpdatedSinceRoot);
    lastUpdatedSinceThisWeek = new QTreeWidgetItem(lastUpdatedSinceRoot);
    lastUpdatedSinceLastWeek = new QTreeWidgetItem(lastUpdatedSinceRoot);
    lastUpdatedSinceThisMonth = new QTreeWidgetItem(lastUpdatedSinceRoot);
    lastUpdatedSinceLastMonth = new QTreeWidgetItem(lastUpdatedSinceRoot);
    lastUpdatedSinceThisYear = new QTreeWidgetItem(lastUpdatedSinceRoot);
    lastUpdatedSinceLastYear = new QTreeWidgetItem(lastUpdatedSinceRoot);

    lastUpdatedBeforeRoot = new QTreeWidgetItem(lastUpdatedRoot);
    lastUpdatedBeforeToday = new QTreeWidgetItem(lastUpdatedBeforeRoot);
    lastUpdatedBeforeYesterday = new QTreeWidgetItem(lastUpdatedBeforeRoot);
    lastUpdatedBeforeThisWeek = new QTreeWidgetItem(lastUpdatedBeforeRoot);
    lastUpdatedBeforeLastWeek = new QTreeWidgetItem(lastUpdatedBeforeRoot);
    lastUpdatedBeforeThisMonth = new QTreeWidgetItem(lastUpdatedBeforeRoot);
    lastUpdatedBeforeLastMonth = new QTreeWidgetItem(lastUpdatedBeforeRoot);
    lastUpdatedBeforeThisYear = new QTreeWidgetItem(lastUpdatedBeforeRoot);
    lastUpdatedBeforeLastYear = new QTreeWidgetItem(lastUpdatedBeforeRoot);

    containsImages = new QTreeWidgetItem(containsRoot);
    containsAudio = new QTreeWidgetItem(containsRoot);
    containsInk = new QTreeWidgetItem(containsRoot);
    containsEncryptedText = new QTreeWidgetItem(containsRoot);
    containsToDoItems = new QTreeWidgetItem(containsRoot);
    containsUnfinishedToDoItems = new QTreeWidgetItem(containsRoot);
    containsFinishedToDoItems = new QTreeWidgetItem(containsRoot);
    containsPDFDocument = new QTreeWidgetItem(containsRoot);
    containsAttachment = new QTreeWidgetItem(containsRoot);

    sourceEmailedToEvernote = new QTreeWidgetItem(sourceRoot);
    sourceEmail = new QTreeWidgetItem(sourceRoot);
    sourceWebPage = new QTreeWidgetItem(sourceRoot);
    sourceMobile = new QTreeWidgetItem(sourceRoot);
    sourceAnotherApplication = new QTreeWidgetItem(sourceRoot);


    // Start building selection criteria
    createdRoot->setText(0, tr("Created"));
    createdRoot->setData(0, Qt::UserRole, 0);

    createdSinceRoot->setText(0, tr("Since"));
    createdSinceRoot->setData(0, Qt::UserRole, 0);
    createdRoot->addChild(createdSinceRoot);

    createdSinceToday->setText(0, tr("Today"));
    createdSinceToday->setData(0, Qt::UserRole, CREATED_SINCE_TODAY);
    createdSinceRoot->addChild(createdSinceToday);

    createdSinceYesterday->setText(0, tr("Yesterday"));
    createdSinceYesterday->setData(0, Qt::UserRole, CREATED_SINCE_YESTERDAY);
    createdSinceRoot->addChild(createdSinceYesterday);

    createdSinceThisWeek->setText(0, tr("This week"));
    createdSinceThisWeek->setData(0, Qt::UserRole, CREATED_SINCE_THIS_WEEK);
    createdSinceRoot->addChild(createdSinceThisWeek);

    createdSinceLastWeek->setText(0, tr("Last week"));
    createdSinceLastWeek->setData(0, Qt::UserRole, CREATED_SINCE_LAST_WEEK);
    createdSinceRoot->addChild(createdSinceLastWeek);

    createdSinceThisMonth->setText(0, tr("This Month"));
    createdSinceThisMonth->setData(0, Qt::UserRole, CREATED_SINCE_THIS_MONTH);
    createdSinceRoot->addChild(createdSinceThisMonth);

    createdSinceLastMonth->setText(0, tr("Last Month"));
    createdSinceLastMonth->setData(0, Qt::UserRole, CREATED_SINCE_LAST_MONTH);
    createdSinceRoot->addChild(createdSinceLastMonth);

    createdSinceThisYear->setText(0, tr("This Year"));
    createdSinceThisYear->setData(0, Qt::UserRole, CREATED_SINCE_THIS_YEAR);
    createdSinceRoot->addChild(createdSinceThisYear);

    createdSinceLastYear->setText(0, tr("Last Year"));
    createdSinceLastYear->setData(0, Qt::UserRole, CREATED_SINCE_LAST_YEAR);
    createdSinceRoot->addChild(createdSinceLastYear);


    createdBeforeRoot->setText(0, tr("Before"));
    createdBeforeRoot->setData(0, Qt::UserRole, 0);
    createdRoot->addChild(createdBeforeRoot);

    createdBeforeToday->setText(0, tr("Today"));
    createdBeforeToday->setData(0, Qt::UserRole, CREATED_BEFORE_TODAY);
    createdBeforeRoot->addChild(createdBeforeToday);

    createdBeforeYesterday->setText(0, tr("Yesterday"));
    createdBeforeYesterday->setData(0, Qt::UserRole, CREATED_BEFORE_YESTERDAY);
    createdBeforeRoot->addChild(createdBeforeYesterday);

    createdBeforeThisWeek->setText(0, tr("This week"));
    createdBeforeThisWeek->setData(0, Qt::UserRole, CREATED_BEFORE_THIS_WEEK);
    createdBeforeRoot->addChild(createdBeforeThisWeek);

    createdBeforeLastWeek->setText(0, tr("Last week"));
    createdBeforeLastWeek->setData(0, Qt::UserRole, CREATED_BEFORE_LAST_WEEK);
    createdBeforeRoot->addChild(createdBeforeLastWeek);

    createdBeforeThisMonth->setText(0, tr("This Month"));
    createdBeforeThisMonth->setData(0, Qt::UserRole, CREATED_BEFORE_THIS_MONTH);
    createdBeforeRoot->addChild(createdSinceThisMonth);

    createdBeforeLastMonth->setText(0, tr("Last Month"));
    createdBeforeLastMonth->setData(0, Qt::UserRole, CREATED_BEFORE_LAST_MONTH);
    createdBeforeRoot->addChild(createdBeforeLastMonth);

    createdBeforeThisYear->setText(0, tr("This Year"));
    createdBeforeThisYear->setData(0, Qt::UserRole, CREATED_BEFORE_THIS_YEAR);
    createdBeforeRoot->addChild(createdBeforeThisYear);

    createdBeforeLastYear->setText(0, tr("Last Year"));
    createdBeforeLastYear->setData(0, Qt::UserRole, CREATED_BEFORE_LAST_YEAR);
    createdBeforeRoot->addChild(createdBeforeLastYear);





    //** Start doing the "Last Modified" selection criteria
    lastUpdatedRoot->setText(0, tr("Last Modified"));
    lastUpdatedRoot->setData(0, Qt::UserRole, 0);

    lastUpdatedSinceRoot->setText(0, tr("Since"));
    lastUpdatedSinceRoot->setData(0, Qt::UserRole, 0);
    lastUpdatedRoot->addChild(lastUpdatedSinceRoot);

    lastUpdatedSinceToday->setText(0, tr("Today"));
    lastUpdatedSinceToday->setData(0, Qt::UserRole, MODIFIED_SINCE_TODAY);
    lastUpdatedSinceRoot->addChild(lastUpdatedSinceToday);

    lastUpdatedSinceYesterday->setText(0, tr("Yesterday"));
    lastUpdatedSinceYesterday->setData(0, Qt::UserRole, MODIFIED_SINCE_YESTERDAY);
    lastUpdatedSinceRoot->addChild(lastUpdatedSinceYesterday);

    lastUpdatedSinceThisWeek->setText(0, tr("This week"));
    lastUpdatedSinceThisWeek->setData(0, Qt::UserRole, MODIFIED_SINCE_THIS_WEEK);
    lastUpdatedSinceRoot->addChild(lastUpdatedSinceThisWeek);

    lastUpdatedSinceLastWeek->setText(0, tr("Last week"));
    lastUpdatedSinceLastWeek->setData(0, Qt::UserRole, MODIFIED_SINCE_LAST_WEEK);
    lastUpdatedSinceRoot->addChild(lastUpdatedSinceLastWeek);

    lastUpdatedSinceThisMonth->setText(0, tr("This Month"));
    lastUpdatedSinceThisMonth->setData(0, Qt::UserRole, MODIFIED_SINCE_THIS_MONTH);
    lastUpdatedSinceRoot->addChild(lastUpdatedSinceThisMonth);

    lastUpdatedSinceLastMonth->setText(0, tr("Last Month"));
    lastUpdatedSinceLastMonth->setData(0, Qt::UserRole, MODIFIED_SINCE_LAST_MONTH);
    lastUpdatedSinceRoot->addChild(lastUpdatedSinceLastMonth);

    lastUpdatedSinceThisYear->setText(0, tr("This Year"));
    lastUpdatedSinceThisYear->setData(0, Qt::UserRole, MODIFIED_SINCE_THIS_YEAR);
    lastUpdatedSinceRoot->addChild(lastUpdatedSinceThisYear);

    lastUpdatedSinceLastYear->setText(0, tr("Last Year"));
    lastUpdatedSinceLastYear->setData(0, Qt::UserRole, MODIFIED_SINCE_LAST_YEAR);
    lastUpdatedSinceRoot->addChild(lastUpdatedSinceLastYear);


    lastUpdatedBeforeRoot->setText(0, tr("Before"));
    lastUpdatedBeforeRoot->setData(0, Qt::UserRole, 0);
    lastUpdatedRoot->addChild(lastUpdatedBeforeRoot);

    lastUpdatedBeforeToday->setText(0, tr("Today"));
    lastUpdatedBeforeToday->setData(0, Qt::UserRole, MODIFIED_BEFORE_TODAY);
    lastUpdatedBeforeRoot->addChild(lastUpdatedBeforeToday);

    lastUpdatedBeforeYesterday->setText(0, tr("Yesterday"));
    lastUpdatedBeforeYesterday->setData(0, Qt::UserRole, MODIFIED_BEFORE_YESTERDAY);
    lastUpdatedBeforeRoot->addChild(lastUpdatedBeforeYesterday);

    lastUpdatedBeforeThisWeek->setText(0, tr("This week"));
    lastUpdatedBeforeThisWeek->setData(0, Qt::UserRole, MODIFIED_BEFORE_THIS_WEEK);
    lastUpdatedBeforeRoot->addChild(lastUpdatedBeforeThisWeek);

    lastUpdatedBeforeLastWeek->setText(0, tr("Last week"));
    lastUpdatedBeforeLastWeek->setData(0, Qt::UserRole, MODIFIED_BEFORE_LAST_WEEK);
    lastUpdatedBeforeRoot->addChild(lastUpdatedBeforeLastWeek);

    lastUpdatedBeforeThisMonth->setText(0, tr("This Month"));
    lastUpdatedBeforeThisMonth->setData(0, Qt::UserRole, MODIFIED_BEFORE_THIS_MONTH);
    lastUpdatedBeforeRoot->addChild(lastUpdatedBeforeThisMonth);

    lastUpdatedBeforeLastMonth->setText(0, tr("Last Month"));
    lastUpdatedBeforeLastMonth->setData(0, Qt::UserRole, MODIFIED_BEFORE_LAST_MONTH);
    lastUpdatedBeforeRoot->addChild(lastUpdatedBeforeLastMonth);

    lastUpdatedBeforeThisYear->setText(0, tr("This Year"));
    lastUpdatedBeforeThisYear->setData(0, Qt::UserRole, MODIFIED_BEFORE_THIS_YEAR);
    lastUpdatedBeforeRoot->addChild(lastUpdatedBeforeThisYear);

    lastUpdatedBeforeLastYear->setText(0, tr("Last Year"));
    lastUpdatedBeforeLastYear->setData(0, Qt::UserRole, MODIFIED_BEFORE_LAST_YEAR);
    lastUpdatedBeforeRoot->addChild(lastUpdatedBeforeLastYear);



    //*** Contains selection criteria
    this->containsRoot->setText(0, tr("Contains"));
    this->containsRoot->setData(0,Qt::UserRole, 0);

    this->containsImages->setText(0, tr("Images"));
    this->containsImages->setData(0, Qt::UserRole, CONTAINS_IMAGES);
    this->containsRoot->addChild(containsImages);

    this->containsAudio->setText(0, tr("Audio"));
    this->containsAudio->setData(0, Qt::UserRole, CONTAINS_AUDIO);
    this->containsRoot->addChild(containsAudio);

    this->containsInk->setText(0, tr("Ink"));
    this->containsInk->setData(0, Qt::UserRole, CONTAINS_INK);
    this->containsRoot->addChild(containsInk);

    this->containsEncryptedText->setText(0, tr("Encrypted Text"));
    this->containsEncryptedText->setData(0, Qt::UserRole, CONTAINS_ENCRYPTED_TEXT);
    this->containsRoot->addChild(containsEncryptedText);

    this->containsToDoItems->setText(0, tr("To-do items"));
    this->containsToDoItems->setData(0, Qt::UserRole, CONTAINS_TODO_ITEMS);
    this->containsRoot->addChild(containsUnfinishedToDoItems);

    this->containsUnfinishedToDoItems->setText(0, tr("Unfinished to-do items"));
    this->containsUnfinishedToDoItems->setData(0, Qt::UserRole, CONTAINS_UNFINISHED_TODO_ITEMS);
    this->containsRoot->addChild(containsUnfinishedToDoItems);

    this->containsFinishedToDoItems->setText(0, tr("Finished to-do items"));
    this->containsFinishedToDoItems->setData(0, Qt::UserRole, CONTAINS_FINISHED_TODO_ITEMS);
    this->containsRoot->addChild(containsFinishedToDoItems);

    this->containsPDFDocument->setText(0, tr("PDF document"));
    this->containsPDFDocument->setData(0, Qt::UserRole, CONTAINS_PDF_DOCUMENT);
    this->containsRoot->addChild(containsPDFDocument);

    this->containsAttachment->setText(0, tr("Attachment"));
    this->containsAttachment->setData(0, Qt::UserRole, CONTAINS_ATTACHMENT);
    this->containsRoot->addChild(containsAttachment);



    //*** Source selection criteria
    this->sourceRoot->setText(0, tr("Source"));
    this->sourceRoot->setData(0,Qt::UserRole, 0);

    this->sourceEmailedToEvernote->setText(0, tr("Emailed to Evernote"));
    this->sourceEmailedToEvernote->setData(0, Qt::UserRole, SOURCE_EMAILED_TO_EVERNOTE);
    this->sourceRoot->addChild(sourceEmailedToEvernote);

    this->sourceEmail->setText(0, tr("Email"));
    this->sourceEmail->setData(0, Qt::UserRole, SOURCE_EMAIL);
    this->sourceRoot->addChild(sourceEmail);

    this->sourceWebPage->setText(0, tr("Web page"));
    this->sourceWebPage->setData(0, Qt::UserRole, SOURCE_WEB_PAGE);
    this->sourceRoot->addChild(sourceWebPage);

    this->sourceMobile->setText(0, tr("Mobile"));
    this->sourceMobile->setData(0, Qt::UserRole, SOURCE_MOBILE);
    this->sourceRoot->addChild(sourceMobile);

    this->sourceAnotherApplication->setText(0, tr("Another application"));
    this->sourceAnotherApplication->setData(0, Qt::UserRole, SOURCE_ANOTHER_APPLICATION);
    this->sourceRoot->addChild(sourceAnotherApplication);


    // Add the options to the root
    root->addChild(createdRoot);
    root->addChild(lastUpdatedRoot);
    root->addChild(containsRoot);
    root->addChild(sourceRoot);
    root->setExpanded(true);

    this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    this->setFrameShape(QFrame::NoFrame);
    expandedImage = new QImage(":expandedIcon");
    collapsedImage = new QImage(":collapsedIcon");
}
Example #27
0
void NMainMenuBar::setupToolsMenu() {
    toolsMenu = this->addMenu(tr("&Tools"));
    QFont f = global.getGuiFont(QFont());
    toolsMenu->setFont(f);

    synchronizeAction = new QAction(tr("&Synchronize"), this);
    synchronizeAction->setToolTip(tr("Synchronize with Evernote"));
    connect(synchronizeAction, SIGNAL(triggered()), parent, SLOT(synchronize()));
    toolsMenu->addAction(synchronizeAction);

    disconnectAction = new QAction(tr("&Disconnect"), this);
    disconnectAction->setToolTip(tr("Disconnect from Evernote"));
    connect(disconnectAction, SIGNAL(triggered()), parent, SLOT(disconnect()));
    setupShortcut(disconnectAction, QString(""));
    toolsMenu->addAction(disconnectAction);
    disconnectAction->setEnabled(false);
    disconnectAction->setVisible(false);  /// We can probably delete this whole menu option

    pauseIndexingAction = new QAction(tr("Pause &indexing"), this);
    pauseIndexingAction->setToolTip(tr("Temporarily pause indexing"));
    setupShortcut(pauseIndexingAction, QString("Tools_Pause_Indexing"));
    connect(pauseIndexingAction, SIGNAL(triggered()), parent, SLOT(pauseIndexing()));
    pauseIndexingAction->setCheckable(true);
    toolsMenu->addAction(pauseIndexingAction);
    pauseIndexingAction->setVisible(global.enableIndexing);

    disableEditingAction = new QAction(tr("Disable &editing"), this);
    disableEditingAction->setToolTip(tr("Temporarily disable note editing"));
    setupShortcut(disableEditingAction, QString("Tools_Disable_Editing"));
    disableEditingAction->setCheckable(true);
    disableEditingAction->setChecked(global.disableEditing);
    connect(disableEditingAction, SIGNAL(triggered()), parent, SLOT(disableEditing()));
    toolsMenu->addAction(disableEditingAction);

    toolsMenu->addSeparator();

    reindexDatabaseAction = new QAction(tr("&Reindex database"), this);
    reindexDatabaseAction->setToolTip(tr("Reindex all notes"));
    setupShortcut(reindexDatabaseAction, QString("Tools_Database_Reindex"));
    connect(reindexDatabaseAction, SIGNAL(triggered()), parent, SLOT(reindexDatabase()));
    toolsMenu->addAction(reindexDatabaseAction);
    reindexDatabaseAction->setVisible(global.enableIndexing);

    databaseStatusDialogAction = new QAction(tr("&Database status"), this);
    databaseStatusDialogAction->setToolTip(tr("Database Status"));
    setupShortcut(databaseStatusDialogAction, QString("Tools_Database_Status"));
    connect(databaseStatusDialogAction, SIGNAL(triggered()), parent, SLOT(openDatabaseStatus()));
    toolsMenu->addAction(databaseStatusDialogAction);

    toolsMenu->addSeparator();

    accountDialogAction = new QAction(tr("A&ccount / usage"), this);
    accountDialogAction->setToolTip(tr("Account and usage information"));
    connect(accountDialogAction, SIGNAL(triggered()), parent, SLOT(openAccount()));
    setupShortcut(accountDialogAction, QString("Tools_Account_Information"));
    toolsMenu->addAction(accountDialogAction);

    toolsMenu->addSeparator();

    importFoldersDialogAction = new QAction(tr("&Import folders"), this);
    importFoldersDialogAction->setToolTip(tr("Import Folders"));
    setupShortcut(importFoldersDialogAction, QString("Tools_Import_Folders"));
    connect(importFoldersDialogAction, SIGNAL(triggered()), parent, SLOT(openImportFolders()));
    toolsMenu->addAction(importFoldersDialogAction);
}
Example #28
0
// 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");
}
Example #29
0
SyncPreferences::SyncPreferences(QWidget *parent) :
    QWidget(parent)
{
    this->setFont(global.getGuiFont(font()));
    QGridLayout *mainLayout = new QGridLayout(this);
    setLayout(mainLayout);

    syncAutomatically = new QCheckBox(tr("Sync automatically"), this);
    syncAutomatically->setChecked(true);

    syncInterval = new QComboBox(this);
    syncInterval->addItem(tr("Every 15 minutes"), 15);
    syncInterval->addItem(tr("Every 30 minutes"), 30);
    syncInterval->addItem(tr("Every hour"), 60);
    syncInterval->addItem(tr("Every day"), 1440);

    syncOnStartup = new QCheckBox(tr("Sync on startup"), this);
    //syncOnStartup->setEnabled(false);
    syncOnShutdown = new QCheckBox(tr("Sync on shutdown"),this);
    //syncOnShutdown->setEnabled(false);
    enableSyncNotifications = new QCheckBox(tr("Enable sync notifications"), this);
    showGoodSyncMessagesInTray = new QCheckBox(tr("Show successful syncs"), this);
    apiRateRestart = new QCheckBox(tr("Restart sync on API limit (experimental)"), this);

    enableProxy = new QCheckBox(tr("Enable Proxy*"), this);
    enableSocks5 = new QCheckBox(tr("Enable Socks5"),this);
    QLabel *hostLabel = new QLabel(tr("Proxy Hostname"), this);
    QLabel *portLabel = new QLabel(tr("Proxy Port"), this);
    QLabel *userLabel = new QLabel(tr("Proxy Username"), this);
    QLabel *passwordLabel = new QLabel(tr("Proxy Password"),this);
    QLabel *restartLabel = new QLabel(tr("*Note: Restart required"),this);

    host = new QLineEdit(this);
    port = new QLineEdit(this);
    userId = new QLineEdit(this);
    password = new QLineEdit(this);

    enableProxy->setChecked(global.isProxyEnabled());
    enableSocks5->setChecked(global.isSocks5Enabled());
    host->setText(global.getProxyHost());
    port->setText(QString::number(global.getProxyPort()));
    port->setInputMask("00000");
    userId->setText(global.getProxyUserid());
    password->setText(global.getProxyPassword());
    password->setEchoMode(QLineEdit::Password);

    mainLayout->addWidget(enableSyncNotifications,0,0);
    mainLayout->addWidget(showGoodSyncMessagesInTray, 0,1);
    mainLayout->addWidget(syncOnStartup,1,0);
    mainLayout->addWidget(syncOnShutdown,2,0);
    mainLayout->addWidget(syncAutomatically,3,0);
    mainLayout->addWidget(syncInterval, 3,1);
    mainLayout->addWidget(apiRateRestart, 4,0);

    mainLayout->addWidget(enableProxy,5,0);
    mainLayout->addWidget(enableSocks5,5,1);
    mainLayout->addWidget(hostLabel,6,0);
    mainLayout->addWidget(host, 6,1);
    mainLayout->addWidget(portLabel,7,0);
    mainLayout->addWidget(port,7,1);
    mainLayout->addWidget(userLabel, 8,0);
    mainLayout->addWidget(userId,8,1);
    mainLayout->addWidget(passwordLabel,9,0);
    mainLayout->addWidget(password,9,1);
    mainLayout->addWidget(restartLabel,10,0);
    mainLayout->setAlignment(Qt::AlignTop);

    global.settings->beginGroup("Sync");
    int interval = global.settings->value("syncInterval", 15).toInt();
    int index = syncInterval->findData(interval);
    syncInterval->setCurrentIndex(index);
    syncAutomatically->setChecked(global.settings->value("syncAutomatically", false).toBool());
    syncOnShutdown->setChecked(global.settings->value("syncOnShutdown", false).toBool());
    syncOnStartup->setChecked(global.settings->value("syncOnStartup", false).toBool());
    enableSyncNotifications->setChecked(global.settings->value("enableNotification", true).toBool());
    showGoodSyncMessagesInTray->setChecked(global.showGoodSyncMessagesInTray);
    apiRateRestart->setChecked(global.settings->value("apiRateLimitAutoRestart", false).toBool());
    global.settings->endGroup();
    global.showGoodSyncMessagesInTray = showGoodSyncMessagesInTray->isChecked();

    if (enableSyncNotifications->isChecked())
        showGoodSyncMessagesInTray->setEnabled(true);
    else
        showGoodSyncMessagesInTray->setEnabled(false);

    connect(syncAutomatically, SIGNAL(stateChanged(int)), this, SLOT(enableSyncStateChange()));
    connect(enableSyncNotifications, SIGNAL(toggled(bool)), this, SLOT(enableSuccessfulSyncMessagesInTray()));
    connect(enableProxy, SIGNAL(stateChanged(int)), this, SLOT(proxyCheckboxAltered(int)));
    if (!global.isProxyEnabled()) {
        proxyCheckboxAltered(Qt::Unchecked);
    }
}
Example #30
0
void NMainMenuBar::setupHelpMenu() {
    helpMenu = this->addMenu(tr("&Help"));
    QFont f = global.getGuiFont(QFont());
    helpMenu->setFont(f);

    openProjectWebPageAction = new QAction(tr("&Project wiki"), this);
    openProjectWebPageAction->setToolTip(tr("Open NixNote wiki page with help/documentation/contact"));
    connect(openProjectWebPageAction, SIGNAL(triggered()), this, SLOT(onOpenProjectWebPage()));
    helpMenu->addAction(openProjectWebPageAction);

    QAction *openGettingStartedWebPageAction = new QAction(tr("&Getting started"), this);
    openGettingStartedWebPageAction->setToolTip(tr("Open Getting started wiki page"));
    connect(openGettingStartedWebPageAction, SIGNAL(triggered()), this, SLOT(onOpenGettingStartedWebPage()));
    helpMenu->addAction(openGettingStartedWebPageAction);

    helpMenu->addSeparator();

    themeInformationAction = new QAction(tr("Theme &Information"), this);
    // themeInformationAction->setToolTip(tr("View information about the current theme."));
    // connect(themeInformationAction, SIGNAL(triggered()), this, SLOT(openThemeInformation()));
    // helpMenu->addAction(themeInformationAction);
    // QString url = global.getResourceFileName(global.resourceList, ":themeInformation");
    // themeInformationAction->setVisible(false);
    // if (url.startsWith("http://", Qt::CaseInsensitive) || url.startsWith("https://", Qt::CaseInsensitive))
    //     themeInformationAction->setVisible(true);
    // QFile file(url);
    // if (file.exists())
    //     themeInformationAction->setVisible(true);
    // global.settings->beginGroup(INI_GROUP_APPEARANCE);
    // QString themeName = global.settings->value("themeName", "").toString();
    // global.settings->endGroup();
    // if (themeName == "")

    // temporarily off - as the themes are currently un-ripe/unfinished
    themeInformationAction->setVisible(false);

    openMessageLogAction = new QAction(tr("Data and &log location info"), this);
    openMessageLogAction->setToolTip(tr("View location of program data and log file"));
    connect(openMessageLogAction, SIGNAL(triggered()), parent, SLOT(openMessageLogInfo()));
    helpMenu->addAction(openMessageLogAction);

    openShortcutsDialogAction = new QAction(tr("Active shortcuts"), this);
    openShortcutsDialogAction->setToolTip(tr("View current shortcuts"));
    connect(openShortcutsDialogAction, SIGNAL(triggered(bool)), parent, SLOT(openShortcutsDialog()));
    helpMenu->addAction(openShortcutsDialogAction);

    helpMenu->addSeparator();

    aboutQtAction = new QAction(tr("About &Qt"), this);
    aboutQtAction->setMenuRole(QAction::AboutQtRole);
    aboutQtAction->setToolTip(tr("About Qt"));
    connect(aboutQtAction, SIGNAL(triggered()), parent, SLOT(openQtAbout()));
    helpMenu->addAction(aboutQtAction);

    helpMenu->addSeparator();

    aboutAction = new QAction(tr("&About"), this);
    aboutAction->setToolTip(tr("About"));
    aboutAction->setMenuRole(QAction::AboutRole);
    connect(aboutAction, SIGNAL(triggered()), parent, SLOT(openAbout()));
    helpMenu->addAction(aboutAction);
}