Exemple #1
0
void ReadMail::init()
{
	setToolBarsMovable(FALSE);

	QPopupMenu* mailaction=new QPopupMenu(this);

	bar = new QToolBar(this);
	bar->setHorizontalStretchable( TRUE );

	menu = new QMenuBar( bar );

	viewMenu = new QPopupMenu(menu);
	menu->insertItem( tr( "&View" ), viewMenu);

	mailMenu = new QPopupMenu(menu);
	menu->insertItem( tr( "&Mail" ), mailMenu);

	bar = new QToolBar(this);

	downloadButton = new QAction( tr( "Download" ), Resource::loadPixmap( "mailit/download" ),QString::null, 0, this, 0 );
	connect(downloadButton, SIGNAL(activated()), this, SLOT(download()) );
  	downloadButton->setWhatsThis(tr("Click here to download the selected mail"));


	previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
	connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) );
	previousButton->addTo(bar);
	previousButton->addTo(viewMenu);
	previousButton->setWhatsThis(tr("Read the previous mail in the list"));

	nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 );
	connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) );
	nextButton->addTo(bar);
	nextButton->addTo(viewMenu);
	previousButton->setWhatsThis(tr("Read the next mail in the list"));

	attachmentButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "mailit/attach" ), QString::null, 0, this, 0 );
	connect( attachmentButton, SIGNAL( activated() ), this,
		SLOT( viewAttachments() ) );
	attachmentButton->addTo(bar);
	attachmentButton->addTo(viewMenu);
	attachmentButton->setWhatsThis(tr("Click here to add attachments to your mail"));

	plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "DocsIcon" ), QString::null, 0, this, 0, TRUE);
	connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) );
	plainTextButton->addTo(bar);
	plainTextButton->addTo(viewMenu);
	plainTextButton->setWhatsThis(tr("The mail view has 2 modes:\n"
	"<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>"
	"<LI><B>Plain</B> shows the mail as standard plain text</LI>"
	"Click here to switch between those view modes" ));

    	//reply dependant on viewing inbox
	replyButton = new QToolButton(Resource::loadPixmap("mailit/reply"),tr("reply"),tr("reply to mail"), this,SLOT(reply()),bar);
        QWhatsThis::add(replyButton,tr("Click here to reply to the selected mail\nPress and hold for more options."));
	replyButton->setPopup(mailaction);

	replyAllButton = new QAction( tr( "Reply all" ), Resource::loadPixmap( "mailit/reply" ),QString::null, 0, this, 0 );
	connect(replyAllButton, SIGNAL(activated()), this, SLOT(replyAll()));
	replyAllButton->setWhatsThis(tr("Click here to reply to the selected mail to CC: addresses also"));
	replyAllButton->addTo(mailaction);

	forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ),
	QString::null, 0, this, 0 );
	connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()));
	forwardButton->setWhatsThis(tr("Click here to forward the selected mail"));
	forwardButton->addTo(mailaction);


	deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
	connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
	deleteButton->addTo(bar);
	deleteButton->addTo(mailMenu);
	deleteButton->setWhatsThis(tr("Click here to remove the selected mail"));

	viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close()));

	emailView = new QTextView( this, "emailView" );

	setCentralWidget(emailView);

	mime = new QMimeSourceFactory();
	emailView->setMimeSourceFactory(mime);
}
	lineEdit()->setStyleSheet(QLatin1String("QLineEdit {background:transparent;}"));
	lineEdit()->installEventFilter(this);

	ToolBarWidget *toolBar = qobject_cast<ToolBarWidget*>(parent);

	if (toolBar && toolBar->getIdentifier() != ToolBarsManager::NavigationBar)
	{
		connect(toolBar, SIGNAL(windowChanged(Window*)), this, SLOT(setWindow(Window*)));
	}

	connect(SearchesManager::getInstance(), SIGNAL(searchEnginesModified()), this, SLOT(storeCurrentSearchEngine()));
	connect(SearchesManager::getInstance(), SIGNAL(searchEnginesModelModified()), this, SLOT(restoreCurrentSearchEngine()));
	connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant)));
	connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(currentIndexChanged(int)));
	connect(lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(queryChanged(QString)));
	connect(m_completer, SIGNAL(activated(QString)), this, SLOT(sendRequest(QString)));

	setWindow(window);
}

void SearchWidget::changeEvent(QEvent *event)
{
	QComboBox::changeEvent(event);

	if (event->type() == QEvent::LanguageChange && itemData(currentIndex(), Qt::AccessibleDescriptionRole).toString().isEmpty())
	{
		lineEdit()->setPlaceholderText(tr("Search using %1").arg(currentData(Qt::UserRole).toString()));
	}
}

