Exemple #1
0
    Managers (const ICoreProxy_ptr& proxy)
        : UncloseMgr_ { proxy, &TabsPropsMgr_ }
        , SessionsMgr_ { proxy, &TabsPropsMgr_ }
        , SessionMenuMgr_ { &SessionsMgr_ }
    {
        QObject::connect (&SessionMenuMgr_,
                          SIGNAL (loadRequested (QString)),
                          &SessionsMgr_,
                          SLOT (loadCustomSession (QString)));
        QObject::connect (&SessionMenuMgr_,
                          SIGNAL (addRequested (QString)),
                          &SessionsMgr_,
                          SLOT (addCustomSession (QString)));
        QObject::connect (&SessionMenuMgr_,
                          SIGNAL (deleteRequested (QString)),
                          &SessionsMgr_,
                          SLOT (deleteCustomSession (QString)));
        QObject::connect (&SessionMenuMgr_,
                          SIGNAL (saveCustomSessionRequested ()),
                          &SessionsMgr_,
                          SLOT (saveCustomSession ()));

        QObject::connect (&SessionsMgr_,
                          SIGNAL (gotCustomSession (QString)),
                          &SessionMenuMgr_,
                          SLOT (addCustomSession (QString)));
    }
Exemple #2
0
	void Plugin::Init (ICoreProxy_ptr proxy)
	{
		Util::InstallTranslator ("tabsessmanager");

		TabsPropsMgr_ = std::make_shared<TabsPropsManager> ();

		UncloseMgr_ = new UncloseManager { proxy, TabsPropsMgr_.get () };

		SessionsMgr_ = new SessionsManager { proxy, TabsPropsMgr_.get () };

		SessionMenuMgr_ = new SessionMenuManager { SessionsMgr_ };
		connect (SessionMenuMgr_,
				SIGNAL (loadRequested (QString)),
				SessionsMgr_,
				SLOT (loadCustomSession (QString)));
		connect (SessionMenuMgr_,
				SIGNAL (addRequested (QString)),
				SessionsMgr_,
				SLOT (addCustomSession (QString)));
		connect (SessionMenuMgr_,
				SIGNAL (deleteRequested (QString)),
				SessionsMgr_,
				SLOT (deleteCustomSession (QString)));
		connect (SessionMenuMgr_,
				SIGNAL (saveCustomSessionRequested ()),
				SessionsMgr_,
				SLOT (saveCustomSession ()));

		connect (SessionsMgr_,
				SIGNAL (gotCustomSession (QString)),
				SessionMenuMgr_,
				SLOT (addCustomSession (QString)));

		Proxy_ = proxy;

		for (const auto& name : SessionsMgr_->GetCustomSessions ())
			SessionMenuMgr_->addCustomSession (name);
	}
	void Plugin::Init (ICoreProxy_ptr proxy)
	{
		Util::InstallTranslator ("tabsessmanager");

		UncloseMenu_ = new QMenu (tr ("Unclose tabs"));

		SessionsMgr_ = new SessionsManager { proxy };

		SessionMenuMgr_ = new SessionMenuManager;
		connect (SessionMenuMgr_,
				SIGNAL (loadRequested (QString)),
				SessionsMgr_,
				SLOT (loadCustomSession (QString)));
		connect (SessionMenuMgr_,
				SIGNAL (addRequested (QString)),
				SessionsMgr_,
				SLOT (addCustomSession (QString)));
		connect (SessionMenuMgr_,
				SIGNAL (deleteRequested (QString)),
				SessionsMgr_,
				SLOT (deleteCustomSession (QString)));
		connect (SessionMenuMgr_,
				SIGNAL (saveCustomSessionRequested ()),
				SessionsMgr_,
				SLOT (saveCustomSession ()));

		connect (SessionsMgr_,
				SIGNAL (gotCustomSession (QString)),
				SessionMenuMgr_,
				SLOT (addCustomSession (QString)));

		Proxy_ = proxy;

		for (const auto& name : SessionsMgr_->GetCustomSessions ())
			SessionMenuMgr_->addCustomSession (name);
	}
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();
}
void CSRFileConfigurationView::onDeleteRequested()
{
	emit deleteRequested(this);
}
Exemple #6
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");
}
Exemple #7
0
// Constructor
NNotebookView::NNotebookView(QWidget *parent) :
    QTreeWidget(parent)
{
    stackStore.clear();
    dataStore.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->setRootIsDecorated(true);
    this->setSortingEnabled(false);
    this->header()->setVisible(false);
    this->setStyleSheet("QTreeView {border-image:none; image:none;} ");
    root = new NNotebookViewItem(0);
    root->setType(NNotebookViewItem::Stack);
    root->setData(NAME_POSITION, Qt::UserRole, "rootsynchronized");
    root->setData(NAME_POSITION, Qt::DisplayRole, tr("Notebooks"));
    QFont rootFont = root->font(NAME_POSITION);
    rootFont.setBold(true);
    root->setFont(NAME_POSITION, rootFont);

    root->setRootColor(false);

    this->setMinimumHeight(1);
    this->addTopLevelItem(root);
    this->rebuildNotebookTreeNeeded = 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()));

    addAction = context.addAction(tr("Create New Notebook"));
    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);

    // Start building the stack menu
    stackMenu = context.addMenu(tr("Add to stack"));
    QAction *newAction;
    NotebookTable table(global.db);
    QStringList stacks;
    table.getStacks(stacks);
    for (int i=0; i<stacks.size(); i++) {
        newAction = stackMenu->addAction(stacks[i]);
        connect(newAction, SIGNAL(triggered()), this, SLOT(moveToStackRequested()));
    }
    sortStackMenu();
    if (stacks.size() > 0) {
        stackMenu->addSeparator();
    }
    newStackAction = stackMenu->addAction(tr("New stack"));
    connect(newStackAction, SIGNAL(triggered()), this, SLOT(moveToNewStackRequested()));

    removeFromStackAction = context.addAction(tr("Remove from stack"));
    removeFromStackAction->setShortcutContext(Qt::WidgetShortcut);
    removeFromStackAction->setVisible(false);

    renameAction = context.addAction(tr("Rename"));
    renameAction->setShortcutContext(Qt::WidgetShortcut);

    //renameShortcut = new QShortcut(this);
    //renameShortcut->setKey(QKeySequence(Qt::Key_F2));
    //renameShortcut->setContext(Qt::WidgetShortcut);

    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(addShortcut, SIGNAL(activated()), this, SLOT(addRequested()));
    connect(deleteShortcut, SIGNAL(activated()), this, SLOT(deleteRequested()));
    //connect(renameShortcut, SIGNAL(activated()), this, SLOT(renameRequested()));
    connect(removeFromStackAction, SIGNAL(triggered()), this, SLOT(removeFromStackRequested()));

    this->setAcceptDrops(true);
    this->setItemDelegate(new NNotebookViewDelegate());
    root->setExpanded(true);
    this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    this->setFrameShape(QFrame::NoFrame);


    //setStyle(new MyStyle("QTreeView"));
//    setStyle(new QCleanlooksStyle);
    //setStyleSheet("::branches {image: url(:right-arrow.png);}");

//    setStyleSheet("QTreeView::branch { image: url(:right-arrow.png); }");

    expandedImage = new QImage(":expandedIcon");
    collapsedImage = new QImage(":collapsedIcon");
}