Exemplo n.º 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)));
    }
Exemplo n.º 2
0
	DataViewWidget::DataViewWidget (QWidget *parent)
	: QWidget (parent)
	{
		Ui_.setupUi (this);

		connect (Ui_.Add_,
				SIGNAL (released ()),
				this,
				SIGNAL (addRequested ()));
		connect (Ui_.Remove_,
				SIGNAL (released ()),
				this,
				SIGNAL (removeRequested ()));
	}
Exemplo n.º 3
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);
	}
Exemplo n.º 4
0
	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);
	}
PropertyMultiValueWidget::PropertyMultiValueWidget(PartProperty* prop, QWidget* parent, QObject* keyEventFilter)
		: QWidget(parent), cat(prop->getPartCategory()), prop(prop), state(Enabled), flags(0)
{
	PartProperty::Type type = prop->getType();
	flags_t flags = prop->getFlags();


	QVBoxLayout* topLayout = new QVBoxLayout(this);
	setLayout(topLayout);

	QSplitter* splitter = new QSplitter(Qt::Horizontal, this);
	topLayout->addWidget(splitter);

	QWidget* listContWidget = new QWidget(splitter);
	splitter->addWidget(listContWidget);

	QVBoxLayout* listContLayout = new QVBoxLayout(listContWidget);
	listContWidget->setLayout(listContLayout);

	listWidget = new QListWidget(listContWidget);
	listWidget->installEventFilter(keyEventFilter);
	connect(listWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
			this, SLOT(currentItemChanged(QListWidgetItem*, QListWidgetItem*)));
	listContLayout->addWidget(listWidget);


	QWidget* buttonWidget = new QWidget(listContWidget);
	listContLayout->addWidget(buttonWidget);

	QHBoxLayout* buttonLayout = new QHBoxLayout(buttonWidget);
	buttonWidget->setLayout(buttonLayout);

	buttonLayout->addStretch(1);

	listAddButton = new QPushButton("", buttonWidget);
	listAddButton->setIcon(QIcon::fromTheme("list-add", QIcon(":/icons/list-add.png")));
	connect(listAddButton, SIGNAL(clicked()), this, SLOT(addRequested()));
	buttonLayout->addWidget(listAddButton);

	listRemoveButton = new QPushButton("", buttonWidget);
	listRemoveButton->setIcon(QIcon::fromTheme("list-remove", QIcon(":/icons/list-remove.png")));
	connect(listRemoveButton, SIGNAL(clicked()), this, SLOT(removeRequested()));
	buttonLayout->addWidget(listRemoveButton);

	buttonLayout->addStretch(1);


	QWidget* detailWidget = new QWidget(splitter);
	splitter->addWidget(detailWidget);

	QVBoxLayout* detailLayout = new QVBoxLayout(detailWidget);
	detailWidget->setLayout(detailLayout);

	QWidget* detailFormWidget = new QWidget(detailWidget);
	detailLayout->addWidget(detailFormWidget);

	QFormLayout* detailFormLayout = new QFormLayout(detailFormWidget);
	detailFormLayout->setSizeConstraint(QFormLayout::SetMinimumSize);
	detailFormLayout->setHorizontalSpacing(20);
	detailFormLayout->setVerticalSpacing(10);
	detailFormWidget->setLayout(detailFormLayout);

	if (type != PartProperty::PartLink) {
		if (type == PartProperty::Boolean) {
			boolBox = new QCheckBox(prop->getUserReadableName(), detailFormWidget);
			boolBox->installEventFilter(keyEventFilter);
			connect(boolBox, SIGNAL(toggled(bool)), this, SLOT(boolFieldToggled(bool)));
			detailFormLayout->addRow(boolBox);
		} else if (type == PartProperty::File) {
Exemplo n.º 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");
}
Exemplo n.º 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");
}