void SearchWidget::paintEvent(QPaintEvent *event)
InputWidget::InputWidget(QWidget *parent)
    : AbstractItemView(parent),
    _networkId(0)
{
    ui.setupUi(this);
    connect(ui.ownNick, SIGNAL(activated(QString)), this, SLOT(changeNick(QString)));

    layout()->setAlignment(ui.ownNick, Qt::AlignBottom);
    layout()->setAlignment(ui.inputEdit, Qt::AlignBottom);
    layout()->setAlignment(ui.showStyleButton, Qt::AlignBottom);
    layout()->setAlignment(ui.styleFrame, Qt::AlignBottom);

    ui.styleFrame->setVisible(false);

    setFocusProxy(ui.inputEdit);
    ui.ownNick->setFocusProxy(ui.inputEdit);

    ui.ownNick->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    ui.ownNick->installEventFilter(new MouseWheelFilter(this));
    ui.inputEdit->installEventFilter(this);

    ui.inputEdit->setMinHeight(1);
    ui.inputEdit->setMaxHeight(5);
    ui.inputEdit->setMode(MultiLineEdit::MultiLine);
    ui.inputEdit->setPasteProtectionEnabled(true);

    ui.boldButton->setIcon(QIcon::fromTheme("format-text-bold"));
    ui.italicButton->setIcon(QIcon::fromTheme("format-text-italic"));
    ui.underlineButton->setIcon(QIcon::fromTheme("format-text-underline"));
    ui.textcolorButton->setIcon(QIcon::fromTheme("format-text-color"));
    ui.highlightcolorButton->setIcon(QIcon::fromTheme("format-fill-color"));
    ui.encryptionIconLabel->hide();

    _colorMenu = new QMenu();
    _colorFillMenu = new QMenu();

    QStringList names;
    names << tr("White") << tr("Black") << tr("Dark blue") << tr("Dark green") << tr("Red") << tr("Dark red") << tr("Dark magenta")  << tr("Orange")
          << tr("Yellow") << tr("Green") << tr("Dark cyan") << tr("Cyan") << tr("Blue") << tr("Magenta") << tr("Dark gray") << tr("Light gray");

    QPixmap pix(16, 16);
    for (int i = 0; i < inputLine()->mircColorMap().count(); i++) {
        pix.fill(inputLine()->mircColorMap().values()[i]);
        _colorMenu->addAction(pix, names[i])->setData(inputLine()->mircColorMap().keys()[i]);
        _colorFillMenu->addAction(pix, names[i])->setData(inputLine()->mircColorMap().keys()[i]);
    }

    pix.fill(Qt::transparent);
    _colorMenu->addAction(pix, tr("Clear Color"))->setData("");
    _colorFillMenu->addAction(pix, tr("Clear Color"))->setData("");

    ui.textcolorButton->setMenu(_colorMenu);
    connect(_colorMenu, SIGNAL(triggered(QAction *)), this, SLOT(colorChosen(QAction *)));
    ui.highlightcolorButton->setMenu(_colorFillMenu);
    connect(_colorFillMenu, SIGNAL(triggered(QAction *)), this, SLOT(colorHighlightChosen(QAction *)));

    new TabCompleter(ui.inputEdit);

    UiStyleSettings fs("Fonts");
    fs.notify("UseCustomInputWidgetFont", this, SLOT(setUseCustomFont(QVariant)));
    fs.notify("InputWidget", this, SLOT(setCustomFont(QVariant)));
    if (fs.value("UseCustomInputWidgetFont", false).toBool())
        setCustomFont(fs.value("InputWidget", QFont()));

    UiSettings s("InputWidget");

#ifdef HAVE_KDE4
    s.notify("EnableSpellCheck", this, SLOT(setEnableSpellCheck(QVariant)));
    setEnableSpellCheck(s.value("EnableSpellCheck", false));
#endif

    s.notify("EnableEmacsMode", this, SLOT(setEnableEmacsMode(QVariant)));
    setEnableEmacsMode(s.value("EnableEmacsMode", false));

    s.notify("ShowNickSelector", this, SLOT(setShowNickSelector(QVariant)));
    setShowNickSelector(s.value("ShowNickSelector", true));

    s.notify("ShowStyleButtons", this, SLOT(setShowStyleButtons(QVariant)));
    setShowStyleButtons(s.value("ShowStyleButtons", true));

    s.notify("EnablePerChatHistory", this, SLOT(setEnablePerChatHistory(QVariant)));
    setEnablePerChatHistory(s.value("EnablePerChatHistory", true));

    s.notify("MaxNumLines", this, SLOT(setMaxLines(QVariant)));
    setMaxLines(s.value("MaxNumLines", 5));

    s.notify("EnableScrollBars", this, SLOT(setScrollBarsEnabled(QVariant)));
    setScrollBarsEnabled(s.value("EnableScrollBars", true));

    s.notify("EnableLineWrap", this, SLOT(setLineWrapEnabled(QVariant)));
    setLineWrapEnabled(s.value("EnableLineWrap", true));

    s.notify("EnableMultiLine", this, SLOT(setMultiLineEnabled(QVariant)));
    setMultiLineEnabled(s.value("EnableMultiLine", true));

    ActionCollection *coll = QtUi::actionCollection();

    Action *activateInputline = coll->add<Action>("FocusInputLine");
    connect(activateInputline, SIGNAL(triggered()), SLOT(setFocus()));
    activateInputline->setText(tr("Focus Input Line"));
    activateInputline->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));

    connect(inputLine(), SIGNAL(textEntered(QString)), SLOT(onTextEntered(QString)), Qt::QueuedConnection); // make sure the line is already reset, bug #984
    connect(inputLine(), SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat)));
}
Exemple #4
0
void
TrackEditorTool::initToolWidget()
{
    //	prototypeListWidget->setMaximumWidth(156);

    QGridLayout *toolLayout = new QGridLayout;

    // ButtonGroup //
    //
    // A button group so only one button can be checked at a time
    QButtonGroup *toolGroup = new QButtonGroup;
    connect(toolGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleToolClick(int)));

    // Tools //
    //
    QPushButton *toolButton;
    int row = -1; // button row

    QLabel *trackLabel = new QLabel(tr("Track Tools"));
    toolLayout->addWidget(trackLabel, ++row, 0, 1, ColumnCount);

    //	toolButton = new QPushButton("Select");
    //	toolButton->setCheckable(true);
    //	toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount);
    //	toolGroup->addButton(toolButton, ODD::TTE_SELECT); // button, id

    toolButton = new QPushButton("Move Rotate");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0);
    toolGroup->addButton(toolButton, ODD::TTE_MOVE_ROTATE); // button, id

    toolButton = new QPushButton("Add Line");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0);
    toolGroup->addButton(toolButton, ODD::TTE_ADD_LINE); // button, id

    toolButton = new QPushButton("Add Curve");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, row, 1);
    toolGroup->addButton(toolButton, ODD::TTE_ADD_CURVE); // button, id
    //	toolButton->setChecked(true);

    toolButton = new QPushButton("Add Prototype");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount);
    toolGroup->addButton(toolButton, ODD::TTE_ADD); // button, id

    toolButton = new QPushButton("Delete Tracks");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount);
    toolGroup->addButton(toolButton, ODD::TTE_DELETE); // button, id

    toolButton = new QPushButton("Split Track");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount);
    toolGroup->addButton(toolButton, ODD::TTE_TRACK_SPLIT); // button, id

    QFrame *line = new QFrame();
    line->setFrameStyle(QFrame::HLine | QFrame::Sunken);
    line->setLineWidth(1);
    toolLayout->addWidget(line, ++row, 0, 1, ColumnCount);

    QLabel *roadLabel = new QLabel(tr("Road Tools"));
    toolLayout->addWidget(roadLabel, ++row, 0, 1, ColumnCount);

    toolButton = new QPushButton("Move Rotate");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0);
    toolGroup->addButton(toolButton, ODD::TTE_ROAD_MOVE_ROTATE); // button, id

    toolButton = new QPushButton("New Road");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount);
    toolGroup->addButton(toolButton, ODD::TTE_ROAD_NEW); // button, id

    toolButton = new QPushButton("Add Prototype");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount);
    toolGroup->addButton(toolButton, ODD::TTE_ROADSYSTEM_ADD); // button, id

    toolButton = new QPushButton("Delete Road");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount);
    toolGroup->addButton(toolButton, ODD::TTE_ROAD_DELETE); // button, id

    toolButton = new QPushButton("Split Road");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount);
    toolGroup->addButton(toolButton, ODD::TTE_ROAD_SPLIT); // button, id

    toolButton = new QPushButton("Merge");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0);
    toolGroup->addButton(toolButton, ODD::TTE_ROAD_MERGE); // button, id

    toolButton = new QPushButton("Snap to");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, row, 1);
    toolGroup->addButton(toolButton, ODD::TTE_ROAD_SNAP); // button, id

    line = new QFrame();
    line->setFrameStyle(QFrame::HLine | QFrame::Sunken);
    line->setLineWidth(1);
    toolLayout->addWidget(line, ++row, 0, 1, ColumnCount);

    toolButton = new QPushButton("Split Track and Road");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount);
    toolGroup->addButton(toolButton, ODD::TTE_TRACK_ROAD_SPLIT); // button, id

    // Tiles
    //

    line = new QFrame();
    line->setFrameStyle(QFrame::HLine | QFrame::Sunken);
    line->setLineWidth(1);
    toolLayout->addWidget(line, ++row, 0, 1, ColumnCount);

    roadLabel = new QLabel(tr("Tile Tools"));
    toolLayout->addWidget(roadLabel, ++row, 0, 1, ColumnCount);

    toolButton = new QPushButton("Move Tile");
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0);
    toolGroup->addButton(toolButton, ODD::TTE_TILE_MOVE); // button, id

    toolButton = new QPushButton("New Tile");
    toolButton->setCheckable(false);
    toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount);
    toolGroup->addButton(toolButton, ODD::TTE_TILE_NEW); // button, id

    toolButton = new QPushButton("Delete Tile");
    toolButton->setCheckable(false);
    toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount);
    toolGroup->addButton(toolButton, ODD::TTE_TILE_DELETE); // button, id

    // Prototypes //
    //
    //
    QGridLayout *groupBoxLayout;
    QLabel *label;
    QComboBox *comboBox;

    // Track Prototypes //
    //
    //
    groupBoxLayout = new QGridLayout;

    trackPrototypesGroupBox_ = new QGroupBox(tr("Track Settings"));
    trackPrototypesGroupBox_->setLayout(groupBoxLayout);
    trackPrototypesGroupBox_->setEnabled(false);
    toolLayout->addWidget(trackPrototypesGroupBox_, ++row, 0, 1, ColumnCount);

    label = new QLabel(tr("Track Prototype"));
    comboBox = new QComboBox;
    foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_TrackPrototype))
    {
        comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName());
    }
    comboBox->setIconSize(QSize(16, 16));
    connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleTrackSelection(int)));
    comboBox->setCurrentIndex(0); // this doesn't trigger an event...
    handleTrackSelection(0); // ... so do it yourself
    groupBoxLayout->addWidget(label, 0, 0);
    groupBoxLayout->addWidget(comboBox, 1, 0);

    // Section Prototypes //
    //
    //
    groupBoxLayout = new QGridLayout;

    sectionPrototypesGroupBox_ = new QGroupBox(tr("Section Settings"));
    sectionPrototypesGroupBox_->setLayout(groupBoxLayout);
    sectionPrototypesGroupBox_->setEnabled(false);
    toolLayout->addWidget(sectionPrototypesGroupBox_, ++row, 0, 1, ColumnCount);

    int groupBoxLayoutRow = 0;

    // LaneSection Prototype //
    //
    label = new QLabel(tr("LaneSection Prototype"));
    comboBox = new QComboBox;
    foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_LaneSectionPrototype))
    {
        comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName());
    }
    comboBox->setIconSize(QSize(16, 16));
    connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleLaneSectionSelection(int)));
    comboBox->setCurrentIndex(0);
    handleLaneSectionSelection(0);
    groupBoxLayout->addWidget(label, groupBoxLayoutRow++, 0);
    groupBoxLayout->addWidget(comboBox, groupBoxLayoutRow++, 0);

    // RoadType Prototype //
    //
    label = new QLabel(tr("RoadType Prototype"));
    comboBox = new QComboBox;
    foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_RoadTypePrototype))
    {
        comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName());
    }
    comboBox->setIconSize(QSize(16, 16));
    connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleRoadTypeSelection(int)));
    comboBox->setCurrentIndex(0);
    handleRoadTypeSelection(0);
    groupBoxLayout->addWidget(label, groupBoxLayoutRow++, 0);
    groupBoxLayout->addWidget(comboBox, groupBoxLayoutRow++, 0);

    // Elevation Prototype //
    //
    label = new QLabel(tr("Elevation Prototype"));
    comboBox = new QComboBox;
    foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_ElevationPrototype))
    {
        comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName());
    }
    comboBox->setIconSize(QSize(16, 16));
    connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleElevationSelection(int)));
    comboBox->setCurrentIndex(0);
    handleElevationSelection(0);
    groupBoxLayout->addWidget(label, groupBoxLayoutRow++, 0);
    groupBoxLayout->addWidget(comboBox, groupBoxLayoutRow++, 0);

    // Superelevation Prototype //
    //
    label = new QLabel(tr("Superelevation Prototype"));
    comboBox = new QComboBox;
    foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_SuperelevationPrototype))
    {
        comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName());
    }
    comboBox->setIconSize(QSize(16, 16));
    connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSuperelevationSelection(int)));
    comboBox->setCurrentIndex(0);
    handleSuperelevationSelection(0);
    groupBoxLayout->addWidget(label, groupBoxLayoutRow++, 0);
    groupBoxLayout->addWidget(comboBox, groupBoxLayoutRow++, 0);

    // Crossfall Prototype //
    //
    label = new QLabel(tr("Crossfall Prototype"));
    comboBox = new QComboBox;
    foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_CrossfallPrototype))
    {
        comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName());
    }
    comboBox->setIconSize(QSize(16, 16));
    connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleCrossfallSelection(int)));
    comboBox->setCurrentIndex(0);
    handleCrossfallSelection(0);
    groupBoxLayout->addWidget(label, groupBoxLayoutRow++, 0);
    groupBoxLayout->addWidget(comboBox, groupBoxLayoutRow++, 0);

    // RoadSystem Prototypes //
    //
    //
    groupBoxLayout = new QGridLayout;

    roadSystemPrototypesGroupBox_ = new QGroupBox(tr("RoadSystem Settings"));
    roadSystemPrototypesGroupBox_->setLayout(groupBoxLayout);
    roadSystemPrototypesGroupBox_->setEnabled(false);
    toolLayout->addWidget(roadSystemPrototypesGroupBox_, ++row, 0, 1, ColumnCount);

    label = new QLabel(tr("RoadSystem Prototype"));
    comboBox = new QComboBox;
    foreach (const PrototypeContainer<RoadSystem *> *container, prototypeManager_->getRoadSystemPrototypes())
    {
        comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName());
    }
    comboBox->setIconSize(QSize(16, 16));
    connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleRoadSystemSelection(int)));
    comboBox->setCurrentIndex(0);
    handleRoadSystemSelection(0);
    groupBoxLayout->addWidget(label, 0, 0);
    groupBoxLayout->addWidget(comboBox, 1, 0);

    // Finish Layout //
    //
    toolLayout->setRowStretch(++row, 1); // row x fills the rest of the availlable space
    toolLayout->setColumnStretch(ColumnCount, 1); // column 2 fills the rest of the availlable space

    // Widget/Layout //
    //
    ToolWidget *toolWidget = new ToolWidget();
    toolWidget->setLayout(toolLayout);
    toolManager_->addToolBoxWidget(toolWidget, tr("Track Editor"));
    connect(toolWidget, SIGNAL(activated()), this, SLOT(activateEditor()));

    // Default Settings //
    //
    sectionPrototypesGroupBox_->setVisible(false);
    trackPrototypesGroupBox_->setVisible(false);
    roadSystemPrototypesGroupBox_->setVisible(false);
}
Exemple #5
0
QDBusViewer::QDBusViewer(const QDBusConnection &connection, QWidget *parent)  :
    QWidget(parent),
    c(connection),
    objectPathRegExp(QLatin1String("\\[ObjectPath: (.*)\\]"))
{
    servicesModel = new QStringListModel(this);
    servicesFilterModel = new QSortFilterProxyModel(this);
    servicesFilterModel->setSourceModel(servicesModel);
    servicesFilterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    serviceFilterLine = new QLineEdit(this);
    serviceFilterLine->setPlaceholderText(tr("Search..."));
    servicesView = new QListView(this);
    servicesView->setModel(servicesFilterModel);

    connect(serviceFilterLine, SIGNAL(textChanged(QString)), servicesFilterModel, SLOT(setFilterFixedString(QString)));

    tree = new QTreeView;
    tree->setContextMenuPolicy(Qt::CustomContextMenu);

    connect(tree, SIGNAL(activated(QModelIndex)), this, SLOT(activate(QModelIndex)));

    refreshAction = new QAction(tr("&Refresh"), tree);
    refreshAction->setData(42); // increase the amount of 42 used as magic number by one
    refreshAction->setShortcut(QKeySequence::Refresh);
    connect(refreshAction, SIGNAL(triggered()), this, SLOT(refreshChildren()));

    QShortcut *refreshShortcut = new QShortcut(QKeySequence::Refresh, tree);
    connect(refreshShortcut, SIGNAL(activated()), this, SLOT(refreshChildren()));

    QVBoxLayout *layout = new QVBoxLayout(this);
    QSplitter *topSplitter = new QSplitter(Qt::Vertical, this);
    layout->addWidget(topSplitter);

    log = new QTextBrowser;
    connect(log, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));

    QSplitter *splitter = new QSplitter(topSplitter);
    splitter->addWidget(servicesView);

    QWidget *servicesWidget = new QWidget;
    QVBoxLayout *servicesLayout = new QVBoxLayout(servicesWidget);
    servicesLayout->addWidget(serviceFilterLine);
    servicesLayout->addWidget(servicesView);
    splitter->addWidget(servicesWidget);
    splitter->addWidget(tree);

    topSplitter->addWidget(splitter);
    topSplitter->addWidget(log);

    connect(servicesView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
            this, SLOT(serviceChanged(QModelIndex)));
    connect(tree, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(showContextMenu(QPoint)));

    QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection);

    if (c.isConnected()) {
        logMessage(QLatin1String("Connected to D-Bus."));
        QDBusConnectionInterface *iface = c.interface();
        connect(iface, SIGNAL(serviceRegistered(QString)),
                this, SLOT(serviceRegistered(QString)));
        connect(iface, SIGNAL(serviceUnregistered(QString)),
                this, SLOT(serviceUnregistered(QString)));
        connect(iface, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
                this, SLOT(serviceOwnerChanged(QString,QString,QString)));
    } else {
        logError(QLatin1String("Cannot connect to D-Bus: ") + c.lastError().message());
    }

    objectPathRegExp.setMinimal(true);

}
Exemple #6
0
void WComboBox::propagateChange()
{
  emit activated(currentIndex_);
  emit activated(items_[currentIndex_]);
}
void NewClassWidget::slotActivated()
{
    if (m_d->m_valid) {
        emit activated();
    }
}
ConstraintActivitiesOccupyMaxTimeSlotsFromSelectionForm::ConstraintActivitiesOccupyMaxTimeSlotsFromSelectionForm(QWidget* parent): QDialog(parent)
{
	setupUi(this);

	currentConstraintTextEdit->setReadOnly(true);

	modifyConstraintPushButton->setDefault(true);

	constraintsListWidget->setSelectionMode(QAbstractItemView::SingleSelection);

	connect(constraintsListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(constraintChanged(int)));
	connect(addConstraintPushButton, SIGNAL(clicked()), this, SLOT(addConstraint()));
	connect(closePushButton, SIGNAL(clicked()), this, SLOT(close()));
	connect(removeConstraintPushButton, SIGNAL(clicked()), this, SLOT(removeConstraint()));
	connect(modifyConstraintPushButton, SIGNAL(clicked()), this, SLOT(modifyConstraint()));
	connect(constraintsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(modifyConstraint()));

	connect(teachersComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
	connect(studentsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
	connect(subjectsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));
	connect(activityTagsComboBox, SIGNAL(activated(QString)), this, SLOT(filterChanged()));

	connect(helpPushButton, SIGNAL(clicked()), this, SLOT(help()));

	centerWidgetOnScreen(this);
	restoreFETDialogGeometry(this);

	QSize tmp1=teachersComboBox->minimumSizeHint();
	Q_UNUSED(tmp1);
	QSize tmp2=studentsComboBox->minimumSizeHint();
	Q_UNUSED(tmp2);
	QSize tmp3=subjectsComboBox->minimumSizeHint();
	Q_UNUSED(tmp3);
	QSize tmp4=activityTagsComboBox->minimumSizeHint();
	Q_UNUSED(tmp4);
	
/////////////
	teachersComboBox->addItem("");
	for(int i=0; i<gt.rules.teachersList.size(); i++){
		Teacher* tch=gt.rules.teachersList[i];
		teachersComboBox->addItem(tch->name);
	}
	teachersComboBox->setCurrentIndex(0);

	subjectsComboBox->addItem("");
	for(int i=0; i<gt.rules.subjectsList.size(); i++){
		Subject* sb=gt.rules.subjectsList[i];
		subjectsComboBox->addItem(sb->name);
	}
	subjectsComboBox->setCurrentIndex(0);

	activityTagsComboBox->addItem("");
	for(int i=0; i<gt.rules.activityTagsList.size(); i++){
		ActivityTag* st=gt.rules.activityTagsList[i];
		activityTagsComboBox->addItem(st->name);
	}
	activityTagsComboBox->setCurrentIndex(0);

	studentsComboBox->addItem("");
	for(int i=0; i<gt.rules.yearsList.size(); i++){
		StudentsYear* sty=gt.rules.yearsList[i];
		studentsComboBox->addItem(sty->name);
		for(int j=0; j<sty->groupsList.size(); j++){
			StudentsGroup* stg=sty->groupsList[j];
			studentsComboBox->addItem(stg->name);
			for(int k=0; k<stg->subgroupsList.size(); k++){
				StudentsSubgroup* sts=stg->subgroupsList[k];
				studentsComboBox->addItem(sts->name);
			}
		}
	}
	studentsComboBox->setCurrentIndex(0);
///////////////

	this->filterChanged();
}
Exemple #9
0
void
QvisPredefinedViewports::emitActivated(QAction *a)
{
    emit activated(menu->actions().indexOf(a));
}
Exemple #10
0
void PicFlowView::playItem( int i_item )
{
    emit activated( model()->index(i_item, 0) );
}
GammaWidget::GammaWidget(QWidget *parent) : QWidget(parent), ui(new Ui::GammaWidget)
{
    ui->setupUi(this);

    connect(ui->slider_gamma, SIGNAL(valueChanged(int)), this, SLOT(gammaChanged(int)));
    connect(ui->spinBox_gamma, SIGNAL(valueChanged(double)), this, SLOT(gammaChanged(double)));
    connect(ui->checkBox_CRF, SIGNAL(stateChanged(int)), this, SLOT(CRFChanged(int)));
    connect(ui->combo_CRF_List, SIGNAL(activated(QString)), this, SLOT(SetCRFPreset(QString)));

    ui->combo_CRF_List->addItem(tr("External..."));

    addPreset("Advantix 100", "Advantix_100CD");
    addPreset("Advantix 200", "Advantix_200CD");
    addPreset("Advantix 400", "Advantix_400CD");
    addPreset("Agfachrome CTPrecisa 200", "Agfachrome_ctpecisa_200CD");
    addPreset("Agfachrome CTPrecisa 100", "Agfachrome_ctprecisa_100CD");
    addPreset("Agfachrome rsx2 050", "Agfachrome_rsx2_050CD");
    addPreset("Agfachrome rsx2 100", "Agfachrome_rsx2_100CD");
    addPreset("Agfachrome rsx2 200", "Agfachrome_rsx2_200CD");
    addPreset("Agfacolor Futura 100", "Agfacolor_futura_100CD");
    addPreset("Agfacolor Futura 200", "Agfacolor_futura_200CD");
    addPreset("Agfacolor Futura 400", "Agfacolor_futura_400CD");
    addPreset("Agfacolor Futura II 100", "Agfacolor_futuraII_100CD");
    addPreset("Agfacolor Futura II 200", "Agfacolor_futuraII_200CD");
    addPreset("Agfacolor Futura II 400", "Agfacolor_futuraII_400CD");
    addPreset("Agfacolor HDC 100 Plus", "Agfacolor_hdc_100_plusCD");
    addPreset("Agfacolor HDC 200 Plus", "Agfacolor_hdc_200_plusCD");
    addPreset("Agfacolor HDC 400 Plus", "Agfacolor_hdc_400_plusCD");
    addPreset("Agfacolor Optima II 100", "Agfacolor_optimaII_100CD");
    addPreset("Agfacolor Optima II 200", "Agfacolor_optimaII_200CD");
    addPreset("Agfacolor Ultra 050", "Agfacolor_ultra_050_CD");
    addPreset("Agfacolor Vista 100", "Agfacolor_vista_100CD");
    addPreset("Agfacolor Vista 200", "Agfacolor_vista_200CD");
    addPreset("Agfacolor Vista 400", "Agfacolor_vista_400CD");
    addPreset("Agfacolor Vista 800", "Agfacolor_vista_800CD");
    addPreset("Agfapan APX 025 (B&W)", "Agfapan_apx_025CD");
    addPreset("Agfapan APX 100 (B&W)", "Agfapan_apx_100CD");
    addPreset("Agfapan APX 400 (B&W)", "Agfapan_apx_400CD");
    addPreset("Ektachrome 100 Plus (Color Rev.)", "Ektachrome_100_plusCD");
    addPreset("Ektachrome 100 (Color Rev.)", "Ektachrome_100CD");
    addPreset("Ektachrome 320T (Color Rev.)", "Ektachrome_320TCD");
    addPreset("Ektachrome 400X (Color Rev.)", "Ektachrome_400XCD");
    addPreset("Ektachrome 64 (Color Rev.)", "Ektachrome_64CD");
    addPreset("Ektachrome 64T (Color Rev.)", "Ektachrome_64TCD");
    addPreset("Ektachrome E100S", "Ektachrome_E100SCD");
    addPreset("Fujifilm Cine F-125", "F125CD");
    addPreset("Fujifilm Cine F-250", "F250CD");
    addPreset("Fujifilm Cine F-400", "F400CD");
    addPreset("Fujifilm Cine FCI", "FCICD");
    addPreset("Kodak Gold 100", "Gold_100CD");
    addPreset("Kodak Gold 200", "Gold_200CD");
    addPreset("Kodachrome 200", "Kodachrome_200CD");
    addPreset("Kodachrome 25", "Kodachrome_25CD");
    addPreset("Kodachrome 64", "Kodachrome_64CD");
    addPreset("Kodak Max Zoom 800", "Max_Zoom_800CD");
    addPreset("Kodak Portra 100T", "Portra_100TCD");
    addPreset("Kodak Portra 160NC", "Portra_160NCCD");
    addPreset("Kodak Portra 160VC", "Portra_160VCCD");
    addPreset("Kodak Portra 400NC", "Portra_400NCCD");
    addPreset("Kodak Portra 400VC", "Portra_400VCCD");
    addPreset("Kodak Portra 800", "Portra_800CD");
}
AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<RssManager>& manager, QWidget *parent) :
  QDialog(parent),
  ui(new Ui::AutomatedRssDownloader),
  m_manager(manager), m_editedRule(0)
{
  ui->setupUi(this);
  // Icons
  ui->removeRuleBtn->setIcon(IconProvider::instance()->getIcon("list-remove"));
  ui->addRuleBtn->setIcon(IconProvider::instance()->getIcon("list-add"));

  // Ui Settings
  ui->listRules->setSortingEnabled(true);
  ui->listRules->setSelectionMode(QAbstractItemView::ExtendedSelection);
  ui->treeMatchingArticles->setSortingEnabled(true);
  ui->hsplitter->setCollapsible(0, false);
  ui->hsplitter->setCollapsible(1, false);
  ui->hsplitter->setCollapsible(2, true); // Only the preview list is collapsible
  bool ok; Q_UNUSED(ok);
  ok = connect(ui->checkRegex, SIGNAL(toggled(bool)), SLOT(updateFieldsToolTips(bool)));
  Q_ASSERT(ok);
  ok = connect(ui->listRules, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayRulesListMenu(const QPoint&)));
  Q_ASSERT(ok);
  m_ruleList = manager.toStrongRef()->downloadRules();
  m_editableRuleList = new RssDownloadRuleList; // Read rule list from disk
  initLabelCombobox();
  loadFeedList();
  loadSettings();
  ok = connect(ui->listRules, SIGNAL(itemSelectionChanged()), SLOT(updateRuleDefinitionBox()));
  Q_ASSERT(ok);
  ok = connect(ui->listRules, SIGNAL(itemSelectionChanged()), SLOT(updateFeedList()));
  Q_ASSERT(ok);
  ok = connect(ui->listFeeds, SIGNAL(itemChanged(QListWidgetItem*)), SLOT(handleFeedCheckStateChange(QListWidgetItem*)));
  Q_ASSERT(ok);
  // Update matching articles when necessary
  ok = connect(ui->lineContains, SIGNAL(textEdited(QString)), SLOT(updateMatchingArticles()));
  Q_ASSERT(ok);
  ok = connect(ui->lineContains, SIGNAL(textEdited(QString)), SLOT(updateMustLineValidity()));
  Q_ASSERT(ok);
  ok = connect(ui->lineNotContains, SIGNAL(textEdited(QString)), SLOT(updateMatchingArticles()));
  Q_ASSERT(ok);
  ok = connect(ui->lineNotContains, SIGNAL(textEdited(QString)), SLOT(updateMustNotLineValidity()));
  Q_ASSERT(ok);
  ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMatchingArticles()));
  Q_ASSERT(ok);
  ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMustLineValidity()));
  Q_ASSERT(ok);
  ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMustNotLineValidity()));
  Q_ASSERT(ok);
  ok = connect(this, SIGNAL(finished(int)), SLOT(on_finished(int)));
  Q_ASSERT(ok);
  editHotkey = new QShortcut(QKeySequence("F2"), ui->listRules, 0, 0, Qt::WidgetShortcut);
  ok = connect(editHotkey, SIGNAL(activated()), SLOT(renameSelectedRule()));
  Q_ASSERT(ok);
  ok = connect(ui->listRules, SIGNAL(doubleClicked(QModelIndex)), SLOT(renameSelectedRule()));
  Q_ASSERT(ok);
  deleteHotkey = new QShortcut(QKeySequence(QKeySequence::Delete), ui->listRules, 0, 0, Qt::WidgetShortcut);
  ok = connect(deleteHotkey, SIGNAL(activated()), SLOT(on_removeRuleBtn_clicked()));
  Q_ASSERT(ok);
  updateRuleDefinitionBox();
  updateFeedList();
}
Exemple #13
0
PageRecord::PageRecord(MainWindow* main_window)
	: QWidget(main_window->centralWidget()) {

	m_main_window = main_window;

	m_page_started = false;
	m_input_started = false;
	m_output_started = false;
	m_previewing = false;

	m_last_error_sound = std::numeric_limits<int64_t>::min();

	QGroupBox *groupbox_recording = new QGroupBox(tr("Recording"), this);
	{
		m_pushbutton_start_pause = new QPushButton(groupbox_recording);

		m_checkbox_hotkey_enable = new QCheckBox(tr("Enable recording hotkey"), groupbox_recording);
		m_checkbox_sound_notifications_enable = new QCheckBox(tr("Enable sound notifications"), groupbox_recording);
		QLabel *label_hotkey = new QLabel(tr("Hotkey:"), groupbox_recording);
		m_checkbox_hotkey_ctrl = new QCheckBox(tr("Ctrl +"), groupbox_recording);
		m_checkbox_hotkey_shift = new QCheckBox(tr("Shift +"), groupbox_recording);
		m_checkbox_hotkey_alt = new QCheckBox(tr("Alt +"), groupbox_recording);
		m_checkbox_hotkey_super = new QCheckBox(tr("Super +"), groupbox_recording);
		m_combobox_hotkey_key = new QComboBox(groupbox_recording);
		m_combobox_hotkey_key->setToolTip(tr("The key that you have to press (combined with the given modifiers) to start or pause recording.\n"
											 "The program that you are recording will not receive the key press."));
		// Note: The choice of keys is currently rather limited, because capturing key presses session-wide is a bit harder than it looks.
		// For example, applications are not allowed to capture the F1-F12 keys (on Ubuntu at least). The A-Z keys don't have this limitation apparently.
		for(unsigned int i = 0; i < 26; ++i) {
			m_combobox_hotkey_key->addItem(QString('A' + i));
		}

		connect(m_pushbutton_start_pause, SIGNAL(clicked()), this, SLOT(OnRecordStartPause()));
		connect(m_checkbox_hotkey_enable, SIGNAL(clicked()), this, SLOT(OnUpdateHotkeyFields()));
		connect(m_checkbox_sound_notifications_enable, SIGNAL(clicked()), this, SLOT(OnUpdateSoundNotifications()));
		connect(m_checkbox_hotkey_ctrl, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_shift, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_alt, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_super, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_combobox_hotkey_key, SIGNAL(activated(int)), this, SLOT(OnUpdateHotkey()));

		QVBoxLayout *layout = new QVBoxLayout(groupbox_recording);
		layout->addWidget(m_pushbutton_start_pause);
		{
			QHBoxLayout *layout2 = new QHBoxLayout();
			layout->addLayout(layout2);
			layout2->addWidget(m_checkbox_hotkey_enable);
			layout2->addWidget(m_checkbox_sound_notifications_enable);
		}
		{
			QHBoxLayout *layout2 = new QHBoxLayout();
			layout->addLayout(layout2);
			layout2->addWidget(label_hotkey);
			layout2->addWidget(m_checkbox_hotkey_ctrl);
			layout2->addWidget(m_checkbox_hotkey_shift);
			layout2->addWidget(m_checkbox_hotkey_alt);
			layout2->addWidget(m_checkbox_hotkey_super);
			layout2->addWidget(m_combobox_hotkey_key);
		}
	}
	QSplitter *splitter_vertical = new QSplitter(Qt::Vertical, this);
	{
		QSplitter *splitter_horizontal = new QSplitter(Qt::Horizontal, splitter_vertical);
		{
			QGroupBox *groupbox_information = new QGroupBox(tr("Information"), splitter_horizontal);
			{
				QLabel *label_total_time = new QLabel(tr("Total time:"), groupbox_information);
				m_label_info_total_time = new QLabel(groupbox_information);
				QLabel *label_frame_rate_in = new QLabel(tr("FPS in:"), groupbox_information);
				m_label_info_frame_rate_in = new QLabel(groupbox_information);
				QLabel *label_frame_rate_out = new QLabel(tr("FPS out:"), groupbox_information);
				m_label_info_frame_rate_out = new QLabel(groupbox_information);
				QLabel *label_size_in = new QLabel(tr("Size in:"), groupbox_information);
				m_label_info_size_in = new QLabel(groupbox_information);
				QLabel *label_size_out = new QLabel(tr("Size out:"), groupbox_information);
				m_label_info_size_out = new QLabel(groupbox_information);
				QLabel *label_file_name = new QLabel(tr("File name:"), groupbox_information);
				m_label_info_file_name = new ElidedLabel(QString(), Qt::ElideMiddle, groupbox_information);
				m_label_info_file_name->setMinimumWidth(100);
				QLabel *label_file_size = new QLabel(tr("File size:"), groupbox_information);
				m_label_info_file_size = new QLabel(groupbox_information);
				QLabel *label_bit_rate = new QLabel(tr("Bit rate:"), groupbox_information);
				m_label_info_bit_rate = new QLabel(groupbox_information);

				QGridLayout *layout = new QGridLayout(groupbox_information);
				layout->addWidget(label_total_time, 0, 0);
				layout->addWidget(m_label_info_total_time, 0, 1);
				layout->addWidget(label_frame_rate_in, 1, 0);
				layout->addWidget(m_label_info_frame_rate_in, 1, 1);
				layout->addWidget(label_frame_rate_out, 2, 0);
				layout->addWidget(m_label_info_frame_rate_out, 2, 1);
				layout->addWidget(label_size_in, 3, 0);
				layout->addWidget(m_label_info_size_in, 3, 1);
				layout->addWidget(label_size_out, 4, 0);
				layout->addWidget(m_label_info_size_out, 4, 1);
				layout->addWidget(label_file_name, 5, 0);
				layout->addWidget(m_label_info_file_name, 5, 1);
				layout->addWidget(label_file_size, 6, 0);
				layout->addWidget(m_label_info_file_size, 6, 1);
				layout->addWidget(label_bit_rate, 7, 0);
				layout->addWidget(m_label_info_bit_rate, 7, 1);
				layout->setColumnStretch(1, 1);
				layout->setRowStretch(8, 1);
			}
			QGroupBox *groupbox_preview = new QGroupBox(tr("Preview"), splitter_horizontal);
			{
				m_preview_page1 = new QWidget(groupbox_preview);
				{
					QLabel *label_preview_frame_rate = new QLabel(tr("Preview frame rate:"), m_preview_page1);
					m_spinbox_preview_frame_rate = new QSpinBox(m_preview_page1);
					m_spinbox_preview_frame_rate->setRange(1, 1000);
					m_spinbox_preview_frame_rate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
					QLabel *label_preview_note = new QLabel(tr("Note: Previewing requires extra CPU time (especially at high frame rates)."), m_preview_page1);
					label_preview_note->setWordWrap(true);
					label_preview_note->setAlignment(Qt::AlignLeft | Qt::AlignTop);
					label_preview_note->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::MinimumExpanding);

					QGridLayout *layout = new QGridLayout(m_preview_page1);
					layout->setMargin(0);
					layout->addWidget(label_preview_frame_rate, 0, 0);
					layout->addWidget(m_spinbox_preview_frame_rate, 0, 1);
					layout->addWidget(label_preview_note, 1, 0, 1, 2);
				}
				m_preview_page2 = new QWidget(groupbox_preview);
				{
					m_video_previewer = new VideoPreviewer(m_preview_page2);
					m_label_mic_icon = new QLabel(m_preview_page2);
					m_label_mic_icon->setPixmap(g_icon_microphone.pixmap(24, 24));
					m_audio_previewer = new AudioPreviewer(m_preview_page2);

					QVBoxLayout *layout = new QVBoxLayout(m_preview_page2);
					layout->setMargin(0);
					layout->addWidget(m_video_previewer);
					{
						QHBoxLayout *layout2 = new QHBoxLayout();
						layout->addLayout(layout2);
						layout2->addStretch();
						layout2->addWidget(m_label_mic_icon);
						layout2->addWidget(m_audio_previewer);
						layout2->addStretch();
					}
				}
				m_pushbutton_preview_start_stop = new QPushButton(groupbox_preview);

				connect(m_pushbutton_preview_start_stop, SIGNAL(clicked()), this, SLOT(OnPreviewStartStop()));

				QVBoxLayout *layout = new QVBoxLayout(groupbox_preview);
				{
					m_stacked_layout_preview = new QStackedLayout();
					layout->addLayout(m_stacked_layout_preview);
					m_stacked_layout_preview->addWidget(m_preview_page1);
					m_stacked_layout_preview->addWidget(m_preview_page2);
				}
				layout->addWidget(m_pushbutton_preview_start_stop);
			}

			splitter_horizontal->addWidget(groupbox_information);
			splitter_horizontal->addWidget(groupbox_preview);
			splitter_horizontal->setStretchFactor(0, 1);
			splitter_horizontal->setStretchFactor(1, 3);
		}
		QGroupBox *groupbox_log = new QGroupBox(tr("Log"), splitter_vertical);
		{
			m_textedit_log = new QTextEditSmall(groupbox_log);
			m_textedit_log->setReadOnly(true);

			QVBoxLayout *layout = new QVBoxLayout(groupbox_log);
			layout->addWidget(m_textedit_log);
		}

		splitter_vertical->addWidget(splitter_horizontal);
		splitter_vertical->addWidget(groupbox_log);
		splitter_vertical->setStretchFactor(0, 3);
		splitter_vertical->setStretchFactor(1, 1);
	}

	QPushButton *button_cancel = new QPushButton(g_icon_cancel, tr("Cancel recording"), this);
	QPushButton *button_save = new QPushButton(g_icon_save, tr("Save recording"), this);

	if(g_option_systray) {
		m_systray_icon = new QSystemTrayIcon(g_icon_ssr, m_main_window);
		QMenu *menu = new QMenu(m_main_window);
		m_systray_action_start_pause = menu->addAction(QString(), this, SLOT(OnRecordStartPause()));
		m_systray_action_start_pause->setIconVisibleInMenu(true);
		m_systray_action_cancel = menu->addAction(g_icon_cancel, tr("Cancel recording"), this, SLOT(OnCancel()));
		m_systray_action_cancel->setIconVisibleInMenu(true);
		m_systray_action_save = menu->addAction(g_icon_save, tr("Save recording"), this, SLOT(OnSave()));
		m_systray_action_save->setIconVisibleInMenu(true);
		menu->addSeparator();
		m_systray_action_show_hide = menu->addAction(QString(), m_main_window, SLOT(OnShowHide()));
		m_systray_action_show_hide->setIconVisibleInMenu(true);
		m_systray_action_quit = menu->addAction(g_icon_quit, tr("Quit"), m_main_window, SLOT(close()));
		m_systray_action_quit->setIconVisibleInMenu(true);
		m_systray_icon->setContextMenu(menu);
	} else {
		m_systray_icon = NULL;
	}

	connect(button_cancel, SIGNAL(clicked()), this, SLOT(OnCancel()));
	connect(button_save, SIGNAL(clicked()), this, SLOT(OnSave()));
	if(m_systray_icon != NULL)
		connect(m_systray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), m_main_window, SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason)));

	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->addWidget(groupbox_recording);
	layout->addWidget(splitter_vertical);
	{
		QHBoxLayout *layout2 = new QHBoxLayout();
		layout->addLayout(layout2);
		layout2->addWidget(button_cancel);
		layout2->addWidget(button_save);
	}

	UpdateSysTray();
	UpdateRecordPauseButton();
	UpdatePreview();

	m_timer_update_info = new QTimer(this);
	connect(m_timer_update_info, SIGNAL(timeout()), this, SLOT(OnUpdateInformation()));
	connect(&m_hotkey_start_pause, SIGNAL(Triggered()), this, SLOT(OnRecordStartPause()), Qt::QueuedConnection);
	connect(Logger::GetInstance(), SIGNAL(NewLine(Logger::enum_type,QString)), this, SLOT(OnNewLogLine(Logger::enum_type,QString)), Qt::QueuedConnection);

	if(m_systray_icon != NULL)
		m_systray_icon->show();

}
Exemple #14
0
void UI::GUI::setForm1(QWidget *Widget)
{
    lb1 = new QLabel(Widget);
    lb1->setGeometry(QRect(20, 90, 111, 16));
    lb1->setText("Размер матриц");
    lb1->setEnabled(false);
    lb2_1 = new QLabel(Widget);
    lb2_1->setGeometry(QRect(71, 110, 16, 16));
    lb2_1->setText("x");
    lb2_1->setEnabled(false);
    lb3 = new QLabel(Widget);
    lb3->setGeometry(QRect(20, 30, 71, 16));
    lb3->setText("Операция");
    lb4 = new QLabel(Widget);
    lb4->setGeometry(QRect(20, 160, 131, 16));
    lb4->setText("Скалярное число:");
    lb4->setEnabled(false);
    lb5 = new QLabel(Widget);
    lb5->setGeometry(QRect(138, 118, 16, 16));
    lb5->setText(",");
    lb5->hide();
    lb2_2 = new QLabel(Widget);
    lb2_2->setGeometry(QRect(201, 110, 16, 16));
    lb2_2->setText("x");
    lb2_2->hide();

    combo = new QComboBox(Widget);
    combo->setGeometry(QRect(20, 50, 111, 26));
    combo_lst << "Сложение" << "Вычитание" << "Умножение" << "Умножение на скалярное число";
    combo->addItems(combo_lst);
    //По умолчанию не выбран ни один элемент из списка.
    combo->setCurrentIndex(-1);

    b_continue = new QPushButton(Widget);
    b_continue->setGeometry(QRect(200, 210, 114, 32));
    b_continue->setText("Далее");
    b_cancel = new QPushButton(Widget);
    b_cancel->setGeometry(QRect(20, 210, 114, 32));
    b_cancel->setText("Отмена");

    //ввод значения строк и стобцов для первой и второй матрицы.
    ln_line1 = new QLineEdit(Widget);
    ln_line1->setGeometry(QRect(20, 110, 39, 21));
    ln_line1->setEnabled(false);
    ln_column1 = new QLineEdit(Widget);
    ln_column1->setGeometry(QRect(90, 110, 39, 21));
    ln_column1->setEnabled(false);
    // ln_num - поле ввода для скалярного числа.
    ln_num = new QLineEdit(Widget);
    ln_num->setGeometry(QRect(140, 159, 51, 21));
    ln_num->setEnabled(false);
    ln_line2 = new QLineEdit(Widget);
    ln_line2->setGeometry(QRect(150, 110, 39, 21));
    ln_line2->hide();
    ln_column2 = new QLineEdit(Widget);
    ln_column2->setGeometry(QRect(220, 110, 39, 21));
    ln_column2->hide();

    QWidget::setTabOrder(combo, ln_line1);
    QWidget::setTabOrder(ln_line1, ln_column1);
    QWidget::setTabOrder(ln_column1, ln_num);
    QWidget::setTabOrder(ln_num, ln_line2);
    QWidget::setTabOrder(ln_line2, ln_column2);
    QWidget::setTabOrder(ln_column2, b_continue);
    QWidget::setTabOrder(b_continue, b_cancel);

    QObject::connect(b_cancel, SIGNAL(clicked()), Widget, SLOT(close()));
    QObject::connect(combo, SIGNAL(activated(QString)), Widget, SLOT(comboSelectItem(QString)));
    QObject::connect(b_continue, SIGNAL(clicked()), Widget, SLOT(b_continueClicked()));

    Widget->setWindowTitle("Matrix");
    Widget->resize(331, 262);
    //Фиксированный размер окна.
    Widget->setMinimumSize(QSize(331, 262));
    Widget->setMaximumSize(QSize(331, 262));
}
void FileWizardPage::slotActivated()
{
    if (d->m_complete)
        emit activated();
}
// auto connect slot
void PlaylistWidget::on_lblName_linkActivated(const QString& link)
{
    Q_UNUSED(link);
    Q_EMIT activated();
}
Exemple #17
0
//---------------------------------------------------------------------------
void MainWindow::Ui_Init()
{
    ui->setupUi(this);

    // Shortcuts
    QShortcut *shortcutEqual = new QShortcut(QKeySequence(Qt::CTRL+Qt::Key_Equal), this);
    QObject::connect(shortcutEqual, SIGNAL(activated()), this, SLOT(on_actionZoomIn_triggered()));
    QShortcut *shortcutJ = new QShortcut(QKeySequence(Qt::Key_J), this);
    QObject::connect(shortcutJ, SIGNAL(activated()), this, SLOT(on_M1_triggered()));
    QShortcut *shortcutLeft = new QShortcut(QKeySequence(Qt::Key_Left), this);
    QObject::connect(shortcutLeft, SIGNAL(activated()), this, SLOT(on_Minus_triggered()));
    QShortcut *shortcutK = new QShortcut(QKeySequence(Qt::Key_K), this);
    QObject::connect(shortcutK, SIGNAL(activated()), this, SLOT(on_Pause_triggered()));
    QShortcut *shortcutRight = new QShortcut(QKeySequence(Qt::Key_Right), this);
    QObject::connect(shortcutRight, SIGNAL(activated()), this, SLOT(on_Plus_triggered()));
    QShortcut *shortcutL = new QShortcut(QKeySequence(Qt::Key_L), this);
    QObject::connect(shortcutL, SIGNAL(activated()), this, SLOT(on_P1_triggered()));
    QShortcut *shortcutSpace = new QShortcut(QKeySequence(Qt::Key_Space), this);
    QObject::connect(shortcutSpace, SIGNAL(activated()), this, SLOT(on_PlayPause_triggered()));
    QShortcut *shortcutF = new QShortcut(QKeySequence(Qt::Key_F), this);
    QObject::connect(shortcutF, SIGNAL(activated()), this, SLOT(on_Full_triggered()));

    // Drag n drop
    setAcceptDrops(true);

    // Icons
    ui->actionOpen->setIcon(QIcon(":/icon/document-open.png"));
    ui->actionCSV->setIcon(QIcon(":/icon/export.png"));
    ui->actionPrint->setIcon(QIcon(":/icon/document-print.png"));
    ui->actionZoomIn->setIcon(QIcon(":/icon/zoom-in.png"));
    ui->actionZoomOut->setIcon(QIcon(":/icon/zoom-out.png"));
    ui->actionFilesList->setIcon(QIcon(":/icon/multifile_layout.png"));
    ui->actionGraphsLayout->setIcon(QIcon(":/icon/graph_layout.png"));
    ui->actionFiltersLayout->setIcon(QIcon(":/icon/filters_layout.png"));
    ui->actionGettingStarted->setIcon(QIcon(":/icon/help.png"));
    ui->actionWindowOut->setIcon(QIcon(":/icon/window-out.png"));
    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    ui->toolBar->insertWidget(ui->actionFilesList, spacer);

    // Config
    ui->verticalLayout->setSpacing(0);
    ui->verticalLayout->setMargin(0);
    ui->verticalLayout->setStretch(0, 1);
    ui->verticalLayout->setContentsMargins(0,0,0,0);

    QLabel* DragDrop=new QLabel();
    DragDrop->setAlignment(Qt::AlignCenter);
    DragDrop->setPixmap(QPixmap(":/icon/window-out.png"));

    // Window
    setWindowTitle("QCTools");
    setWindowIcon(QIcon(":/icon/logo.png"));
    move(75, 75);
    resize(QApplication::desktop()->screenGeometry().width()-150, QApplication::desktop()->screenGeometry().height()-150);
    setUnifiedTitleAndToolBarOnMac(true);

    //ToolBar
    QObject::connect(ui->toolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(on_Toolbar_visibilityChanged(bool)));

    //ToolTip
    if (ui->fileNamesBox)
        ui->fileNamesBox->hide();
    for (size_t j=0; j<PlotType_Axis; j++)
    {
        CheckBoxes[j]=new QCheckBox(PerPlotGroup[j].Name);
        CheckBoxes[j]->setToolTip(PerPlotGroup[j].Description);
        CheckBoxes[j]->setCheckable(true);
        CheckBoxes[j]->setChecked(PerPlotGroup[j].CheckedByDefault);
        CheckBoxes[j]->setVisible(false);
        QObject::connect(CheckBoxes[j], SIGNAL(toggled(bool)), this, SLOT(on_check_toggled(bool)));
        ui->horizontalLayout->addWidget(CheckBoxes[j]);
    }

    configureZoom();

    //Groups
    QActionGroup* alignmentGroup = new QActionGroup(this);
    alignmentGroup->addAction(ui->actionFilesList);
    alignmentGroup->addAction(ui->actionGraphsLayout);
    alignmentGroup->addAction(ui->actionFiltersLayout);

    createDragDrop();
    ui->actionFilesList->setChecked(false);
    ui->actionGraphsLayout->setChecked(false);

    //Temp
    ui->actionFiltersLayout->setVisible(false);
    ui->actionWindowOut->setVisible(false);
    ui->actionPrint->setVisible(false);
    ui->actionPreferences->setVisible(false);
    ui->menuOptions->setVisible(false);
    ui->menuOptions->setTitle(QString());
    ui->menuOptions->setEnabled(false);

    // Not implemented action
    if (ui->actionExport_XmlGz_Custom)
        ui->actionExport_XmlGz_Custom->setVisible(false);
}
void
CrossfallEditorTool::initToolWidget()
{
    QGridLayout *toolLayout = new QGridLayout;

    // ButtonGroup //
    //
    // A button group so only one button can be checked at a time
    QButtonGroup *toolGroup = new QButtonGroup;
    connect(toolGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleToolClick(int)));

    // Tools //
    //
    QPushButton *toolButton;
    int row = -1; // button row

    toolButton = new QPushButton(tr("Select"));
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0);
    toolGroup->addButton(toolButton, ODD::TCF_SELECT); // button, id
    toolButton->setChecked(true);

    //	toolButton = new QPushButton(tr("Move Section"));
    //	toolButton->setCheckable(true);
    //	toolLayout->addWidget(toolButton, ++row, 0);
    //	toolGroup->addButton(toolButton, ODD::TCF_MOVE); // button, id

    toolButton = new QPushButton(tr("Add Section"));
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0);
    toolGroup->addButton(toolButton, ODD::TCF_ADD); // button, id

    toolButton = new QPushButton(tr("Del Section"));
    toolButton->setCheckable(true);
    toolLayout->addWidget(toolButton, ++row, 0);
    toolGroup->addButton(toolButton, ODD::TCF_DEL); // button, id

    QLabel *radiusLabel = new QLabel("Smooth Radius:");
    radiusEdit_ = new QDoubleSpinBox();
    radiusEdit_->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    radiusEdit_->setRange(0.01, 1000000.0);
    radiusEdit_->setValue(2000.0);
    radiusEdit_->setMinimumWidth(80.0);
    radiusEdit_->setMaximumWidth(80.0);

    toolLayout->addWidget(radiusLabel, ++row, 0);
    toolLayout->addWidget(radiusEdit_, ++row, 0);

    connect(radiusEdit_, SIGNAL(editingFinished()), this, SLOT(setRadius()));

    // Finish Layout //
    //
    toolLayout->setRowStretch(++row, 1); // row 3 fills the rest of the availlable space
    toolLayout->setColumnStretch(1, 1); // column 1 fills the rest of the availlable space

    // Widget/Layout //
    //
    ToolWidget *toolWidget = new ToolWidget();
    toolWidget->setLayout(toolLayout);
    toolManager_->addToolBoxWidget(toolWidget, tr("Crossfall Editor"));
    connect(toolWidget, SIGNAL(activated()), this, SLOT(activateEditor()));

    // Ribbon //
    //

    ToolWidget *ribbonWidget = new ToolWidget();
    //ribbonWidget->
    Ui::CrossfallRibbon *ui = new Ui::CrossfallRibbon();
    ui->setupUi(ribbonWidget);
    
    QButtonGroup *ribbonToolGroup = new QButtonGroup;
    connect(ribbonToolGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleToolClick(int)));
    
    
    ribbonToolGroup->addButton(ui->crossfallSelect, ODD::TSE_SELECT);
    ribbonToolGroup->addButton(ui->crossfallAdd, ODD::TSE_ADD);
    ribbonToolGroup->addButton(ui->crossfallDelete, ODD::TSE_DEL);
    //ribbonToolGroup->addButton(ui->elevationSmooth, ODD::TSE_SMOOTH);
    
    connect(ui->radiusEdit, SIGNAL(editingFinished()), this, SLOT(setRadius()));

    toolManager_->addRibbonWidget(ribbonWidget, tr("Crossfall"));
    connect(ribbonWidget, SIGNAL(activated()), this, SLOT(activateEditor()));
}
Exemple #19
0
void CanvasTabWidget::activate()
{
	auto canvasView = canvasViewAt(currentIndex());
	emit currentCanvasChanged(canvasView ? canvasView->canvas() : 0);
	emit activated();
}
Exemple #20
0
AddFtnDialog::AddFtnDialog(std::vector<std::string>& neighList,QDialog *parent) : QDialog(parent)
{
	this->cancelled=0;
	this->destPort=0;
	this->srcPort=0;
	this->sourceAddr="0000";
	this->destAddr="0000";
	this->outLabel=1000000;
	
	//source = new QLabel("Source Address:", this);
	//destination = new QLabel("Destination Address:", this);
	//labelTCP = new QLabel("TCP Destination Port :", this);
	//labelUDP = new QLabel("UDP Destination Port :", this);
	label = new QLabel("Label:", this);
	next = new QLabel("Next Hop :", this);

	sIPcb=new QCheckBox("Source Address", this);
	dIPcb=new QCheckBox("Destination Address", this);
	uPcb=new QCheckBox("UDP Destination Port", this);
	tPcb=new QCheckBox("TCP Destination Port", this);
	suPcb=new QCheckBox("UDP Source Port", this);
	stPcb=new QCheckBox("TCP Source Port", this);

	QValidator *inputMask=new QIntValidator(1,1000000,this);
	QValidator *portMask=new QIntValidator(1,65535,this);
	QDoubleValidator *weightMask=new QDoubleValidator(0.000,1.000,3,this);
	weightMask->setNotation(QDoubleValidator::StandardNotation);
	weightMask->setTop(1.000);

	add = new QPushButton("Add", this);
	cancel = new QPushButton("Cancel", this);


	nextHop = new QComboBox;
	for ( unsigned int i=0; i<neighList.size(); i++)
	{
		nextHop->addItem(tr(neighList[i].c_str()));
	}

	nextHop2 = new QComboBox;
	for ( unsigned int i=0; i<neighList.size(); i++)
	{
		nextHop2->addItem(tr(neighList[i].c_str()));
	}


	le1 = new QLineEdit(this);
	le1->setInputMask("999.999.999.999/99;_");

	le2 = new QLineEdit(this);
	le2->setInputMask("999.999.999.999/99;_");

	le3 = new QLineEdit(this);
	le3->setValidator(inputMask);
	le8 = new QLineEdit(this);
	le8->setValidator(portMask);
	le9 = new QLineEdit(this);
	le9->setValidator(portMask);
	le10 = new QLineEdit(this);
	le10->setValidator(portMask);
	le11 = new QLineEdit(this);
	le11->setValidator(portMask);

	label2 = new QLabel("Label:", this);
	next2 = new QLabel("Next Hop :", this);
	le4 = new QLineEdit(this);
	le4->setValidator(inputMask);
	le5 = new QLineEdit(this);
	le5->setValidator(inputMask);
	le6 = new QLineEdit(this);
	le6->setValidator(weightMask);
	le7 = new QLineEdit(this);
	le7->setValidator(weightMask);

	grid = new QGridLayout(); 
	cb=new QCheckBox("Configure Fast Reroute", this);
	
	main = new QLabel(this);
	main->setTextFormat(Qt::RichText);
	main->setText("<b><u>Primary Path</u></b>");
	bcup = new QLabel(this);
	bcup->setTextFormat(Qt::RichText);
	bcup->setText("<b><u>Backup Path</u></b>");
	polic = new QLabel(this);
	polic->setTextFormat(Qt::RichText);
	polic->setText("<b><u>Add Policy</u></b>");
	attrValue=new QLabel("Value",this);
	weights=new QLabel("Weights : 0<w<1",this);
	policyType=new QComboBox(this);
	policyType->addItem(tr("Default Policy"));
	policyType->addItem(tr("Weighted Policy"));
	policyAttr=new QComboBox;
	policyAttr->addItem(tr("Max Packets in Queue"));
	policyAttr->addItem(tr("Max Bytes in Queue"));
	connect(le6, SIGNAL(textChanged(QString)), this, SLOT(weightsChanged()));

	bcup->hide();
	label2->hide();
	nextHop2->hide();
	next2->hide();
	le4->hide();
	le5->hide();
	le6->hide();
	le7->hide();
	policyAttr->hide();
	policyType->hide();
	attrValue->hide();
	polic->hide();
	attrValue->hide();
	weights->hide();

	//grid->addWidget(source, 0, 0);
	grid->addWidget(sIPcb, 0, 0);
	grid->addWidget(le1, 0, 1);
	//grid->addWidget(destination, 1, 0);
	grid->addWidget(dIPcb, 1, 0);
	grid->addWidget(le2, 1, 1);
	grid->addWidget(suPcb, 2, 0);
	grid->addWidget(le10, 2, 1);
	grid->addWidget(stPcb, 3, 0);
	grid->addWidget(le11, 3, 1);
	grid->addWidget(uPcb, 4, 0);
	grid->addWidget(le8, 4, 1);
	grid->addWidget(tPcb, 5, 0);
	grid->addWidget(le9, 5, 1);
	grid->addWidget(main,6,0);
	grid->addWidget(label, 7, 0);
	grid->addWidget(le3, 7, 1);
	grid->addWidget(next, 8, 0);
	grid->addWidget(nextHop, 8, 1);
	grid->addWidget(cb,9,0);
	grid->addWidget(bcup,10,0);
	grid->addWidget(label2, 11, 0);
	grid->addWidget(le4, 11, 1);
	grid->addWidget(next2, 12, 0);
	grid->addWidget(nextHop2, 12, 1);
	grid->addWidget(polic,13,0);
	grid->addWidget(policyType,14,0);
	grid->addWidget(policyAttr,14,1);
	grid->addWidget(attrValue,15,0);
	grid->addWidget(le5,15,1);
	grid->addWidget(weights,16,0);
	grid->addWidget(le6,17,0);
	grid->addWidget(le7,17,1);
	grid->addWidget(add, 18, 0);
	grid->addWidget(cancel, 18, 1);

	le1->setReadOnly(1);
	le2->setReadOnly(1);
	le8->setReadOnly(1);
	le9->setReadOnly(1);
	le10->setReadOnly(1);
	le11->setReadOnly(1);

	connect(add, SIGNAL(clicked()), this, SLOT(add2()));
	connect(cancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));
	connect(cb, SIGNAL(stateChanged(int)), this, SLOT(fastReroute(int)));
	connect(sIPcb, SIGNAL(stateChanged(int)), this, SLOT(enableSIP(int)));
	connect(dIPcb, SIGNAL(stateChanged(int)), this, SLOT(enableDIP(int)));
	connect(uPcb, SIGNAL(stateChanged(int)), this, SLOT(enableUP(int)));
	connect(tPcb, SIGNAL(stateChanged(int)), this, SLOT(enableTP(int)));
	connect(suPcb, SIGNAL(stateChanged(int)), this, SLOT(enableSUP(int)));
	connect(stPcb, SIGNAL(stateChanged(int)), this, SLOT(enableSTP(int)));
	connect(policyType, SIGNAL(activated(QString)), this, SLOT(showWeights(QString)));

	setLayout(grid);
	this->setWindowTitle("Add FEC to NHLFE Map");
}
Exemple #21
0
FileBrowser::FileBrowser(LiteApi::IApplication *app, QObject *parent) :
    QObject(parent),
    m_liteApp(app)
{
    m_widget = new QWidget;
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);

    m_fileModel = new QFileSystemModel(this);
    m_fileModel->setFilter(QDir::AllEntries | QDir::NoDotAndDotDot);

    m_proxyModel = new QSortFileSystemProxyModel(this);
    m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    m_proxyModel->setDynamicSortFilter(true);
    m_proxyModel->setSourceModel(m_fileModel);
    m_proxyModel->sort(0);

    //create filter toolbar
    m_filterToolBar = new QToolBar(m_widget);
    m_filterToolBar->setIconSize(QSize(16,16));

    m_syncAct = new QAction(QIcon("icon:filebrowser/images/sync.png"),tr("Synchronize with editor"),this);
    m_syncAct->setCheckable(true);

    m_filterCombo = new QComboBox;
    m_filterCombo->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
    m_filterCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
    m_filterCombo->setEditable(true);
    m_filterCombo->addItem("*");
    m_filterCombo->addItem("Makefile;*.go;*.cgo;*.s;*.goc;*.y;*.e64;*.pro");
    m_filterCombo->addItem("*.sh;Makefile;*.go;*.cgo;*.s;*.goc;*.y;*.*.c;*.cpp;*.h;*.hpp;*.e64;*.pro");

    m_filterToolBar->addAction(m_syncAct);
    m_filterToolBar->addSeparator();
    m_filterToolBar->addWidget(m_filterCombo);

    //create root toolbar
    m_rootToolBar = new QToolBar(m_widget);
    m_rootToolBar->setIconSize(QSize(16,16));

    m_cdupAct = new QAction(QIcon("icon:filebrowser/images/cdup.png"),tr("Open to Parent"),this);

    m_rootCombo = new QComboBox;
    m_rootCombo->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
    m_rootCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
    m_rootCombo->setEditable(false);
    m_rootCombo->addItem(m_fileModel->myComputer().toString());

    m_rootToolBar->addAction(m_cdupAct);
    m_rootToolBar->addSeparator();
    m_rootToolBar->addWidget(m_rootCombo);

    //create treeview
    m_treeView = new QTreeView;
    m_treeView->setContextMenuPolicy(Qt::CustomContextMenu);
    m_treeView->setModel(m_proxyModel);

    m_treeView->setRootIsDecorated(true);
    m_treeView->setUniformRowHeights(true);
    m_treeView->setTextElideMode(Qt::ElideNone);
    m_treeView->setAttribute(Qt::WA_MacShowFocusRect, false);

    m_treeView->setHeaderHidden(true);
    m_treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    // show horizontal scrollbar
    m_treeView->header()->setResizeMode(QHeaderView::ResizeToContents);
    m_treeView->header()->setStretchLastSection(false);
    //hide
    int count = m_treeView->header()->count();
    for (int i = 1; i < count; i++) {
        m_treeView->setColumnHidden(i,true);
    }
    QHBoxLayout *cmdLayout = new QHBoxLayout;
    cmdLayout->setMargin(0);
    QLabel *label = new QLabel("Exec:");
    label->setToolTip("Execute\tCtrl+`, Alt+`");
    QAction *q = new QAction(this);
    q->setShortcuts(QList<QKeySequence>()
                    << QKeySequence("Ctrl+`")
                    << QKeySequence("Alt+`"));
    m_liteApp->mainWindow()->addAction(q);
    connect(q,SIGNAL(triggered()),this,SLOT(requestCommand()));
    cmdLayout->addWidget(label);
    m_commandEdit = new QLineEdit;
    m_commandEdit->setText("go ");
    cmdLayout->addWidget(m_commandEdit);

    mainLayout->addWidget(m_filterToolBar);
    mainLayout->addWidget(m_rootToolBar);
    mainLayout->addWidget(m_treeView);
    mainLayout->addLayout(cmdLayout);
    m_widget->setLayout(mainLayout);

    //create menu
    m_fileMenu = new QMenu;
    m_folderMenu = new QMenu;
    m_rootMenu = new QMenu;

    m_openFileAct = new QAction(tr("Open File"),this);
    m_openEditorAct = new QAction(tr("Open Editor"),this);
    m_newFileAct = new QAction(tr("New File"),this);
    m_newFileWizardAct = new QAction(tr("New File Wizard"),this);
    m_renameFileAct = new QAction(tr("Rename File"),this);
    m_removeFileAct = new QAction(tr("Remove File"),this);

    m_setRootAct = new QAction(tr("Set Folder To Root"),this);
    m_newFolderAct = new QAction(tr("New Folder"),this);
    m_renameFolderAct = new QAction(tr("Rename Folder"),this);
    m_removeFolderAct = new QAction(tr("Remove Folder"),this);

    m_openShellAct = new QAction(tr("Open Terminal Here"),this);
    m_openExplorerAct = new QAction(tr("Open Explorer Here"),this);

    m_viewGodocAct = new QAction(tr("View Godoc Here"),this);

    m_loadFolderAct = new QAction(tr("Load Folder Project"),this);

    m_fileMenu->addAction(m_openFileAct);
    m_fileMenu->addAction(m_openEditorAct);
    m_fileMenu->addSeparator();
    m_fileMenu->addAction(m_newFileAct);
    m_fileMenu->addAction(m_newFileWizardAct);
    m_fileMenu->addAction(m_renameFileAct);
    m_fileMenu->addAction(m_removeFileAct);
    m_fileMenu->addSeparator();
    m_fileMenu->addAction(m_loadFolderAct);
    m_fileMenu->addAction(m_viewGodocAct);
    m_fileMenu->addSeparator();
    m_fileMenu->addAction(m_openShellAct);
    m_fileMenu->addAction(m_openExplorerAct);

    m_folderMenu->addAction(m_setRootAct);
    m_folderMenu->addSeparator();
    m_folderMenu->addAction(m_newFileAct);
    m_folderMenu->addAction(m_newFileWizardAct);
    m_folderMenu->addAction(m_newFolderAct);
    m_folderMenu->addAction(m_renameFolderAct);
    m_folderMenu->addAction(m_removeFolderAct);
    m_folderMenu->addSeparator();
    m_folderMenu->addAction(m_loadFolderAct);
    m_folderMenu->addAction(m_viewGodocAct);
    m_folderMenu->addSeparator();
    m_folderMenu->addAction(m_openShellAct);
    m_folderMenu->addAction(m_openExplorerAct);

    m_rootMenu->addAction(m_cdupAct);
    m_rootMenu->addSeparator();
    m_rootMenu->addAction(m_newFileAct);
    m_rootMenu->addAction(m_newFileWizardAct);
    m_rootMenu->addAction(m_newFolderAct);
    m_rootMenu->addSeparator();
    m_rootMenu->addAction(m_loadFolderAct);
    m_rootMenu->addSeparator();
    m_rootMenu->addAction(m_openShellAct);
    m_rootMenu->addAction(m_openExplorerAct);

    connect(m_openFileAct,SIGNAL(triggered()),this,SLOT(openFile()));
    connect(m_openEditorAct,SIGNAL(triggered()),this,SLOT(openEditor()));    
    connect(m_newFileAct,SIGNAL(triggered()),this,SLOT(newFile()));
    connect(m_newFileWizardAct,SIGNAL(triggered()),this,SLOT(newFileWizard()));
    connect(m_renameFileAct,SIGNAL(triggered()),this,SLOT(renameFile()));
    connect(m_removeFileAct,SIGNAL(triggered()),this,SLOT(removeFile()));
    connect(m_newFolderAct,SIGNAL(triggered()),this,SLOT(newFolder()));
    connect(m_renameFolderAct,SIGNAL(triggered()),this,SLOT(renameFolder()));
    connect(m_removeFolderAct,SIGNAL(triggered()),this,SLOT(removeFolder()));
    connect(m_openShellAct,SIGNAL(triggered()),this,SLOT(openShell()));
    connect(m_setRootAct,SIGNAL(triggered()),this,SLOT(setFolderToRoot()));
    connect(m_cdupAct,SIGNAL(triggered()),this,SLOT(cdUp()));
    connect(m_openExplorerAct,SIGNAL(triggered()),this,SLOT(openExplorer()));
    connect(m_viewGodocAct,SIGNAL(triggered()),this,SLOT(viewGodoc()));
    connect(m_loadFolderAct,SIGNAL(triggered()),this,SLOT(loadFolderProject()));

    //QDockWidget *dock = m_liteApp->dockManager()->addDock(m_widget,tr("File Browser"));
    //connect(dock,SIGNAL(visibilityChanged(bool)),this,SLOT(visibilityChanged(bool)));
    m_toolWindowAct = m_liteApp->toolWindowManager()->addToolWindow(Qt::LeftDockWidgetArea,m_widget,"filesystem",tr("File System"),true);
    connect(m_toolWindowAct,SIGNAL(toggled(bool)),this,SLOT(visibilityChanged(bool)));
    connect(m_treeView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(doubleClickedTreeView(QModelIndex)));
    connect(m_filterCombo,SIGNAL(activated(QString)),this,SLOT(activatedFilter(QString)));
    connect(m_rootCombo,SIGNAL(activated(QString)),this,SLOT(activatedRoot(QString)));
    connect(m_syncAct,SIGNAL(triggered(bool)),this,SLOT(syncFileModel(bool)));
    connect(m_liteApp->editorManager(),SIGNAL(currentEditorChanged(LiteApi::IEditor*)),this,SLOT(currentEditorChanged(LiteApi::IEditor*)));
    connect(m_treeView,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(treeViewContextMenuRequested(QPoint)));
    connect(m_commandEdit,SIGNAL(returnPressed()),this,SLOT(commandReturn()));

    QString root = m_liteApp->settings()->value("FileBrowser/root",m_fileModel->myComputer().toString()).toString();
    addFolderToRoot(root);
    bool b = m_liteApp->settings()->value("FileBrowser/synceditor",true).toBool();
    if (b) {
        m_syncAct->setChecked(true);
    }
}
Exemple #22
0
void ActionListView::slotActivated(const QModelIndex &index)
{
    emit activated(m_model->actionAt(index));
}
Exemple #23
0
//***************************************************************************
Kwave::RecordDialog::RecordDialog(QWidget *parent, QStringList &params,
                                  Kwave::RecordController *controller,
                                  Kwave::RecordDialog::Mode mode)
    :QDialog(parent), Ui::RecordDlg(), m_methods_map(),
     m_file_filter(), m_devices_list_map(),
     m_state(Kwave::REC_EMPTY), m_params(),
     m_supported_resolutions(), m_buffer_progress_count(0),
     m_buffer_progress_total(0), m_buffer_progress_timer(this),
     m_record_enabled(true), m_samples_recorded(0),
     m_enable_setDevice(true), m_state_icon_widget(0)
{
    m_status_bar.m_state           = 0;
    m_status_bar.m_time            = 0;
    m_status_bar.m_sample_rate     = 0;
    m_status_bar.m_bits_per_sample = 0;
    m_status_bar.m_tracks          = 0;

    setupUi(this);

    /* get initial parameters */
    m_params.fromList(params);

    /* set the icons of the record control buttons */
    KIconLoader icon_loader;
    btNew->setIcon(   QIcon(icon_loader.loadIcon(_("document-new"),
	              KIconLoader::Toolbar)));
    btStop->setIcon(  QIcon(QPixmap(xpm_stop)));
    btPause->setIcon( QIcon(QPixmap(xpm_pause)));
    btRecord->setIcon(QIcon(QPixmap(xpm_krec_record)));

    // fill the combo box with playback methods
    unsigned int index=0;
    for (index = 0; index < m_methods_map.count(); ++index) {
	cbMethod->addItem(m_methods_map.description(index, true));
    }
    cbMethod->setEnabled(cbMethod->count() > 1);

    /* --- set up all controls with their default/startup values --- */

    // pre-record
    STD_SETUP_SLIDER(pre_record_enabled, pre_record_time, RecordPre);
    connect(chkRecordPre, SIGNAL(toggled(bool)),
            this,         SLOT(preRecordingChecked(bool)));
    connect(sbRecordPre,  SIGNAL(valueChanged(int)),
            this,         SLOT(preRecordingTimeChanged(int)));

    // record time (duration)
    STD_SETUP(record_time_limited, record_time, RecordTime);

    // start time (date & time)
    chkRecordStartTime->setChecked(m_params.start_time_enabled);
    startTime->setDateTime(m_params.start_time);

    // record trigger
    STD_SETUP_SLIDER(record_trigger_enabled, record_trigger, RecordTrigger);

    // amplification
    STD_SETUP_SLIDER(amplification_enabled, amplification, LevelAmplify);

    // AGC
    STD_SETUP_SLIDER(agc_enabled, agc_decay, LevelAGC);

    // fade in
    STD_SETUP(fade_in_enabled, fade_in_time, LevelFadeIn);

    // fade out
    STD_SETUP(fade_out_enabled, fade_out_time, LevelFadeOut);

    // sample rate, bits per sample, track
    // -> will be initialized later, by the plugin

    // number of buffers
    slSourceBufferCount->setValue(m_params.buffer_count);

    // power of buffer size
    slSourceBufferSize->setValue(m_params.buffer_size);
    sourceBufferSizeChanged(m_params.buffer_size);

    // after this point all controls have their initial values

    /* --- connect some missing low level GUI functionality --- */

    connect(cbMethod, SIGNAL(activated(int)),
            this, SLOT(methodSelected(int)));

    // record buffer size and count
    slSourceBufferCount->setValue(m_params.buffer_count);
    slSourceBufferSize->setValue(m_params.buffer_size);
    connect(slSourceBufferSize, SIGNAL(valueChanged(int)),
            this, SLOT(sourceBufferSizeChanged(int)));
    connect(slSourceBufferCount, SIGNAL(valueChanged(int)),
            this, SLOT(sourceBufferCountChanged(int)));

    // device treeview
    connect(listDevices,
            SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
            SLOT(listEntrySelected(QTreeWidgetItem*,QTreeWidgetItem*)));
    connect(listDevices, SIGNAL(itemExpanded(QTreeWidgetItem*)),
            SLOT(listItemExpanded(QTreeWidgetItem*)));
    connect(listDevices, SIGNAL(focusLost()),
            SLOT(updateListSelection()));

    // "select device..." button
    connect(btSourceSelect, SIGNAL(clicked()),
            this, SLOT(selectRecordDevice()));
    connect(cbDevice, SIGNAL(activated(QString)),
            this, SLOT(setDevice(QString)));

    // setup controls
    connect(chkRecordTime, SIGNAL(toggled(bool)),
            this, SLOT(recordTimeChecked(bool)));
    connect(sbRecordTime, SIGNAL(valueChanged(int)),
            this, SLOT(recordTimeChanged(int)));

    connect(chkRecordStartTime, SIGNAL(toggled(bool)),
            this, SLOT(startTimeChecked(bool)));
    connect(startTime, SIGNAL(dateTimeChanged(QDateTime)),
            this, SLOT(startTimeChanged(QDateTime)));

    connect(chkRecordTrigger, SIGNAL(toggled(bool)),
            this, SLOT(triggerChecked(bool)));
    connect(sbRecordTrigger, SIGNAL(valueChanged(int)),
            this, SLOT(triggerChanged(int)));

    connect(cbFormatSampleRate, SIGNAL(editTextChanged(QString)),
            this, SLOT(sampleRateChanged(QString)));
    connect(cbFormatSampleRate, SIGNAL(activated(QString)),
            this, SLOT(sampleRateChanged(QString)));

    connect(sbFormatTracks, SIGNAL(valueChanged(int)),
            this, SLOT(tracksChanged(int)));

    connect(cbFormatCompression, SIGNAL(activated(int)),
            this, SLOT(compressionChanged(int)));

    connect(sbFormatResolution, SIGNAL(valueChanged(int)),
            this, SLOT(bitsPerSampleChanged(int)));

    connect(cbFormatSampleFormat, SIGNAL(activated(int)),
            this, SLOT(sampleFormatChanged(int)));

    // connect the buttons to the record controller
    connect(btNew, SIGNAL(clicked()),
            controller, SLOT(actionReset()));
    connect(btStop, SIGNAL(clicked()),
            controller, SLOT(actionStop()));
    connect(btPause, SIGNAL(clicked()),
            controller, SLOT(actionPause()));
    connect(btRecord, SIGNAL(clicked()),
            controller, SLOT(actionStart()));

    // stop recording when the window gets closed
    connect(this, SIGNAL(rejected()), controller, SLOT(actionStop()));
    connect(this, SIGNAL(accepted()), controller, SLOT(actionStop()));

    // connect the notifications/commands of the record controller
    connect(controller, SIGNAL(stateChanged(Kwave::RecordState)),
            this, SLOT(setState(Kwave::RecordState)));

    // timer for updating the buffer progress bar
    connect(&m_buffer_progress_timer, SIGNAL(timeout()),
            this, SLOT(updateBufferProgressBar()));

    // help button
    connect(buttonBox->button(QDialogButtonBox::Help), SIGNAL(clicked()),
            this,   SLOT(invokeHelp()));

    // status bar
    m_state_icon_widget = new Kwave::StatusWidget(this);
    Q_ASSERT(m_state_icon_widget);
    if (!m_state_icon_widget) return;

    m_state_icon_widget->setFixedSize(16, 16);
    lbl_state->addWidget(m_state_icon_widget);

    m_status_bar.m_state = new (std::nothrow) QLabel(_(" "));
    Q_ASSERT(m_status_bar.m_state);
    if (!m_status_bar.m_state) return;
    m_status_bar.m_state->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    lbl_state->addWidget(m_status_bar.m_state);

    m_status_bar.m_time = new (std::nothrow) QLabel(_(" "));
    Q_ASSERT(m_status_bar.m_time);
    if (!m_status_bar.m_time) return;
    m_status_bar.m_time->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    lbl_state->addWidget(m_status_bar.m_time);

    m_status_bar.m_sample_rate = new (std::nothrow) QLabel(_(" "));
    Q_ASSERT(m_status_bar.m_sample_rate);
    if (!m_status_bar.m_sample_rate) return;
    m_status_bar.m_sample_rate->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    lbl_state->addWidget(m_status_bar.m_sample_rate);

    m_status_bar.m_bits_per_sample = new (std::nothrow) QLabel(_(" "));
    Q_ASSERT(m_status_bar.m_bits_per_sample);
    if (!m_status_bar.m_bits_per_sample) return;
    m_status_bar.m_bits_per_sample->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    lbl_state->addWidget(m_status_bar.m_bits_per_sample);

    m_status_bar.m_tracks = new (std::nothrow) QLabel(_(" "));
    Q_ASSERT(m_status_bar.m_tracks);
    if (!m_status_bar.m_tracks) return;
    m_status_bar.m_tracks->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    lbl_state->addWidget(m_status_bar.m_tracks);

    m_state_icon_widget->setFixedSize(16, lbl_state->childrenRect().height());

    // set the initial state of the dialog to "Reset/Empty"
    setState(Kwave::REC_EMPTY);

    // disable the "level" tab, it is not implemented yet
    tabRecord->setCurrentIndex(1);
    QWidget *page = tabRecord->currentWidget();
    tabRecord->setCurrentIndex(0);
    if (page) delete page;

    // add the "Done" button manually, otherwise it would have "Cancel" semantic
    QPushButton *bt_done =
	buttonBox->addButton(i18n("&Done"), QDialogButtonBox::AcceptRole);
    Q_ASSERT(bt_done);
    if (!bt_done) return;
    connect(bt_done, SIGNAL(clicked(bool)), this, SLOT(accept()));

    switch (mode)
    {
	case Kwave::RecordDialog::SETTINGS_FORMAT:
	    tabRecord->setCurrentIndex(1);
	    break;
	case Kwave::RecordDialog::SETTINGS_SOURCE:
	    tabRecord->setCurrentIndex(2);
	    break;
	case Kwave::RecordDialog::START_RECORDING:  /* FALLTHROUGH */
	case Kwave::RecordDialog::SETTINGS_DEFAULT: /* FALLTHROUGH */
	default:
	    tabRecord->setCurrentIndex(0);
	    // set the focus onto the "Record" button
	    btRecord->setFocus();
	    break;
    }
}
void ShortcutManager::activateShortcut(quint32 nativeKey, quint32 nativeMods)
{
    if(nativeKey == this->nativeKey && nativeMods == this->nativeMods)
        emit activated();
}
Exemple #25
0
void SCgView::createActions()
{
    constShortcut = new QShortcut(QKeySequence(tr("Alt+C")), mWindow);
    connect(constShortcut, SIGNAL(activated()), this, SLOT(chooseConstancy()));

    posShortcut = new QShortcut(QKeySequence(tr("Alt+P")), mWindow);
    connect(posShortcut, SIGNAL(activated()), this, SLOT(choosePositivity()));

    permShortcut = new QShortcut(QKeySequence(tr("Alt+T")), mWindow);
    connect(permShortcut, SIGNAL(activated()), this, SLOT(choosePermanence()));

    permShortcut = new QShortcut(QKeySequence(tr("Alt+S")), mWindow);
    connect(permShortcut, SIGNAL(activated()), this, SLOT(chooseStruct()));

    QAction* sep = new QAction(this);
    sep->setSeparator(true);
    mActionsList.append(sep);

    mActionChangeContent = new QAction(mWindow->findIcon("edit-content-change.png"),tr("Set content"),mWindow);
    mActionChangeContent->setShortcut(QKeySequence( tr("C") ));
    connect(mActionChangeContent, SIGNAL(triggered()), this, SLOT(changeContent()));

    mActionShowContent = new QAction(tr("Show content"),mWindow);
    mActionShowContent->setCheckable(true);
    mActionShowContent->setShortcut(QKeySequence( tr("H") ));
    connect(mActionShowContent, SIGNAL(triggered(bool)), this, SLOT(setContentVisible(bool)));

    mActionShowAllContent = new QAction(tr("Show all content"), mWindow);
    connect(mActionShowAllContent, SIGNAL(triggered(bool)), this, SLOT(setContentVisible(bool)));

    mActionHideAllContent = new QAction(tr("Hide all content"), mWindow);
    connect(mActionHideAllContent, SIGNAL(triggered(bool)), this, SLOT(setContentVisible(bool)));

    mActionDeleteContent = new QAction(mWindow->findIcon("edit-content-delete.png"), tr("Delete content"), mWindow);
    mActionDeleteContent->setShortcut(QKeySequence( tr("D") ));
    connect(mActionDeleteContent, SIGNAL(triggered()), this, SLOT(deleteContent()));

    mActionChangeIdtf = new QAction(mWindow->findIcon("edit-change-idtf.png"), tr("Change identifier"), mWindow);
    mActionChangeIdtf->setShortcut(QKeySequence( tr("I") ));
    connect(mActionChangeIdtf, SIGNAL(triggered()), this, SLOT(changeIdentifier()));

    mActionDelete = new QAction(QIcon::fromTheme("edit-delete", mWindow->findIcon("edit-delete.png")), tr("Delete"), mWindow);
    mActionDelete->setShortcut(QKeySequence::Delete);
    connect(mActionDelete, SIGNAL(triggered()), this, SLOT(deleteSelected()));

    mActionContourDelete = new QAction(mWindow->findIcon("edit-delete.png"), tr("Delete contour"), mWindow);
    mActionContourDelete->setShortcut( QKeySequence(tr("Backspace")) );
    connect(mActionContourDelete, SIGNAL(triggered()), this, SLOT(deleteJustContour()));

    mActionSwapPairOrient = new QAction(mWindow->findIcon("edit-swap-pair.png"), tr("Swap orientation"), mWindow);
    mActionSwapPairOrient->setShortcut( QKeySequence(tr("S")));
    connect(mActionSwapPairOrient, SIGNAL(triggered()), this, SLOT(swapPairOrient()));

    mActionCopy = new QAction(QIcon::fromTheme("edit-copy", mWindow->findIcon("edit-copy.png")), tr("Copy"),this);
    mActionCopy->setShortcut(QKeySequence::Copy);
    connect(mActionCopy, SIGNAL(triggered()), mWindow, SLOT(copy()));

    mActionCut = new QAction(QIcon::fromTheme("edit-cut", mWindow->findIcon("edit-cut.png")), tr("Cut"),this);
    mActionCut->setShortcut(QKeySequence::Cut);
    connect(mActionCut, SIGNAL(triggered()), mWindow, SLOT(cut()));

    mActionPaste = new QAction(QIcon::fromTheme("edit-paste", mWindow->findIcon("edit-paste.png")), tr("Paste"),this);
    mActionPaste->setShortcut(QKeySequence::Paste);
    connect(mActionPaste, SIGNAL(triggered()), mWindow, SLOT(paste()));

    mActionSelectAll = new QAction(QIcon::fromTheme("edit-select-all", mWindow->findIcon("edit-select-all.png")), tr("Select All"),this);
    mActionSelectAll->setShortcut(QKeySequence::SelectAll);
    connect(mActionSelectAll, SIGNAL(triggered()), this, SLOT(selectAllCommand()));


    mActionsList.append(mActionChangeContent);
    mActionsList.append(mActionShowContent);
    mActionsList.append(mActionShowAllContent);
    mActionsList.append(mActionHideAllContent);
    mActionsList.append(mActionDeleteContent);

    sep = new QAction(this);
    sep->setSeparator(true);
    mActionsList.append(sep);

    mActionsList.append(mActionChangeIdtf);
    mActionsList.append(mActionSwapPairOrient);

    sep = new QAction(this);
    sep->setSeparator(true);
    mActionsList.append(sep);

    mActionsList.append(mActionCopy);
    mActionsList.append(mActionCut);
    mActionsList.append(mActionPaste);

    sep = new QAction(this);
    sep->setSeparator(true);
    mActionsList.append(sep);

    mActionsList.append(mActionSelectAll);

    sep = new QAction(this);
    sep->setSeparator(true);
    mActionsList.append(sep);

    mActionsList.append(mActionContourDelete);
    mActionsList.append(mActionDelete);
}
Exemple #26
0
void LabeledCombo::prActivated(int i)
{
    emit activated(i);
}
bool Application::configure()
{
    if ( !QSystemTrayIcon::isSystemTrayAvailable() )
    {
        LOG_ERROR( "application", tr( "No system tray available!" ) );
        QMessageBox::critical( 0, tr( "Error" ), tr( "No system tray available!" ) );
        return false;
    }

    if ( !QSystemTrayIcon::supportsMessages() )
    {
        LOG_ERROR( "application", tr( "System tray not support messages!" ) );
        QMessageBox::critical( 0, tr( "Error" ), tr( "System tray not support messages!" ) );
        return false;
    }

    // Tray icons set.
    trayIconList.append( ":/images/radio-active-2.png" );
    trayIconList.append( ":/images/radio-active-1.png" );
    trayIconList.append( ":/images/radio-active.png"   );
    currTrayIcon = 0;

    // Setup player.
    connect( &player, SIGNAL( playerTick( quint64 ) ), SLOT( animateIcon( quint64 ) ) );
    connect( &player, SIGNAL( playing() ), SLOT( onPlayerPlay() ) );
    connect( &player, SIGNAL( paused() ), SLOT( onPlayerPause() ) );
    connect( &player, SIGNAL( stopped() ), SLOT( onPlayerStop() ) );
    connect( &player, SIGNAL( errorOccured() ), SLOT( onPlayerError() ) );
    connect( &player, SIGNAL( buffering( int ) ), SLOT( onPlayerBuffering( int ) ) );
    connect( &player, SIGNAL( volumeChanged( int ) ), SLOT( onPlayerVolumeChanged( int ) ) );
    connect( &player, SIGNAL( metaDataChanged( const QMultiMap< QString, QString > ) ),
                      SLOT ( onMetaDataChange( const QMultiMap< QString, QString > ) ) );

    // Setup global shortcuts.
    QxtGlobalShortcut * globalShortcut;
    globalShortcut = new QxtGlobalShortcut( &trayItem );
    if ( globalShortcut )
    {
        globalShortcut->setShortcut( QKeySequence( pauseHotkey ) );
        connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( playOrPause() ) );
    }
    globalShortcut = new QxtGlobalShortcut( &trayItem );
    if ( globalShortcut )
    {
        globalShortcut->setShortcut( QKeySequence( stopHotkey ) );
        connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( stopPlay() ) );
    }
    globalShortcut = new QxtGlobalShortcut( &trayItem );
    if ( globalShortcut )
    {
        globalShortcut->setShortcut( QKeySequence( volumeUpHotkey ) );
        connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( volumeUp() ) );
    }
    globalShortcut = new QxtGlobalShortcut( &trayItem );
    if ( globalShortcut )
    {
        globalShortcut->setShortcut( QKeySequence( volumeDownHotkey ) );
        connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( volumeDown() ) );
    }
    globalShortcut = new QxtGlobalShortcut( &trayItem );
    if ( globalShortcut )
    {
        globalShortcut->setShortcut( QKeySequence( quitHotkey ) );
        connect( globalShortcut, SIGNAL( activated() ), this, SLOT( quit()) );
    }

    // Create stations menu.
    stationsMenu.setTitle( tr( "Stations" ) );
    stationsMenu.setIcon( QIcon( ":/images/radio-passive.png" ) );
    stationsGroup = new QActionGroup( &stationsMenu );
    if ( stationsGroup )
    {
        stationsGroup->setExclusive( true );
        updateStationsMenu();
        connect( stationsGroup, SIGNAL( triggered( QAction * ) ),
                                SLOT( processStationAction( QAction * ) ) );
    }

    // Create base menu.
    trayMenu.addMenu( &stationsMenu );
    trayMenu.addSeparator();
    QAction * action;
    action = new QAction( &trayMenu );
    if ( action )
    {
        action->setIcon( QIcon( ":/images/audio-volume-up.png" ) );
        action->setText( tr( "Volume up" ) );
        action->setShortcut( QKeySequence( volumeUpHotkey ) );
        connect( action, SIGNAL( triggered() ), &player, SLOT( volumeUp() ) );
        trayMenu.addAction( action );
    }
    action = new QAction( &trayMenu );
    if ( action )
    {
        action->setIcon( QIcon( ":/images/audio-volume-down.png" ) );
        action->setText( tr( "Volume down" ) );
        action->setShortcut( QKeySequence( volumeDownHotkey ) );
        connect( action, SIGNAL( triggered() ), &player, SLOT( volumeDown() ) );
        trayMenu.addAction( action );
    }
    trayMenu.addSeparator();
    action = new QAction( &trayMenu );
    if ( action )
    {
        action->setIcon( QIcon( ":/images/media-playback-start.png" ) );
        action->setText( tr( "Play|Pause" ) );
        action->setShortcut( QKeySequence( pauseHotkey ) );
        connect( action, SIGNAL( triggered() ), &player, SLOT( playOrPause() ) );
        trayMenu.addAction( action );
    }
    action = new QAction( &trayMenu );
    if ( action )
    {
        action->setIcon( QIcon( ":/images/media-playback-stop.png" ) );
        action->setText( tr( "Stop" ) );
        action->setShortcut( QKeySequence( stopHotkey ) );
        connect( action, SIGNAL( triggered() ), &player, SLOT( stopPlay() ) );
        trayMenu.addAction( action );
    }
    trayMenu.addSeparator();
    action = new QAction( &trayMenu );
    if ( action )
    {
        action->setIcon( QIcon( ":/images/application-info.png" ) );
        action->setText( tr( "Info" ) );
        action->setMenuRole( QAction::AboutRole );
        connect( action, SIGNAL( triggered() ), this, SLOT( about() ) );
        trayMenu.addAction( action );
    }
    action = new QAction( &trayMenu );
    if ( action )
    {
        action->setIcon( QIcon( ":/images/application-exit.png" ) );
        action->setText( tr( "Exit" ) );
        action->setShortcut( QKeySequence( quitHotkey ) );
        action->setMenuRole( QAction::QuitRole );
        connect( action, SIGNAL( triggered() ), this, SLOT( quit() ) );
        trayMenu.addAction( action );
    }

    // Create settings menu.
    action = new QAction( &trayMenu );
    if ( action )
    {
        action->setIcon( QIcon( ":/images/application-settings.png" ) );
        action->setText( tr( "Settings" ) );
        action->setMenuRole( QAction::PreferencesRole );
        connect( action, SIGNAL( triggered() ), this, SLOT( manageSettings() ) );
        settingsMenu.addAction( action );
    }
    action = new QAction( &trayMenu );
    if ( action )
    {
        action->setIcon( QIcon( ":/images/application-exit.png" ) );
        action->setText( tr( "Exit" ) );
        action->setShortcut( QKeySequence( quitHotkey ) );
        action->setMenuRole( QAction::QuitRole );
        connect( action, SIGNAL( triggered() ), this, SLOT( quit() ) );
        settingsMenu.addAction( action );
    }

    // Setup tray item.
    trayItem.setIcon( QIcon( ":/images/radio-passive.png" ) );
    trayItem.show();
    trayItem.showMessage( tr( "QRadioTray" ), tr( "Program started!" ), QSystemTrayIcon::Information );
    connect( &trayItem, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ),
                        SLOT( processTrayActivation( QSystemTrayIcon::ActivationReason ) ) );
    return true;
}
Exemple #28
0
/**
 * Constructs a TabDlg
 *
 * \param tabManager The tabManager that will manage this TabDlg
 * \param delegate If non-zero, this is a pointer to a TabDlgDelegate that
 *        will manage some aspects of the TabDlg behavior.  Ownership is not
 *        passed.
 */ 
