Beispiel #1
0
RawEditorWidget::RawEditorWidget(QWidget * par)
: QWidget(par)
{
	setObjectName("raw_event_editor");
	QGridLayout * l = new QGridLayout(this);
	QSplitter * spl = new QSplitter(Qt::Horizontal,this);
	spl->setObjectName("raweditor_splitter");
	spl->setChildrenCollapsible(false);

	l->addWidget(spl,0,0);

	KviTalVBox * boxi = new KviTalVBox(spl);
	boxi->setMaximumWidth(200);
	m_pTreeWidget = new RawTreeWidget(boxi);



	m_pTreeWidget->setColumnCount(1);
	m_pTreeWidget->setHeaderLabel(__tr2qs_ctx("RAW Event","editor"));

//	m_pTreeWidget->setMultiSelection(false);
	m_pTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
//	m_pTreeWidget->setShowSortIndicator(true);
	m_pTreeWidget->setRootIsDecorated(true);
	m_pContextPopup = new QMenu(this);
	m_pTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(m_pTreeWidget,SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)),this,SLOT(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)));

	connect(m_pTreeWidget,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(customContextMenuRequested(const QPoint &)));

	QPushButton * pb = new QPushButton(__tr2qs_ctx("&Export All to...","editor"),boxi);
	connect(pb,SIGNAL(clicked()),this,SLOT(exportAllEvents()));

	KviTalVBox * box = new KviTalVBox(spl);
	m_pNameEditor = new QLineEdit(box);
	m_pNameEditor->setToolTip(__tr2qs_ctx("Edit the RAW event handler name.","editor"));
	m_pEditor = KviScriptEditor::createInstance(box);

	m_bOneTimeSetupDone = false;
	m_pLastEditedItem = 0;
}
Beispiel #2
0
PopupEditorWidget::PopupEditorWidget(QWidget * par)
    : QWidget(par)
{
	m_bSaving = false;

	QGridLayout * l = new QGridLayout(this);
	QSplitter * spl = new QSplitter(Qt::Horizontal, this);
	spl->setObjectName("popupeditor_horizontal_splitter");
	spl->setChildrenCollapsible(false);
	l->addWidget(spl, 0, 0);

	KviTalVBox * box = new KviTalVBox(spl);

	m_pTreeWidget = new QTreeWidget(box);
	m_pTreeWidget->setHeaderLabel(__tr2qs_ctx("Popup", "editor"));
	m_pTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
	m_pTreeWidget->header()->setSortIndicatorShown(true);

	QPushButton * pb = new QPushButton(__tr2qs_ctx("&Export All to...", "editor"), box);
	connect(pb, SIGNAL(clicked()), this, SLOT(exportAll()));
	QPushButton * gn = new QPushButton(__tr2qs_ctx("&Export Selected to...", "editor"), box);
	connect(gn, SIGNAL(clicked()), this, SLOT(exportSelected()));

	m_pEditor = new SinglePopupEditor(spl);

	m_bOneTimeSetupDone = false;
	m_pLastEditedItem = nullptr;

	m_pContextPopup = new QMenu(this);
	m_pEmptyContextPopup = new QMenu(this);

	spl->setStretchFactor(0, 20);
	spl->setStretchFactor(1, 80);

	currentItemChanged(nullptr, nullptr);
}
Beispiel #3
0
ProgramTab::ProgramTab(QString & filename, QWidget *parent) : QFrame(parent)
{
	m_tabWidget = NULL;
	while (parent != NULL) {
		QTabWidget * tabWidget = qobject_cast<QTabWidget *>(parent);
		if (tabWidget) {
			m_tabWidget = tabWidget;
			break;
		}
		parent = parent->parentWidget();
    }

	if (AsteriskIcon == NULL) {
		AsteriskIcon = new QIcon(":/resources/images/icons/asterisk.png");
	}

    m_canCopy = false;
    m_canCut = false;
    m_canUndo = false;
    m_canRedo = false;
    m_language = "";
    m_port = "";
    m_filename = filename;

	m_updateEnabled = false;
	QGridLayout *editLayout = new QGridLayout(this);
	editLayout->setMargin(0);
	editLayout->setSpacing(0);

    m_programWindow = qobject_cast<ProgramWindow *>(window());

    // m_textEdit needs to be initialized before createFooter so
    // some signals get connected properly.
    m_textEdit = new QTextEdit;
    m_textEdit->setFontFamily("Droid Sans Mono");
    m_textEdit->setLineWrapMode(QTextEdit::NoWrap);
    QFontMetrics fm(m_textEdit->currentFont());
    m_textEdit->setTabStopWidth(fm.averageCharWidth() * 4);
    m_textEdit->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    m_textEdit->setUndoRedoEnabled(true);
    connect(m_textEdit, SIGNAL(textChanged()), this, SLOT(textChanged()));
    connect(m_textEdit, SIGNAL(undoAvailable(bool)), this, SLOT(enableUndo(bool)));
    connect(m_textEdit, SIGNAL(redoAvailable(bool)), this, SLOT(enableRedo(bool)));
    connect(m_textEdit, SIGNAL(copyAvailable(bool)), this, SLOT(enableCopy(bool)));
    connect(m_textEdit, SIGNAL(copyAvailable(bool)), this, SLOT(enableCut(bool))); // Reuse copy signal for cut
    m_highlighter = new Highlighter(m_textEdit);

	QFrame * footerFrame = createFooter();
	editLayout->addWidget(footerFrame,0,0);

	QSplitter * splitter = new QSplitter;
	splitter->setObjectName("splitter");
	splitter->setOrientation(Qt::Vertical);
    editLayout->addWidget(splitter, 1, 0);

	splitter->addWidget(m_textEdit);

	m_console = new QTextEdit();
	m_console->setLineWrapMode(QTextEdit::NoWrap);
	m_console->setObjectName("console");
	m_console->setReadOnly(true);

	splitter->addWidget(m_console);

	splitter->setStretchFactor(0, 8);
    splitter->setStretchFactor(1, 2);
}
Beispiel #4
0
SinglePopupEditor::SinglePopupEditor(QWidget * par)
    : QWidget(par)
{
	m_pLastSelectedItem = nullptr;
	m_pContextPopup = new QMenu(this);
	m_pClipboard = nullptr;
	m_pTestPopup = nullptr;

	QGridLayout * g = new QGridLayout(this);
	g->setMargin(0);
	g->setSpacing(2);

	m_pNameEditor = new QLineEdit(this);
	m_pNameEditor->setToolTip(__tr2qs_ctx("Popup name", "editor"));

	g->addWidget(m_pNameEditor, 0, 0, 1, 2);

	m_pMenuButton = new QPushButton(__tr2qs_ctx("Test", "editor"), this);
	g->addWidget(m_pMenuButton, 0, 2);
	connect(m_pMenuButton, SIGNAL(clicked()), this, SLOT(testPopup()));
	QSplitter * spl = new QSplitter(Qt::Vertical, this);
	spl->setObjectName("popupeditor_vertical_splitter");
	spl->setChildrenCollapsible(false);

	m_pTreeWidget = new QTreeWidget(spl);
	m_pTreeWidget->setColumnCount(2);
	QStringList labels;
	labels << __tr2qs_ctx("Item", "editor") << __tr2qs_ctx("Type", "editor");
	m_pTreeWidget->setHeaderLabels(labels);
	m_pTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
	m_pTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
	m_pTreeWidget->setAllColumnsShowFocus(true);
	m_pTreeWidget->setRootIsDecorated(true);
	m_pTreeWidget->header()->setSortIndicatorShown(false);
	m_pTreeWidget->setSortingEnabled(false);
	m_pTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);

	connect(m_pTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
	connect(m_pTreeWidget, SIGNAL(customContextMenuRequested(const QPoint &)),
	    this, SLOT(customContextMenuRequested(const QPoint &)));

	m_pEditor = KviScriptEditor::createInstance(spl);

	g->addWidget(spl, 1, 0, 1, 3);

	QLabel * l = new QLabel(__tr2qs_ctx("Text:", "editor"), this);
	g->addWidget(l, 2, 0);

	m_pTextEditor = new QLineEdit(this);
	m_pTextEditor->setToolTip(
	    __tr2qs_ctx("<b>Visible text</b><br>May contain identifiers that will be evaluated at popup call time.<br>For labels, this text can contain also limited HTML tags.", "editor"));
	g->addWidget(m_pTextEditor, 2, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("Condition:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 3, 0);

	m_pConditionEditor = new QLineEdit(this);
	m_pConditionEditor->setToolTip(
	    __tr2qs_ctx("<b>Boolean condition</b><br>Will be evaluated at popup call time in order to decide if this entry has to be shown.<br>An empty condition evaluates to true.", "editor"));
	g->addWidget(m_pConditionEditor, 3, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("Icon:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 4, 0);

	m_pIconEditor = new QLineEdit(this);
	m_pIconEditor->setToolTip(
	    __tr2qs_ctx("<b>Icon identifier</b><br>May be an internal icon ID, an absolute path or a relative path.<br>Portable scripts should never use absolute paths.", "editor"));
	g->addWidget(m_pIconEditor, 4, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("External menu:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 5, 0);

	m_pExtNameEditor = new QLineEdit(this);
	m_pExtNameEditor->setToolTip(
	    __tr2qs_ctx("<b>External menu name</b><br>This allows one to nest externally defined popup menus. The popup menu with the specified name will be looked up at menu setup time.", "editor"));
	g->addWidget(m_pExtNameEditor, 5, 1, 1, 2);

	l = new QLabel(__tr2qs_ctx("Item ID:", "editor"), this);
	l->setMargin(2);
	g->addWidget(l, 6, 0);

	m_pIdEditor = new QLineEdit(this);
	m_pIdEditor->setToolTip(
	    __tr2qs_ctx("<b>Item ID</b><br>This will allow you to use delpopupitem later.", "editor"));
	g->addWidget(m_pIdEditor, 6, 1, 1, 2);
	g->setColumnStretch(1, 1);
	g->setRowStretch(1, 1);
}
Beispiel #5
0
QWidget* WidgetStyle::createWidget(const QString& name)
{
    if(name == "CheckBox")
    {
        QCheckBox* box = new QCheckBox("CheckBox");
        box->setObjectName("CheckBox");
        return setLayoutWidget({ box }, { 100, 30 });
    }
    else if(name == "ComboBox")
    {
        QComboBox* box = new QComboBox;
        box->addItem("Item1");
        box->addItem("Item3");
        box->addItem("Item3");
        box->setObjectName("ComboBox");
        return setLayoutWidget({ box }, { 70, 30 });
    }
    else if(name == "DateEdit")
    {
        QDateEdit* date = new QDateEdit;
        date->setObjectName("DateEdit");
        return setLayoutWidget({ date }, { 110, 40 });
    }
    else if(name == "DateTimeEdit")
    {
        QDateTimeEdit* date = new QDateTimeEdit;
        date->setObjectName("DateTimeEdit");
        return setLayoutWidget({ date }, { 160, 30 });
    }
    else if(name == "Dialog")
    {
        QDialog* dialog = new QDialog;
        dialog->setObjectName("Dialog");
        return setLayoutWidget({ dialog }, { 160, 110 });
    }
    else if(name == "DockWidget") //?
    {
        QDockWidget* widget = new QDockWidget;
        widget->setObjectName("DockWidget");
        widget->resize(61, 22);
        return widget;
    }
    else if(name == "DoubleSpinBox")
    {
        QDoubleSpinBox* box = new QDoubleSpinBox;
        box->setObjectName("DoubleSpinBox");
        return setLayoutWidget({ box }, { 90, 40 });
    }
    else if(name == "Frame") //??
    {
        QFrame* frame = new QFrame;
        frame->setObjectName("Frame");
        frame->resize(150, 100);
        return frame;
    }
    else if(name == "GroupBox")
    {
        QGroupBox* box = new QGroupBox("GroupBox");
        box->setObjectName("GroupBox");
        return setLayoutWidget({ box }, { 160, 110 });
    }
    else if(name == "Label")
    {
        QLabel* label = new QLabel("Label");
        label->setObjectName("Label");
        return setLayoutWidget({ label }, { 40, 20});
    }
    else if(name == "LineEdit")
    {
        QLineEdit* line = new QLineEdit;
        line->setObjectName("LineEdit");
        return setLayoutWidget({ line }, { 30, 30 });
    }
    else if(name == "ListView") //??
    {
        QListView* view = new QListView;
        view->setObjectName("ListView");
        view->resize(71, 71);
        return view;
    }
    else if(name == "ListWidget")
    {
        QListWidget* list = new QListWidget;
        list->setObjectName("ListWidget");
        for(int i = 0; i < 20; i++)
            list->addItem(QString("Item %1").arg(i));
        return setLayoutWidget({ list }, { 80, 80 });
    }
    else if(name == "MainWindow")
    {
        QMainWindow* window = new QMainWindow;
        window->setObjectName("MainWindow");
        return setLayoutWidget({ window }, { 160, 110 });
    }
    else if(name == "Menu")
    {
        QMenu* parentMenu = new QMenu;
        parentMenu->setObjectName("Menu");
        parentMenu->addMenu("Menu1");
        QMenu* menu1 = parentMenu->addMenu("Menu2");
        menu1->addMenu("Menu1");
        menu1->addMenu("Menu2");
        parentMenu->addSeparator();
        parentMenu->addMenu("Menu3");
        return setLayoutWidget({ parentMenu }, { 160, 110 });
    }
    else if(name == "MenuBar")
    {
        QMenuBar* bar = new QMenuBar;
        bar->setObjectName("QMenuBar");
        QMenu* menu1 = bar->addMenu("MenuBar1");
        menu1->addMenu("Menu1");
        menu1->addSeparator();
        menu1->addMenu("Menu2");
        QMenu* menu2 = bar->addMenu("MenuBar2");
        menu2->addMenu("Menu1");
        menu2->addSeparator();
        menu2->addMenu("Menu2");
        QMenu* menu3 = bar->addMenu("MenuBar3");
        menu3->addMenu("Menu1");
        menu3->addSeparator();
        menu3->addMenu("Menu2");
        return setLayoutWidget({ bar }, { 280, 60 });
    }
    else if(name == "ProgressBar")
    {
        QProgressBar* bar = new QProgressBar;
        bar->setObjectName("ProgressBar");
        bar->setRange(0, 100);
        bar->setValue(0);

        QTimer* timer = new QTimer(bar);
        this->connect(timer, &QTimer::timeout, this, [bar]()
        {
            if(bar->value() == 100)
                bar->setValue(0);
            else
                bar->setValue(bar->value() + 1);
        });
        timer->start(100);
        return setLayoutWidget({ bar }, { 110, 30 });
    }
    else if(name == "PushButton")
    {
        QPushButton* button = new QPushButton("PushButton");
        button->setObjectName("PushButton");
        return setLayoutWidget({ button }, { 125, 30 });
    }
    else if(name == "RadioButton")
    {
        QRadioButton* button = new QRadioButton("RadioButton");
        button->setObjectName("RadioButton");
        return setLayoutWidget({ button }, { 125, 30 });
    }
    else if(name == "ScrollBar")
    {
        QScrollBar* barH = new QScrollBar(Qt::Horizontal);
        QScrollBar* barV = new QScrollBar(Qt::Vertical);
        barH->setObjectName("ScrollBarH");
        barV->setObjectName("ScrollBarV");
        return setLayoutWidget({ barH, barV }, { 200, 100 });
    }
    else if(name == "Slider")
    {
        QSlider* sliderH = new QSlider(Qt::Horizontal);
        QSlider* sliderV = new QSlider(Qt::Vertical);
        sliderH->setObjectName("SliderH");
        sliderV->setObjectName("SliderV");
        return setLayoutWidget({ sliderH, sliderV }, { 200, 100 });
    }
    else if(name == "SpinBox")
    {
        QSpinBox* spinBox = new QSpinBox;
        spinBox->setObjectName("SpinBox");
        return setLayoutWidget({ spinBox }, { 60, 35 });
    }
    else if(name == "Splitter")
    {
        QSplitter* splitterV = new QSplitter(Qt::Vertical);
        QSplitter* splitterH = new QSplitter(Qt::Horizontal);
        splitterV->setObjectName("SplitterV");
        splitterH->setObjectName("SplitterH");
        splitterV->addWidget(new QPushButton("PushButton1"));
        splitterV->addWidget(new QPushButton("PushButton2"));
        splitterH->addWidget(splitterV);
        splitterH->addWidget(new QPushButton("PushButton3"));
        return setLayoutWidget({ splitterH }, { 250, 110 });
    }
    else if(name == "TabWidget")
    {
        QTabWidget* tab = new QTabWidget;
        tab->addTab(new QWidget, "Widget1");
        tab->addTab(new QWidget, "Widget2");
        tab->addTab(new QWidget, "Widget3");
        tab->setObjectName("TabWidget");
        return setLayoutWidget({ tab }, { 210, 110 });
    }
    else if(name == "TableView") //?
    {
        QTableView* view = new QTableView;
        view->setObjectName("TableView");
        view->resize(200, 100);
        return view;
    }
    else if(name == "TableWidget")
    {
        const int n = 100;
        QStringList list = { "one", "two", "three" };
        QTableWidget* table = new QTableWidget(n, n);
        table->setObjectName("TableWidget");
        table->setHorizontalHeaderLabels(list);
        table->setVerticalHeaderLabels(list);
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n; j++)
                table->setItem(i, j, new QTableWidgetItem(QString("%1, %2").arg(i).arg(j)));
        return setLayoutWidget({ table }, { 210, 110 });
    }
    else if(name == "TextEdit")
    {
        QTextEdit* text = new QTextEdit;
        text->setObjectName("TextEdit");
        return setLayoutWidget({ text }, { 80, 80 });
    }
    else if(name == "TimeEdit")
    {
        QTimeEdit* time = new QTimeEdit;
        time->setObjectName("TimeEdit");
        return setLayoutWidget({ time }, { 80, 80 });
    }
    else if(name == "ToolButton")
    {
        QToolButton* button = new QToolButton;
        button->setText("ToolButton");
        button->setObjectName("ToolButton");
        return setLayoutWidget({ button }, { 95, 25 });
    }
    else if(name == "ToolBox")
    {
        QToolBox* box = new QToolBox;
        box->addItem(new QWidget, "Widget1");
        box->addItem(new QWidget, "Widget2");
        box->addItem(new QWidget, "Widget3");
        box->setObjectName("ToolBox");
        return setLayoutWidget({ box }, { 110, 180 });
    }
    else if(name == "TreeView") //?
    {
        QTreeView* tree = new QTreeView;
        tree->setObjectName("TreeView");
        tree->resize(200, 100);
        return tree;
    }
    else if(name == "TreeWidget")
    {
        QTreeWidget* tree = new QTreeWidget;
        tree->setObjectName("TreeWidget");
        tree->setHeaderLabels({ "Folders", "Used Space" });
        QTreeWidgetItem* item = new QTreeWidgetItem(tree);
        item->setText(0, "Local Disk");
        for(int i = 1; i < 20; i++)
        {
            QTreeWidgetItem* dir = new QTreeWidgetItem(item);
            dir->setText(0, "Directory" + QString::number(i));
            dir->setText(1, QString::number(i) + "MB");
        }
        tree->setItemExpanded(item, true);
        return setLayoutWidget({ tree }, { 210, 110 });
    }
    else if(name == "Widget")
    {
        QWidget* widget = new QWidget;
        widget->setObjectName("Widget");
        return setLayoutWidget({ widget }, { 210, 110 });
    }
    return nullptr;
}
Beispiel #6
0
void FileBrowser::CreateDialogLayout()
{
    QGridLayout *gridLayout;
    QGridLayout *gridLayout1;
    QGridLayout *gridLayout2;
    QSplitter *splitter;

    this->setObjectName(QString::fromUtf8("Dialog"));
    this->setWindowModality(Qt::ApplicationModal);
    QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(0), static_cast<QSizePolicy::Policy>(0));
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    //sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
    this->setSizePolicy(sizePolicy);
    gridLayout = new QGridLayout(this);
    gridLayout->setSizeConstraint(QLayout::SetNoConstraint);
    gridLayout->setSpacing(6);
    gridLayout->setMargin(9);
    gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
    gridLayout1 = new QGridLayout();
    gridLayout1->setSizeConstraint(QLayout::SetNoConstraint);
    gridLayout1->setSpacing(6);
    gridLayout1->setMargin(0);
    gridLayout1->setObjectName(QString::fromUtf8("gridLayout1"));
    gridLayout2 = new QGridLayout();
    gridLayout2->setSizeConstraint(QLayout::SetNoConstraint);
    gridLayout2->setSpacing(6);
    gridLayout2->setMargin(0);
    gridLayout2->setObjectName(QString::fromUtf8("gridLayout2"));
    splitter = new QSplitter(this);
    splitter->setObjectName(QString::fromUtf8("splitter"));
    splitter->setOrientation(Qt::Horizontal);
    lstDir = new QListWidget(splitter);
    lstDir->setObjectName(QString::fromUtf8("lstDir"));
    splitter->addWidget(lstDir);

    lstFile = new QListWidget(splitter);
    lstFile->setObjectName(QString::fromUtf8("lstFile"));
    splitter->addWidget(lstFile);

    gridLayout2->addWidget(splitter, 0, 0, 1, 2);

    btnCancel = new QPushButton(this);
    btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
    //btnCancel->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/16x16/stop.xpm")));
    btnCancel->setIcon(QPixmap(stop));

    gridLayout2->addWidget(btnCancel, 2, 1, 1, 1);

    chkLoadAllClients = new QCheckBox(this);
    chkLoadAllClients->setObjectName(QString::fromUtf8("chkLoadAllClients"));

    txtFilename = new QLineEdit(this);
    txtFilename->setObjectName(QString::fromUtf8("txtFilename"));

    gridLayout2->addWidget(txtFilename, 1, 0, 1, 1);

    cmbFilter = new QComboBox(this);
    cmbFilter->setObjectName(QString::fromUtf8("cmbFilter"));

    gridLayout2->addWidget(chkLoadAllClients, 3, 0, 1, 2);
    gridLayout2->addWidget(cmbFilter, 2, 0, 1, 1);

    btnAccept = new QPushButton(this);
    btnAccept->setObjectName(QString::fromUtf8("btnAccept"));
    //btnAccept->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/16x16/apply.xpm")));
    btnAccept->setIcon(QPixmap(apply));

    gridLayout2->addWidget(btnAccept, 1, 1, 1, 1);

    gridLayout1->addLayout(gridLayout2, 1, 1, 1, 1);

    vboxLayout = new QVBoxLayout();

    vboxLayout->setSizeConstraint(QLayout::SetNoConstraint);
    vboxLayout->setSpacing(6);
    vboxLayout->setMargin(0);
    vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
    btnHome = new QPushButton(this);
    btnHome->setObjectName(QString::fromUtf8("btnHome"));
    //btnHome->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/32x32/home32.xpm")));
    btnHome->setIcon(QPixmap(home32));
    btnHome->setIconSize(QSize(32, 32));

    vboxLayout->addWidget(btnHome);

    btnMachine = new QPushButton(this);
    btnMachine->setObjectName(QString::fromUtf8("btnMachine"));
    //btnMachine->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/32x32/computer32.xpm")));
    btnMachine->setIcon(QPixmap(computer32));
    btnMachine->setIconSize(QSize(32, 32));

    vboxLayout->addWidget(btnMachine);

    btnAccessGrid = new QPushButton(this);
    btnAccessGrid->setObjectName(QString::fromUtf8("btnAccessGrid"));
    //btnAccessGrid->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/32x32/ag32.xpm")));
    btnAccessGrid->setIcon(QPixmap(ag32));
    btnAccessGrid->setIconSize(QSize(32, 32));

    vboxLayout->addWidget(btnAccessGrid);

    btnRemote = new QPushButton(this);
    btnRemote->setObjectName(QString::fromUtf8("btnRemote"));
    //btnRemote->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/32x32/network32.xpm")));
    btnRemote->setIcon(QPixmap(network32));
    btnRemote->setIconSize(QSize(32, 32));

    vboxLayout->addWidget(btnRemote);

    gridLayout1->addLayout(vboxLayout, 1, 0, 1, 1);

    hboxLayout = new QHBoxLayout();
    hboxLayout->setSizeConstraint(QLayout::SetNoConstraint);
    hboxLayout->setSpacing(6);
    hboxLayout->setMargin(0);
    hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
    cmbDirectory = new QComboBox(this);
    cmbDirectory->setObjectName(QString::fromUtf8("cmbDirectory"));
    cmbDirectory->setMinimumSize(QSize(0, 30));

    hboxLayout->addWidget(cmbDirectory);

    btnDirUp = new QPushButton(this);
    btnDirUp->setObjectName(QString::fromUtf8("btnDirUp"));
    btnDirUp->setMinimumSize(QSize(35, 35));
    btnDirUp->setMaximumSize(QSize(40, 40));
    //btnDirUp->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/32x32/undo32.xpm")));
    btnDirUp->setIcon(QPixmap(undo32));

    hboxLayout->addWidget(btnDirUp);

    cmbHistory = new QComboBox(this);
    cmbHistory->setObjectName(QString::fromUtf8("cmbHistory"));
    cmbHistory->setMinimumSize(QSize(0, 30));

    hboxLayout->addWidget(cmbHistory);

    gridLayout1->addLayout(hboxLayout, 0, 0, 1, 2);

    gridLayout->addLayout(gridLayout1, 0, 0, 1, 1);

    this->setWindowTitle(QApplication::translate("Dialog", "Dialog", 0));
    btnCancel->setText(QApplication::translate("Dialog", "Cancel", 0));
    btnAccept->setText(QApplication::translate("Dialog", "Accept", 0));
    chkLoadAllClients->setText(QString::fromUtf8("Load for all clients"));
    chkLoadAllClients->setDisabled(true);
    btnHome->setText(QString());
    btnMachine->setText(QString());
    btnAccessGrid->setText(QString());
    btnRemote->setText(QString());
    btnDirUp->setText(QString());

    QSize size(563, 294);
    size = size.expandedTo(this->minimumSizeHint());
    this->resize(size);
}
Beispiel #7
0
CollectionViewPrivate::CollectionViewPrivate(CollectionView *parent)
    : QObject(parent),
    ui(new Ui::CollectionView),
    q(parent)
{

    ui->setupUi(q);

    ui->viewLayout->removeWidget(ui->collectionList);
    ui->viewLayout->removeWidget(ui->contentWidget);
    QSplitter *splitter = new QSplitter(q);
    splitter->setObjectName("__RecordItNow__Splitter1");
    splitter->addWidget(ui->collectionList);
    splitter->addWidget(ui->contentWidget);
    ui->viewLayout->addWidget(splitter);

    splitterList.append(splitter);

    ui->contentWidgetLayout->removeWidget(ui->searchWidget);
    ui->contentWidgetLayout->removeWidget(ui->collectionItemWidget);
    splitter = new QSplitter(q);
    splitter->setObjectName("__RecordItNow_Splitter2");
    splitter->setOrientation(Qt::Vertical);
    splitter->addWidget(ui->searchWidget);
    splitter->addWidget(ui->collectionItemWidget);
    ui->contentWidgetLayout->addWidget(splitter);

    splitterList.append(splitter);

    ui->collectionList->setButtons(CollectionListWidget::AddButton|CollectionListWidget::DeleteButton|
                                   CollectionListWidget::EditButton);

    layout = new QStackedLayout;
    layout->setSpacing(0);
    layout->setContentsMargins(4, 0, 4, 4);
    ui->collectionItemWidget->setLayout(layout);

    connect(ui->collectionList, SIGNAL(itemSelectionChanged()), this,
            SLOT(collectionSelectionChanged()));
    connect(layout, SIGNAL(currentChanged(int)), this, SLOT(currentCollectionListChanged(int)));

    searchList = new CollectionListWidget(q, true);
    searchList->setButtons(CollectionListWidget::PlayButton|CollectionListWidget::EditButton|
                           CollectionListWidget::DeleteButton);
    connect(searchList, SIGNAL(deleteRequested(RecordItNow::CollectionItem*)), q,
            SLOT(deleteItem(RecordItNow::CollectionItem*)));
    connect(searchList, SIGNAL(editRequested(RecordItNow::CollectionItem*)), q,
            SLOT(editItem(RecordItNow::CollectionItem*)));
    connect(searchList, SIGNAL(playRequested(RecordItNow::CollectionItem*)), q,
            SIGNAL(playRequested(RecordItNow::CollectionItem*)));
    connect(searchList, SIGNAL(uploadRequested(RecordItNow::CollectionItem*)), q,
            SIGNAL(uploadRquested(RecordItNow::CollectionItem*)));


    layout->addWidget(searchList);
    CollectionListWidgetItem *item = new CollectionListWidgetItem(0, searchList);
    item->setText(i18n("Search results"));
    item->setIcon(KIcon("system-search"));
    ui->collectionList->addItem(item);

    connect(ui->collectionList, SIGNAL(deleteRequested(RecordItNow::CollectionItem*)), q,
            SLOT(deleteItem(RecordItNow::CollectionItem*)));
    connect(ui->collectionList, SIGNAL(editRequested(RecordItNow::CollectionItem*)), q,
            SLOT(editItem(RecordItNow::CollectionItem*)));
    connect(ui->collectionList, SIGNAL(addRequested(RecordItNow::Collection*)), q,
            SLOT(createItem(RecordItNow::Collection*)));

    ui->searchWidget->setView(q);
    ui->searchWidget->setListWidget(searchList);
    connect(ui->searchWidget, SIGNAL(activated()), this, SLOT(activateSearchList()));

}
Beispiel #8
0
ApplicationWindow::ApplicationWindow()
    : QMainWindow()
{
    setWindowTitle("application main window");

    // init some values

    QFont boldfont;
    QLabel *label;
    QFrame *w;
    QVBoxLayout *box;

    appwin = this;
    currClient = NULL;
    dialog = NULL;
    plugins = NULL;

    // set a proper font & layout
    setFont(QFont("Helvetica", 8));

    // initialize two timer
    // timer.....waits for disconneting vrb clients

    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(timerDone()));

    // create the menus and toolbar buttons

    createMenubar();
    createToolbar();

    //make a central widget to contain the other widgets

    QSplitter *central = new QSplitter(Qt::Vertical, this);
    central->setObjectName("main");
    central->setOpaqueResize(true);

    // create a horizontal splitter window

    QSplitter *split = new QSplitter(Qt::Horizontal, central);
    split->setObjectName("top");
    split->setOpaqueResize(true);

    // create the table list for the left side
    // contains one entry for each vrb client

    w = new QFrame(split);
    w->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
    box = new QVBoxLayout(w);
    box->setMargin(5);

    table = new QTreeWidget(w);
    QStringList labels;
    labels << "Master"
           << "ID"
           << "Group"
           << "Host";
    labels << "User"
           << "Email"
           << "URL"
           << "IP";
    table->setHeaderLabels(labels);
    table->setMinimumSize(table->sizeHint());
    connect(table, SIGNAL(itemClicked(QTreeWidgetem *)),
            this, SLOT(showBPS(QTreeWidgetItem *)));
    connect(table, SIGNAL(rightButtonClicked(QTreeWidgetItem *, const QPoint &, int)),
            this, SLOT(popupCB(QTreeWidgetItem *, const QPoint &, int)));

    box->addWidget(table);

    // create the tabwidget for the right side

    createTabWidget(split);

    // create a message area for the bottom

    msgFrame = new QFrame(central);
    msgFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
    box = new QVBoxLayout(msgFrame);
    box->setMargin(5);
    label = new QLabel(msgFrame);
    label->setText("Message Area");
    label->setAlignment(Qt::AlignCenter);
    //label->setFont( boldfont );

    msg = new QTextEdit(msgFrame);
    box->addWidget(label);
    box->addWidget(msg);
    msgFrame->hide();

    // create a file browser

    browser = new VRBFileDialog(this);

    // create a popupmenu -- available for each vrb client in the table list

    popup = new VRBPopupMenu(table);
    popup->addAction("&Delete", this, SLOT(deleteItem()));
    popup->addAction("&Configure", this, SLOT(configItem()));

    // set a proper size

    setCentralWidget(central);
    resize(600, 450);
}
Vizkit3DWidget::Vizkit3DWidget( QWidget* parent,const QString &world_name,bool auto_update)
    : QWidget(parent)
    , env_plugin(NULL), pickHandler(new PickHandler())
{
    //create layout
    //objects will be owned by the parent widget (this)
    QVBoxLayout* layout = new QVBoxLayout;
    layout->setObjectName("main_layout");
    layout->setContentsMargins(2,2,2,2);
    QSplitter* splitter = new QSplitter(Qt::Horizontal);
    splitter->setObjectName("splitter");

    layout->addWidget(splitter);
    this->setLayout(layout);

    // set threading model
    setThreadingModel(osgViewer::CompositeViewer::SingleThreaded);

    if (getenv("VIZKIT_GL_DEBUG") && (std::string(getenv("VIZKIT_GL_DEBUG")) == "1"))
    {
        osg::setNotifyLevel(osg::DEBUG_INFO);
        setRealizeOperation(new EnableGLDebugOperation());
    }
    // disable the default setting of viewer.done() by pressing Escape.
    setKeyEventSetsDone(0);

    // create root scene node
    root = createSceneGraph(world_name);
    
    //create geode that will be used as marker for the current selection
    selectorGeode = new osg::Geode();
    osg::ShapeDrawable* sphere = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(), 0.2f));
    sphere->setColor(osg::Vec4(1.0f, 0.0f, 0.0f, 0.3f));
    sphere->getOrCreateStateSet()->setMode(GL_BLEND,osg::StateAttribute::ON);
    selectorGeode->addDrawable(sphere);
    osg::StateSet* set = selectorGeode->getOrCreateStateSet();
    set->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
    set->setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA ,GL_ONE_MINUS_SRC_ALPHA), osg::StateAttribute::ON); 

    // create osg widget
    QWidget* widget = addViewWidget(createGraphicsWindow(0,0,800,600), root);
    widget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
    widget->setObjectName(QString("View Widget"));
    splitter->addWidget(widget);

    // create propertyBrowserWidget
    QPropertyBrowserWidget *propertyBrowserWidget = new QPropertyBrowserWidget( parent );
    propertyBrowserWidget->setObjectName("PropertyBrowser");
    propertyBrowserWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
    propertyBrowserWidget->resize(200,600);
    splitter->addWidget(propertyBrowserWidget);

    // add config object to the property browser
    Vizkit3DConfig *config =  new Vizkit3DConfig(this);
    addProperties(config,NULL);

    //connect signals and slots
    connect(this, SIGNAL(addPlugins(QObject*,QObject*)), this, SLOT(addPluginIntern(QObject*,QObject*)));
    connect(this, SIGNAL(removePlugins(QObject*)), this, SLOT(removePluginIntern(QObject*)));
    connect(&_timer, SIGNAL(timeout()), this, SLOT(update()) );
    connect(pickHandler.get(), SIGNAL(pickedNodePath(const osg::NodePath&)), this, SLOT(pickNodePath(const osg::NodePath&)));

    current_frame = QString(root->getName().c_str());

    //start timer responsible for updating osg viewer
    if (auto_update)
        _timer.start(10);
}
Beispiel #10
0
//****************************************************************************
MainWindow::MainWindow (QWidget* parent, Qt::WFlags fl)
{
	
	
	// Setup the QRAP error handling system
	QRAP_SET_ALERT_CALLBACK((AlertCallback)(Qrap::MainWindowAlert));
	
	CreateActions();
	CreateMenus();
	CreateToolBars();
	CreateStatusBar();
	ReadSettings();
	
	// Create the clipboard
	clipboard = QApplication::clipboard();
	
	// Set the window title
	setWindowTitle("Q-Rap Database Interface");
	setWindowIcon(QIcon(":images/logo_icon.png"));
	
	// Check if there are any system preferences
	if(gDb.GetSetting("location")=="")
	{
//		gDb.SetSetting("location","DD.dddd");
		gDb.SetSetting("sensitivity","dBm");
		gDb.SetSetting("power","dBm");
		gDb.SetSetting("eirp","dBm");
		gDb.SetSetting("impedence","50");
		gDb.SetSetting("predictioneirp","explicit");
		gDb.SetSetting("location","DD:MM:SS");
		gDb.SetSetting("mode","normal");
		gDb.SetSetting("DisplayUnits","dBm");
		gDb.SetSetting("TechType","0:NULL");
		gDb.SetSetting("RqSN","8.00");
		gDb.SetSetting("FadeMargin","3.00");
		gDb.SetSetting("RxMin","-110.00");
		gDb.SetSetting("RqCiCo","9.00");
		gDb.SetSetting("RqCiad","-9.00");
		gDb.SetSetting("RqEbNo","8.00");
		gDb.SetSetting("kFactorServer","1.00");
		gDb.SetSetting("kFactorInt","2.5");
		gDb.SetSetting("UseClutter","false");
		gDb.SetSetting("BTLDir","/home/");
		gDb.SetSetting("OutputDir","/home");
		gDb.SetSetting("SiteSelectSense","150.00");
		gDb.SetSetting("PlotResolution","90.00");
		gDb.SetSetting("DownLink","true");
	} // if GetSetting(location)
	
//	QWidget* gridLayout_1 = new QWidget(this);
//	gridLayout_1->setObjectName(QString::fromUtf8("gridLayout_1"));
	//gridLayout_1->setGeometry(QRect(0,70,790,180));
//	setCentralWidget(gridLayout_1);
//	QGridLayout* gridLayout1 = new QGridLayout(gridLayout_1);
//	gridLayout1->setSpacing(6);
//	gridLayout1->setMargin(0);
//	gridLayout1->setObjectName(QString::fromUtf8("gridLayout1"));

	QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    	sizePolicy.setHorizontalStretch(200);
    	sizePolicy.setVerticalStretch(200);

    	QSplitter*  splitter;
	splitter = new QSplitter(this);
    	splitter->setObjectName(QString::fromUtf8("splitter"));
    	splitter->setOrientation(Qt::Horizontal);
	splitter->setOpaqueResize(true);
	splitter->setSizePolicy(sizePolicy);
    	sizePolicy.setHeightForWidth(splitter->sizePolicy().hasHeightForWidth());
	setCentralWidget(splitter);

	rapTab = new RapTab(splitter);
	rapTab->setGeometry(QRect(10,10,1550,450));
	rapTab->setMinimumSize(QSize(100, 100));
	rapTab->setSizePolicy(sizePolicy);
    	splitter->addWidget(rapTab);	

	Filter = new cFilter(splitter);
	Filter->setGeometry(QRect(10,10,350,450));
	Filter->setMinimumSize(QSize(100, 100));
	Filter->setSizePolicy(sizePolicy);
	splitter->addWidget(Filter);

	setMaximumHeight(700);
	showMaximized ();
	

//	QSpacerItem *spacerItem1 = new QSpacerItem(1, 90, QSizePolicy::Minimum, QSizePolicy::Minimum);
//    gridLayout1->addItem(spacerItem1, 0, 1, 1, 1);
	
	
//	QSpacerItem *spacerItem = new QSpacerItem(1, 400, QSizePolicy::Minimum, QSizePolicy::Maximum);
//    gridLayout1->addItem(spacerItem, 1, 1, 1, 1);
		
	// Create the main widget
//	CreateDockingTab(Body);
	
	
}
Beispiel #11
0
/* VaultShopMain */
VaultShopMain::VaultShopMain()
{
    // Basic Form Settings
    setWindowTitle("VaultShop " PLASMASHOP_VERSION);
    //setWindowIcon(QIcon(":/res/VaultShop.png"));

    // Set up actions
    fActions[kFileOpenVault] = new QAction(qStdIcon("document-open"), tr("&Load Vault..."), this);
    fActions[kFileSaveVault] = new QAction(qStdIcon("document-save"), tr("&Save Vault"), this);
    fActions[kFileExit] = new QAction(tr("E&xit"), this);
    fActions[kVaultOpenNode] = new QAction(tr("Subscribe to &Node..."), this);

    fActions[kNodeUnLink] = new QAction(tr("Remove"), this);
    fActions[kNodeLink] = new QAction(tr("Add Node..."), this);
    fActions[kNodeCreate] = new QAction(tr("Create Node"), this);
    fActions[kNodeUnsubscribe] = new QAction(tr("Un-subscribe"), this);
    //fActions[kNodeRenameVault] = new QAction(tr("Rename Vault..."), this);

    fActions[kFileOpenVault]->setShortcut(Qt::CTRL + Qt::Key_O);
    fActions[kFileSaveVault]->setShortcut(Qt::CTRL + Qt::Key_S);
    fActions[kFileExit]->setShortcut(Qt::ALT + Qt::Key_F4);
    fActions[kVaultOpenNode]->setShortcut(Qt::Key_F2);

    // Main Menus
    QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
    fileMenu->addAction(fActions[kFileOpenVault]);
    fileMenu->addAction(fActions[kFileSaveVault]);
    fileMenu->addSeparator();
    fileMenu->addAction(fActions[kFileExit]);

    QMenu* vaultMenu = menuBar()->addMenu(tr("&Vault"));
    vaultMenu->addAction(fActions[kVaultOpenNode]);

    // Toolbars
    QToolBar* fileTbar = addToolBar(tr("File Toolbar"));
    fileTbar->setObjectName("FileToolBar");
    fileTbar->addAction(fActions[kFileOpenVault]);
    fileTbar->addAction(fActions[kFileSaveVault]);
    statusBar();

    // Main Splitter
    QSplitter* splitter = new QSplitter(Qt::Horizontal, this);
    splitter->setObjectName("Splitter");

    // Node Browser
    fVaultTree = new QTreeWidget(splitter);
    fVaultTree->setUniformRowHeights(true);
    fVaultTree->setHeaderHidden(true);
    fVaultTree->setContextMenuPolicy(Qt::CustomContextMenu);

    // Property Editor
    fNodeTab = new QTabWidget(splitter);
    fGenericEditor = new QVaultNode(fNodeTab);
    fNodeTab->addTab(fGenericEditor, tr("Node Properties"));
    fCustomEditor = NULL;
    fSavEditor = NULL;
    fEditorTabPreference = 0;

    // Layout
    splitter->addWidget(fVaultTree);
    splitter->addWidget(fNodeTab);
    setCentralWidget(splitter);
    splitter->setSizes(QList<int>() << 160 << 320);

    // Global UI Signals
    connect(fActions[kFileExit], SIGNAL(triggered()), this, SLOT(close()));
    connect(fActions[kFileOpenVault], SIGNAL(triggered()), this, SLOT(openGame()));
    connect(fActions[kFileSaveVault], SIGNAL(triggered()), this, SLOT(performSave()));
    connect(fActions[kVaultOpenNode], SIGNAL(triggered()), this, SLOT(openNode()));
    connect(fActions[kNodeUnLink], SIGNAL(triggered()), this, SLOT(unlinkNode()));
    connect(fActions[kNodeLink], SIGNAL(triggered()), this, SLOT(linkNode()));
    connect(fActions[kNodeCreate], SIGNAL(triggered()), this, SLOT(createNode()));
    connect(fActions[kNodeUnsubscribe], SIGNAL(triggered()), this, SLOT(closeNode()));
    //connect(fActions[kNodeRenameVault], SIGNAL(triggered()), this, SLOT(renameVault()));

    connect(fVaultTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
            this, SLOT(treeItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
    connect(fVaultTree, SIGNAL(customContextMenuRequested(const QPoint&)),
            this, SLOT(treeContextMenu(const QPoint&)));
    connect(fNodeTab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
    connect(fGenericEditor, SIGNAL(typeModified()), this, SLOT(typeModified()));
    connect(this, SIGNAL(nodeChanged(unsigned int)), this, SLOT(refreshNode(unsigned int)));

    // Load UI Settings
    QSettings settings("PlasmaShop", "VaultShop");
    resize(settings.value("WinSize", QSize(480, 600)).toSize());
    if (settings.contains("WinPos"))
        move(settings.value("WinPos").toPoint());
    if (settings.value("WinMaximized", false).toBool())
        showMaximized();

    if (settings.contains("WinState"))
        restoreState(settings.value("WinState").toByteArray());

    fLastDir = settings.value("LastDir").toString();
    if (!fLastDir.isEmpty())
        loadGame(fLastDir);
}