TabDlg::TabDlg(TabManager* tabManager, QSize size, TabDlgDelegate *delegate)
		: AdvancedWidget<QWidget>(0, delegate ? delegate->initWindowFlags() : (Qt::WindowFlags)0)
		, delegate_(delegate)
		, tabWidget_(0)
		, detachButton_(0)
		, closeButton_(0)
		, closeCross_(0)
		, tabMenu_(new QMenu(this))
		, act_close_(0)
		, act_next_(0)
		, act_prev_(0)
		, tabManager_(tabManager)
		, userManagement_(true)
		, tabBarSingles_(true)
		, simplifiedCaption_(false) {
	if (delegate_) {
		delegate_->create(this);
	}

	if (PsiOptions::instance()->getOption("options.ui.mac.use-brushed-metal-windows").toBool()) {
		setAttribute(Qt::WA_MacMetalStyle);
	}

	// FIXME
	qRegisterMetaType<TabDlg*>("TabDlg*");
	qRegisterMetaType<TabbableWidget*>("TabbableWidget*");

	tabWidget_ = new PsiTabWidget(this);
	tabWidget_->setCloseIcon(IconsetFactory::icon("psi/closetab").icon());
	connect(tabWidget_, SIGNAL(mouseDoubleClickTab(QWidget*)), SLOT(mouseDoubleClickTab(QWidget*)));
	connect(tabWidget_, SIGNAL(aboutToShowMenu(QMenu*)), SLOT(tab_aboutToShowMenu(QMenu*)));
	connect(tabWidget_, SIGNAL(tabContextMenu(int, QPoint, QContextMenuEvent*)), SLOT(showTabMenu(int, QPoint, QContextMenuEvent*)));
	connect(tabWidget_, SIGNAL(closeButtonClicked()), SLOT(closeCurrentTab()));
	connect(tabWidget_, SIGNAL(currentChanged(QWidget*)), SLOT(tabSelected(QWidget*)));

	if(delegate_)
		delegate_->tabWidgetCreated(this, tabWidget_);

	QVBoxLayout *vert1 = new QVBoxLayout( this, 1);
	vert1->addWidget(tabWidget_);

	setAcceptDrops(TRUE);

	X11WM_CLASS("tabs");
	setLooks();

	act_close_ = new QAction(this);
	addAction(act_close_);
	connect(act_close_,SIGNAL(activated()), SLOT(closeCurrentTab()));
	act_prev_ = new QAction(this);
	addAction(act_prev_);
	connect(act_prev_,SIGNAL(activated()), SLOT(previousTab()));
	act_next_ = new QAction(this);
	addAction(act_next_);
	connect(act_next_,SIGNAL(activated()), SLOT(nextTab()));

	setShortcuts();

	if (size.isValid()) {
		resize(size);
	} else {
		resize(ChatDlg::defaultSize()); //TODO: no!
	}
}
Exemple #29
0
void QProcessPrivate::startProcess()
{
    Q_Q(QProcess);

    bool success = false;

    if (pid) {
        CloseHandle(pid->hThread);
        CloseHandle(pid->hProcess);
        delete pid;
        pid = 0;
    }
    pid = new PROCESS_INFORMATION;
    memset(pid, 0, sizeof(PROCESS_INFORMATION));

    q->setProcessState(QProcess::Starting);

    if (!createChannel(stdinChannel) ||
        !createChannel(stdoutChannel) ||
        !createChannel(stderrChannel))
        return;

    QString args = qt_create_commandline(program, arguments);
    QByteArray envlist;
    if (environment.d.constData())
        envlist = qt_create_environment(environment.d.constData()->hash);
    if (!nativeArguments.isEmpty()) {
        if (!args.isEmpty())
             args += QLatin1Char(' ');
        args += nativeArguments;
    }

#if defined QPROCESS_DEBUG
    qDebug("Creating process");
    qDebug("   program : [%s]", program.toLatin1().constData());
    qDebug("   args : %s", args.toLatin1().constData());
    qDebug("   pass environment : %s", environment.isEmpty() ? "no" : "yes");
#endif

    // Forwarded channels must not set the CREATE_NO_WINDOW flag because this
    // will render the stdout/stderr handles we're passing useless.
    DWORD dwCreationFlags = (processChannelMode == QProcess::ForwardedChannels ? 0 : CREATE_NO_WINDOW);
    dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
    STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
                                 (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
                                 (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
                                 0, 0, 0,
                                 STARTF_USESTDHANDLES,
                                 0, 0, 0,
                                 stdinChannel.pipe[0], stdoutChannel.pipe[1], stderrChannel.pipe[1]
    };
    success = CreateProcess(0, (wchar_t*)args.utf16(),
                            0, 0, TRUE, dwCreationFlags,
                            environment.isEmpty() ? 0 : envlist.data(),
                            workingDirectory.isEmpty() ? 0 : (wchar_t*)QDir::toNativeSeparators(workingDirectory).utf16(),
                            &startupInfo, pid);
    if (!success) {
        // Capture the error string before we do CloseHandle below
        q->setErrorString(QProcess::tr("Process failed to start: %1").arg(qt_error_string()));
    }

    if (stdinChannel.pipe[0] != INVALID_Q_PIPE) {
        CloseHandle(stdinChannel.pipe[0]);
        stdinChannel.pipe[0] = INVALID_Q_PIPE;
    }
    if (stdoutChannel.pipe[1] != INVALID_Q_PIPE) {
        CloseHandle(stdoutChannel.pipe[1]);
        stdoutChannel.pipe[1] = INVALID_Q_PIPE;
    }
    if (stderrChannel.pipe[1] != INVALID_Q_PIPE) {
        CloseHandle(stderrChannel.pipe[1]);
        stderrChannel.pipe[1] = INVALID_Q_PIPE;
    }

    if (!success) {
        cleanup();
        processError = QProcess::FailedToStart;
        emit q->error(processError);
        q->setProcessState(QProcess::NotRunning);
        return;
    }

    q->setProcessState(QProcess::Running);
    // User can call kill()/terminate() from the stateChanged() slot
    // so check before proceeding
    if (!pid)
        return;

    if (threadData->hasEventDispatcher()) {
        processFinishedNotifier = new QWinEventNotifier(pid->hProcess, q);
        QObject::connect(processFinishedNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_processDied()));
        processFinishedNotifier->setEnabled(true);
        notifier = new QTimer(q);
        QObject::connect(notifier, SIGNAL(timeout()), q, SLOT(_q_notified()));
        notifier->start(NOTIFYTIMEOUT);
    }

    _q_startupNotification();
}
Exemple #30
0
  /**
   * Set up the menus for the ScatterPlotWindow.
   * Called from the constructor.
   */
  void ScatterPlotWindow::setupMenus(){
    p_menubar = p_scatterPlotWindow->menuBar();
    p_toolBar = new QToolBar(p_scatterPlotWindow);

    p_scatterPlotWindow->addToolBar(Qt::TopToolBarArea,p_toolBar);

    QAction *fitLine = new QAction(p_plot);
    fitLine->setText("Line Fit");
    fitLine->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/linefit.png"));
    QObject::connect(fitLine, SIGNAL(activated()), this, SLOT(showContour()));

    p_colorize = new QAction(p_plot);
    p_colorize->setText("Colorize");
    p_colorize->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/rgb.png"));
    QString text  =
      "Colorize";
    p_colorize->setWhatsThis(text);
    QObject::connect(p_colorize,SIGNAL(activated()),this,SLOT(colorPlot()));

    QAction *save = new QAction(p_plot);
    save->setText("&Save Plot As");
    save->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/filesaveas.png"));
    text  =
      "<b>Function:</b>  Save the plot as a png, jpg, or tif file.";
    save->setWhatsThis(text);
    QObject::connect(save,SIGNAL(activated()),this,SLOT(savePlot()));

    QAction *prt = new QAction(p_plot);
    prt->setText("&Print Plot");
    prt->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/fileprint.png"));
    text  =
      "<b>Function:</b>  Sends the plot image to the printer";
    prt->setWhatsThis(text);
    QObject::connect(prt,SIGNAL(activated()),this,SLOT(printPlot()));

    QAction *track = new QAction(p_plot);
    track->setText("Show Mouse &Tracking");
    track->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/goto.png"));
    track->setCheckable(true);
    text  =
      "<b>Function:</b>  Displays the x,y coordinates as the cursor moves \
      around on the plot.";
    track->setWhatsThis(text);
    QObject::connect(track,SIGNAL(activated()),this,SLOT(trackerEnabled()));

    QAction *changeLabels = new QAction(p_plot);
    changeLabels->setText("Rename Plot &Labels");
    changeLabels->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/plot_renameLabels.png"));
    text  =
      "<b>Function:</b>  Edit the plot title, x and y axis labels.";
    changeLabels->setWhatsThis(text);
    QObject::connect(changeLabels,SIGNAL(activated()),this,SLOT(reLabel()));

    QAction *changeScale = new QAction(p_plot);
    changeScale->setText("Set &Display Range");
    changeScale->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/plot_setScale.png"));
    text  =
      "<b>Function:</b>  Adjust the scale for the x and y axis on the plot.";
    changeScale->setWhatsThis(text);
    QObject::connect(changeScale,SIGNAL(activated()),this, SLOT(setDisplayRange()));

    QAction *resetScaleButton = new QAction(p_plot);
    resetScaleButton->setText("Reset Scale");
    resetScaleButton->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/plot_resetscale.png"));
    text  =
      "<b>Function:</b>  Reset the plot's scale.";
    resetScaleButton->setWhatsThis(text);
    QObject::connect(resetScaleButton, SIGNAL(activated()),this, SLOT(resetScale()));

    QAction *close = new QAction(p_plot);
    close->setText("Close");
    QObject::connect(close,SIGNAL(activated()),p_scatterPlotWindow, SLOT(close()));

    /*setup menus*/
    QMenu *options = new QMenu("&Options");
    options->addAction(track);
    options->addAction(changeLabels);
    options->addAction(changeScale);

    QMenu *file = new QMenu("&File");
    file->addAction(save);
    file->addAction(prt);
    file->addAction(close);

     p_menubar->addMenu(file);
     p_menubar->addMenu(options);
     
     p_toolBar->addAction(track);
     p_toolBar->addAction(changeLabels);
     p_toolBar->addAction(changeScale);
     p_toolBar->addAction(p_colorize);
     p_toolBar->addAction(fitLine);
  }