Example #1
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, const QString& geometryOption, 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)
		, activateTabMapper_(0)
{
	if (delegate_) {
		delegate_->create(this);
	}

	// 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(mouseMiddleClickTab(QWidget*)), SLOT(mouseMiddleClickTab(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);
	vert1->setMargin(1);
	vert1->addWidget(tabWidget_);

	setAcceptDrops(true);

	X11WM_CLASS("tabs");
	setLooks();

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

	setShortcuts();

	setGeometryOptionPath(geometryOption);
}
Example #2
0
bool MessageWindow::addTab(Contact *contact)
{
    if (!contact)
        return false;

    bool tabAdded = false;
    MessagePage *page = NULL;

    if (m_pages.contains(contact)) {
        page = m_pages.value(contact);
        setCurrentWidget(page);
    } else {
        page = new MessagePage(m_socket, contact);
        connect(contact, SIGNAL(statusChanged()), SLOT(contact_statusChanged()));
        connect(page, SIGNAL(closeButtonClicked()), SLOT(page_closeButtonClicked()));
        int index = QTabWidget::addTab(page, contact->statusIcon(), contact->username());
        m_pages.insert(contact, page);
        setCurrentIndex(index);
        tabAdded = true;
    }

    show();
    raise();
    activateWindow();
    if (page != NULL)
        page->setFocusOnInput();

    return tabAdded;
}
Example #3
0
aboutdialog::aboutdialog(QWidget *parent)
    : QWidget(parent)
{
	ui.setupUi(this);
	connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(closeButtonClicked()) );	
	
}
Example #4
0
TabBarItem::TabBarItem(QWidget *AParent) : QFrame(AParent)
{
	FActive = true;
	FDraging = false;
	FIconSize = QSize(16,16);
	FLeft = FRight = FTop = FBottom = false;

	setProperty("ignoreFilter", true);

	setMouseTracking(true);

	setLayout(new QHBoxLayout);
	layout()->setMargin(2);
	layout()->setSpacing(2);

	layout()->addWidget(FIconLabel = new QLabel(this));
	FIconLabel->setObjectName("statusIconLabel");
	FIconLabel->setTextInteractionFlags(Qt::NoTextInteraction);
	FIconLabel->installEventFilter(this);
	FIconLabel->setFixedSize(FIconSize);

	layout()->addWidget(FTextLabel = new CustomLabel(this));
	FTextLabel->setElideMode(Qt::ElideNone);
	FTextLabel->setObjectName("tabBarItemLabel");
	FTextLabel->setShadow(CustomLabel::LightShadow);
	FTextLabel->setTextInteractionFlags(Qt::NoTextInteraction);
	FTextLabel->installEventFilter(this);
	FTextLabel->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);

	layout()->addWidget(FCloseButton = new CloseButton(this));
	FCloseButton->setFixedSize(16,16);
	FCloseButton->installEventFilter(this);
	StyleStorage::staticStorage(RSR_STORAGE_STYLESHEETS)->insertAutoStyle(FCloseButton,STS_MESSAGEWIDGETS_TABCLOSEBUTTON);
	connect(FCloseButton,SIGNAL(clicked()),SIGNAL(closeButtonClicked()));

	GraphicsEffectsStorage::staticStorage(RSR_STORAGE_GRAPHICSEFFECTS)->installGraphicsEffect(FIconLabel, GFX_STATUSICONS);

	FIconHidden = false;
	FBlinkTimer.setSingleShot(true);
	connect(&FBlinkTimer,SIGNAL(timeout()),SLOT(onBlinkTimerTimeout()));

	FUpdateTimer.setInterval(0);
	FUpdateTimer.setSingleShot(true);
	connect(&FUpdateTimer,SIGNAL(timeout()),SLOT(onUpdateTimerTimeout()));

	FIconLabel->setProperty("ignoreFilter", true);
	FTextLabel->setProperty("ignoreFilter", true);
	FCloseButton->setProperty("ignoreFilter", true);

	setActive(false);
	setDraging(false);
}
/** Initializes the signal slot connections */
void CSearchDialog::initConnections() {
    // Search button is clicked
    bool ok = connect(m_searchOptionsArea->searchButton(), SIGNAL(clicked()), this, SLOT(startSearch()));
    Q_ASSERT(ok);
    // Return/Enter is pressed in the search text field
    ok = connect(m_searchOptionsArea, SIGNAL(sigStartSearch()), this, SLOT(startSearch()) );
    Q_ASSERT(ok);
    ok = connect(m_closeButton, SIGNAL(clicked()), this, SLOT(closeButtonClicked()));
    Q_ASSERT(ok);

    connect(m_analyseButton, SIGNAL(clicked()), m_searchResultArea, SLOT(showAnalysis()));

}
Example #6
0
int TabBar::addTab(const QString &AText)
{
    TabBarItem *item = new TabBarItem(this);
    item->setText(AText);
    item->setCloseable(FTabsCloseable);
    FItems.append(item);
    layout()->addWidget(item);
    connect(item,SIGNAL(closeButtonClicked()),SLOT(onCloseButtonClicked()));

    int index = FItems.indexOf(item);
    if (index == 0)
        setCurrentIndex(index);

    return index;
}
DroneshareUploadDialog::DroneshareUploadDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DroneshareUploadDialog),
    m_uasInterface(NULL),
    m_droneshareUpload(NULL),
    m_droneshareQuery(NULL)
{
    ui->setupUi(this);

    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(closeButtonClicked()));
    connect(ui->uploadButton, SIGNAL(clicked()), this, SLOT(uploadClicked()));

    connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)),
            this, SLOT(activeUASSet(UASInterface*)));
    activeUASSet(UASManager::instance()->getActiveUAS());
}
Example #8
0
DeviceItem::DeviceItem( QWidget *parent ) :
    QWidget(parent)
{
    p = new DeviceItemPrivate;

    p->ui = new Ui::DiscUi;
        p->ui->setupUi( this );
        p->ui->close_button->setIcon( SMasterIcons::icon(ICON_SIZE,"application-exit.png") );

    p->device_list = new SDeviceList( this );

    connect( p->device_list      , SIGNAL(deviceDetected(SDeviceItem)) , SLOT(deviceDetected(SDeviceItem)) );
    connect( p->ui->close_button , SIGNAL(clicked())                   , SLOT(closeButtonClicked())        );

    p->device_list->refresh();
}
Example #9
0
/**
 * Constructor
 */
PsiTabWidget::PsiTabWidget(QWidget *parent)
		: QWidget(parent) {
	tabsPosition_ = QTabWidget::East; // impossible => uninitialised state
	tabBar_ = new PsiTabBar(this);
	tabBar_->setUsesScrollButtons(true);
	layout_ = new QVBoxLayout(this);
	layout_->setMargin(0);
	layout_->setSpacing(0);
	barLayout_ = new QHBoxLayout;
	layout_->addLayout(barLayout_);
	barLayout_->setMargin(0);
	barLayout_->setSpacing(0);
	barLayout_->addWidget(tabBar_, 2);
	barLayout_->setAlignment(Qt::AlignLeft);

	int buttonwidth = qMax(tabBar_->style()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, tabBar_),
		QApplication::globalStrut().width());

	downButton_ = new QToolButton(this);
	downButton_->setMinimumSize(3,3);
	downButton_->setFixedWidth(buttonwidth);
	downButton_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
	menu_ = new QMenu(this);
	downButton_->setMenu(menu_);
	downButton_->setStyleSheet(" QToolButton::menu-indicator { image:none } ");
	connect(menu_, SIGNAL(aboutToShow()), SLOT(menu_aboutToShow()));
	connect(menu_, SIGNAL(triggered(QAction*)), SLOT(menu_triggered(QAction*)));
	barLayout_->addWidget(downButton_);

	closeButton_ = new QToolButton(this);
	closeButton_->setMinimumSize(3,3);
	closeButton_->setFixedWidth(buttonwidth);
	closeButton_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
	barLayout_->addWidget(closeButton_);
	closeButton_->setText("x");
	downButton_->setArrowType(Qt::DownArrow);
	downButton_->setPopupMode(QToolButton::InstantPopup);
	stacked_ = new QStackedLayout(layout_);

	setTabPosition(QTabWidget::North);

	connect( tabBar_, SIGNAL(mouseDoubleClickTab(int)), SLOT(mouseDoubleClickTab(int)));
	connect( tabBar_, SIGNAL(mouseMiddleClickTab(int)), SLOT(mouseMiddleClickTab(int)));
	connect( tabBar_, SIGNAL( currentChanged(int)), SLOT(tab_currentChanged(int)));
	connect( tabBar_, SIGNAL( contextMenu(QContextMenuEvent*,int)), SLOT( tab_contextMenu(QContextMenuEvent*,int)));
	connect( closeButton_, SIGNAL(clicked()), SIGNAL(closeButtonClicked()));
}
Example #10
0
void pTabBar::mouseReleaseEvent( QMouseEvent* event )
{
    // check button close clicked
    if ( aToggleTabsHaveCloseButton->isChecked() )
    {
        // get tab under cursor
        int i = tabAt( event->pos() );
        
        // if tab and left button and  tab icon pressed
        if ( i != -1 )
            if ( event->button() == Qt::LeftButton && inCloseButtonRect( i, event->pos() ) )
                emit closeButtonClicked( i );
    }
    
    // default event
    QTabBar::mouseReleaseEvent( event );
}
Example #11
0
int appSQL::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: displayButtonClicked(); break;
        case 1: submitChangedButtonClicked(); break;
        case 2: revertChangedButtonClicked(); break;
        case 3: addButtonClicked(); break;
        case 4: deleteButtonClicked(); break;
        case 5: searchButtonClicked(); break;
        case 6: closeButtonClicked(); break;
        }
        _id -= 7;
    }
    return _id;
}
MyCameraWindow::MyCameraWindow(CvCapture *cam, QWidget *parent) : QWidget(parent) {
    camera = cam;
    layout = new QGridLayout();
    cvwidget = new QOpenCVWidget(this);
    layout->addWidget(cvwidget,0,0,1,3);
    closeButton = new QCommandLinkButton(tr("Close"));
    optionsButton = new QCommandLinkButton(tr("Options"));
    captureButton = new QCommandLinkButton(tr("Capture Image"));
    layout->addWidget(closeButton,1,2);
    layout->addWidget(optionsButton,1,0);
    layout->addWidget(captureButton,1,1);
    setLayout(layout);
    resize(640, 480);

    connect(closeButton,SIGNAL(clicked()),this,SLOT(closeButtonClicked()));
    connect(captureButton,SIGNAL(clicked()),this,SLOT(captureButtonClicked()));
    connect(optionsButton,SIGNAL(clicked()),this,SLOT(optionsButtonClicked()));

    startTimer(40);  // 25 fps = 40ms
 }
/*
 *  Constructs a ossimQtIgenDialog as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal dialog.
 */
ossimQtIgenDialog::ossimQtIgenDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : QDialog(parent, name, modal, fl)
{
    setupUi(this);


    // signals and slots connections
    connect(theCloseButton, SIGNAL(clicked()), this, SLOT(closeButtonClicked()));
    connect(theOutputFilePushButton, SIGNAL(clicked()), this, SLOT(outputFilePushButtonClicked()));
    connect(theSaveSpecFilePushButton, SIGNAL(clicked()), this, SLOT(saveSpecFilePushButtonClicked()));
    connect(theRunIgenPushButton, SIGNAL(clicked()), this, SLOT(runIgenPushButtonClicked()));
    connect(theGsdLineEdit, SIGNAL(returnPressed()), this, SLOT(gsdLineEditReturnPressed()));
    connect(theLinesLineEdit, SIGNAL(returnPressed()), this, SLOT(linesLineEditReturnPressed()));
    connect(theSamplesLineEdit, SIGNAL(returnPressed()), this, SLOT(samplesLineEditReturnPressed()));
    connect(theOutputFileLineEdit, SIGNAL(returnPressed()), this, SLOT(outputFileLineEditReturnPressed()));
    connect(theSceneRectPushButton, SIGNAL(clicked()), this, SLOT(sceneRectPushButtonClicked()));
    connect(theEditWriterPushButton, SIGNAL(clicked()), this, SLOT(editWriterPushButtonClicked()));
    connect(theOutputTypeComboBox, SIGNAL(activated(const QString&)), this, SLOT(outputTypeComboBoxActivated(const QString&)));
    init();
}
Example #14
0
DataPlotUI::DataPlotUI(int deploymentId, QWidget *parent)
    : QDialog(parent) {
    ui.setupUi(this);

    this->deploymentId = deploymentId;

    // init combo boxes
    initComboArea();

    // connect signals and slots
    connect(ui.cbMeasurementProfileID, SIGNAL(currentIndexChanged(QString)), this, SLOT(measurementProfileChanged()));
    connect(ui.btnClose, SIGNAL(clicked()), this, SLOT(closeButtonClicked()));

    //ui.plData->setTitle("Data");
    ui.plData->setAxisTitle(QwtPlot::xBottom, "Time");
    ui.plData->setAxisTitle(QwtPlot::yLeft, "Temperature [Celsius]");
    ui.plData->setCanvasBackground(Qt::white);

    curve1 = new QwtPlotCurve("Measurements");
    curve1->attach(ui.plData);
    curve1->setPen(QPen(Qt::black, 1, Qt::SolidLine));

    ui.plData->replot();
}
Example #15
0
/*
 *  Constructs a CQUndoHistoryDialog as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal dialog.
 */
CQUndoHistoryDialog::CQUndoHistoryDialog(QWidget* parent, QUndoStack *undoStack, const char* name, bool modal, Qt::WindowFlags fl)
  : QDialog(parent, fl)
{
  setObjectName(QString::fromUtf8(name));
  setModal(modal);
  setupUi(this);
  connect(closeButton, SIGNAL(clicked()), this, SLOT(closeButtonClicked()));
  connect(undoButton, SIGNAL(clicked()), this, SLOT(undoButtonClicked()));

  mpUndoStack = undoStack;
  mNCol = 6; //total number of UNDO History column
  mSelectedIndex = 0;
// int count = mpUndoStack->count(); //number of command in unod stack

  // Create a new model
  // QStandardItemModel(int rows, int columns, QObject * parent = parent)
  mpModel = new QStandardItemModel(mpUndoStack->count(), mNCol, parent);

  // attach the model to the view
  mpUndoHistoryView->setModel(mpModel);

  //generate UNDO History data from undostack
  generateUndoData(mpUndoStack, mpUndoStack->count(), mNCol);
}
Example #16
0
      void Tuning::setup()
      {
        this->setFocusPolicy(Qt::TabFocus);
        this->installEventFilter(this->parent());
        layout_ = new TuningLayout(this);
        setLayout(layout_);

        setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

        /// Setup title bar
        titleBar_.reset(new TitleBar("Projector", this));
        connect(titleBar_.get(), SIGNAL(
                  closeButtonClicked()),              this,
                SLOT(prepareRemove()));
        connect(titleBar_.get(), SIGNAL(colorChanged(
                                          QColor const &)), this,
                SLOT(updateParameters()));
        connect(titleBar_.get(), SIGNAL(
                  freeSetupSelected()),               this,
                SLOT(
                  resetToFreeSetup()));
        connect(titleBar_.get(), SIGNAL(
                  peripheralSetupSelected()),         this,
                SLOT(resetToPeripheralSetup()));
        layout_->addWidget(titleBar_.get(), TuningLayout::Role::TITLE);

        /// Setup preview window
        glView_.reset(new TuningGLView(this));
        QSizePolicy _sizePolicy(QSizePolicy::Ignored,
                                QSizePolicy::Expanding);
        glView_->setSizePolicy(_sizePolicy);
        glView_->setKeepAspectRatio(true);
        glView_->setBorder(0.0);
        glView_->setViewOnly(true);
        glView_->setUpdateFrequency(10.0); // 10.0 fps
        glView_->installEventFilter(this);

        connect(glView_.get(), SIGNAL(dataModelChanged()), this,
                SIGNAL(dataModelChanged()));

        layout_->addWidget(glView_.get(), TuningLayout::Role::PREVIEW);

        /// FOV view slider
        /// @todo Connect this with threshold slider
        auto *_fov =  addWidget("FOV", 60.0, 10.0, 160.0);
        _fov->setSingleStep(1.0);
        _fov->setPageStep(5.0);
        _fov->setSuffix("°");
        connect(_fov, SIGNAL(valueChanged()), this, SLOT(setFov()));

        auto *_keystone = addWidget("Keystone", 0.0, -1.0, 2.0);
        _keystone->setSingleStep(0.01);
        _keystone->setPageStep(0.1);
        connect(_keystone, SIGNAL(valueChanged()), this,
                SLOT(setKeyStone()));

        /// Throw ratio slider
        /// @todo Connect this with FOV slider
        auto *_throwRatio = addWidget("Throw Ratio", 1.0, 0.2, 5.0);
        _throwRatio->setSingleStep(0.01);
        _throwRatio->setPageStep(0.05);

        //    _throwRatio->setScale(RangedFloat::Scale::RECIPROCAL);
        connect(_throwRatio, SIGNAL(valueChanged()), this,
                SLOT(setThrowRatio()));

        /// Yaw angle slider (all projector setups)
        auto && _yaw = addAngleWidget("Yaw", 0.0, 0.0, 360.0);
        _yaw->setSingleStep(0.1);
        _yaw->setPageStep(1.0);

        /// Tower height slider (PeripheralSetup only)
        auto && _towerHeight = addOffsetWidget("Tower Height",
                                               0.2,
                                               -0.5,
                                               1.0);

        /// Distance slider (PeripheralSetup only)
        auto && _distance = addOffsetWidget("Distance", 0.4, 0.0, 1.0);

        /// Shift offset slider (PeripheralSetup only)
        auto && _shift = addOffsetWidget("Shift", 0.0, -0.2, 0.2);

        /// X offset slider (FreeSetup only)
        auto && _x = addOffsetWidget("X", 0.0, -1.0, 1.0);

        /// Y offset slider (FreeSetup only)
        auto && _y = addOffsetWidget("Y", 0.0, -1.0, 1.0);

        /// Z offset slider (FreeSetup only)
        auto && _z = addOffsetWidget("Z", 0.0, -1.0, 1.0);

        /// Pitch angle slider (both setups)
        auto && _pitch = addAngleWidget("Pitch", 30.0, -180.0, 180.0);
        _pitch->setSingleStep(0.1);
        _pitch->setPageStep(1.0);
        _pitch->setPivot(0.0);

        /// Roll angle slider (both setups)
        auto && _roll = addAngleWidget("Roll", 0.0, -180.0, 180.0);
        _roll->setSingleStep(0.1);
        _roll->setPageStep(1.0);
        _roll->setPivot(0.0);

        /// Delta yaw angle slider (PeripheralSetup only)
        auto && _deltaYaw = addAngleWidget("Delta Yaw", 0.0, -45.0, 45.0);
        _deltaYaw->setSingleStep(0.1);
        _deltaYaw->setPageStep(1.0);
        _deltaYaw->setPivot(0.0);

        widgetgroup_type _titleAndPreview(
        {
          { titleBar_.get(), TuningLayout::Role::TITLE },
          { glView_.get(), TuningLayout::Role::PREVIEW }
        });

        auto addParameters =
          [&](widgetgroup_type const& _group,
              std::vector<QWidget *>const& _widgets) -> widgetgroup_type
          {
            widgetgroup_type _result = _group;

            for (auto& _widget :
                 _widgets) _result.emplace_back(_widget,
                                                TuningLayout::Role::PARAMETER);


            return _result;
          };

        addGroup("Minimized",
                 { { titleBar_.get(),
                     TuningLayout::Role::TITLE } });

        /// Make slider groups
        addGroup("PreviewOnly", _titleAndPreview);
        addGroup("FOVSliders",
                 addParameters(_titleAndPreview,
                               { _fov, _throwRatio, _keystone }));
        addGroup("FreeSetup",
                 addParameters(_titleAndPreview,
                               { _yaw, _pitch, _roll, _x, _y, _z, _fov,
                                 _throwRatio, _keystone }));
        addGroup("PeripheralSetup",
                 addParameters(_titleAndPreview,
                               { _yaw, _pitch, _distance, _towerHeight,
                                 _shift, _deltaYaw, _roll, _fov,
                                 _throwRatio, _keystone }));

        /// Setup/update mode
        sessionModeChange();

        for (int i = 0; i < layout_->count(); ++i) {
          auto _widget = layout_->itemAt(i)->widget();

          if (!_widget) continue;
          _widget->installEventFilter(this);
          _widget->installEventFilter(this->parent());
        }
      }
Example #17
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);
	}

	// 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(mouseMiddleClickTab(QWidget*)), SLOT(mouseMiddleClickTab(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);
	vert1->setMargin(1);
	vert1->addWidget(tabWidget_);

	setAcceptDrops(true);

	X11WM_CLASS("tabs");
	setLooks();

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

	setShortcuts();

	QSignalMapper* activateTabMapper_ = new QSignalMapper(this);
	connect(activateTabMapper_, SIGNAL(mapped(int)), tabWidget_, SLOT(setCurrentPage(int)));
	for (int i = 0; i < 10; ++i) {
		QAction* action = new QAction(this);
		connect(action, SIGNAL(triggered()), activateTabMapper_, SLOT(map()));
		action->setShortcuts(QList<QKeySequence>() << QKeySequence(QString("Ctrl+%1").arg(i))
		                                           << QKeySequence(QString("Alt+%1").arg(i)));
		activateTabMapper_->setMapping(action, (i > 0 ? i : 10) - 1);
		addAction(action);
	}

	if (size.isValid()) {
		resize(size);
	} else {
		resize(ChatDlg::defaultSize()); //TODO: no!
	}
}
AMDataSourcesEditor::AMDataSourcesEditor(AMScanSetModel* model, QWidget *parent) :
		QWidget(parent)
{
	detailEditor_ = 0;
	if (objectName().isEmpty())
		setObjectName(QString::fromUtf8("AMDataSourcesEditor"));
	resize(317, 230);
	QSizePolicy localSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
	localSizePolicy.setHorizontalStretch(0);
	localSizePolicy.setVerticalStretch(0);
	localSizePolicy.setHeightForWidth(sizePolicy().hasHeightForWidth());
	setSizePolicy(localSizePolicy);
	verticalLayout_ = new QVBoxLayout();
	verticalLayout_->setObjectName(QString::fromUtf8("verticalLayout"));
	scanSetView_ = new QTreeView();
	scanSetView_->setObjectName(QString::fromUtf8("scanSetView_"));
	scanSetView_->setAlternatingRowColors(true);

	verticalLayout_->addWidget(scanSetView_);

	addAnalysisToolButtonLayout_ = new QHBoxLayout();
	addAnalysisToolButtonLayout_->setObjectName(QString::fromUtf8("addAnalysisToolButtonLayout_"));
	addAnalysisToolButtonLayout_->setContentsMargins(12, 0, 12, -1);
	addDataSourceButton_ = new QToolButton();
	addDataSourceButton_->setObjectName(QString::fromUtf8("addDataSourceButton_"));

	addAnalysisToolButtonLayout_->addWidget(addDataSourceButton_);

	horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);

	addAnalysisToolButtonLayout_->addItem(horizontalSpacer_2);


	verticalLayout_->addLayout(addAnalysisToolButtonLayout_);

	analysisDetailsLayout_ = new QGridLayout();
	analysisDetailsLayout_->setObjectName(QString::fromUtf8("analysisDetailsLayout_"));
	analysisDetailsLayout_->setContentsMargins(-1, 0, -1, -1);
	nameEdit_ = new QLineEdit();
	nameEdit_->setObjectName(QString::fromUtf8("nameEdit_"));
	nameEdit_->setFrame(false);

	analysisDetailsLayout_->addWidget(nameEdit_, 0, 1, 1, 1);

	descriptionLabel_ = new QLabel();
	descriptionLabel_->setObjectName(QString::fromUtf8("descriptionLabel_"));
	descriptionLabel_->setStyleSheet(QString::fromUtf8("font: bold \"Lucida Grande\";\n"
"color: rgb(121,121,121);"));
	descriptionLabel_->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

	analysisDetailsLayout_->addWidget(descriptionLabel_, 1, 0, 1, 1);

	descriptionEdit_ = new QLineEdit();
	descriptionEdit_->setObjectName(QString::fromUtf8("descriptionEdit_"));
	descriptionEdit_->setFrame(false);

	analysisDetailsLayout_->addWidget(descriptionEdit_, 1, 1, 1, 1);

	nameLabel_ = new QLabel();
	nameLabel_->setObjectName(QString::fromUtf8("nameLabel_"));
	nameLabel_->setStyleSheet(QString::fromUtf8("font: bold \"Lucida Grande\";\n"
"color: rgb(121,121,121);"));
	nameLabel_->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

	analysisDetailsLayout_->addWidget(nameLabel_, 0, 0, 1, 1);


	verticalLayout_->addLayout(analysisDetailsLayout_);

	lineBreak_ = new QFrame();
	lineBreak_->setObjectName(QString::fromUtf8("lineBreak_"));
	lineBreak_->setFrameShape(QFrame::HLine);
	lineBreak_->setFrameShadow(QFrame::Sunken);

	verticalLayout_->addWidget(lineBreak_);

	detailEditorLayout_ = new QVBoxLayout();
	detailEditorLayout_->setObjectName(QString::fromUtf8("detailEditorLayout_"));

	verticalLayout_->addLayout(detailEditorLayout_);

	setWindowTitle(QApplication::translate("AMDataSourcesEditor", "Form", 0, QApplication::UnicodeUTF8));
	addDataSourceButton_->setText(QApplication::translate("AMDataSourcesEditor", "Add Analysis Tool", 0, QApplication::UnicodeUTF8));
	descriptionLabel_->setText(QApplication::translate("AMDataSourcesEditor", "description", 0, QApplication::UnicodeUTF8));
	nameLabel_->setText(QApplication::translate("AMDataSourcesEditor", "name", 0, QApplication::UnicodeUTF8));

	// Modify and adjust UI components
	nameEdit_->setReadOnly(true);	// you can't edit existing data source names.
	// When making new names for data sources, they better be mathematically sound variable names (No spaces, alphabetic character at beginning, no funky symbols, etc...)
	nameEdit_->setValidator(new QRegExpValidator(QRegExp("[A-Za-z_]\\w*"), this));



	// apply 'close item' boxes onto the list of data sources
	itemDelegate_ = new AMCloseItemDelegate();
	itemDelegate_->setCloseButtonsEnabled(true);
	connect(itemDelegate_, SIGNAL(closeButtonClicked(QModelIndex)), this, SLOT(onCloseButtonClicked(QModelIndex)));
	scanSetView_->setItemDelegate(itemDelegate_);

	// apply the existing scan set model to the data source list view:
	model_ = model;
	scanSetView_->setModel(model_);
	connect(scanSetView_->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(onSetViewIndexChanged(QModelIndex,QModelIndex)));

	// don't show the drop-down arrows for scans. (Saves a bit of room inside the list of channels.)
	scanSetView_->setRootIsDecorated(false);

	addDataSourceButton_->setDisabled(true);
	connect(addDataSourceButton_, SIGNAL(clicked()), this, SLOT(onAddDataSourceButtonClicked()));

	editingNewDataSourceName_ =  false;
	nameOfAnalysisBlockToBeAdded_ = "";

	connect(descriptionEdit_, SIGNAL(editingFinished()), this, SLOT(descriptionEditingFinished()));

	showAllDataSources_ = false;
	scanSetView_->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(scanSetView_, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint)));

	setLayout(verticalLayout_);
}
void MNavigationBarViewPrivate::init()
{
    Q_Q(MNavigationBarView);

    QGraphicsLinearLayout* contentLayout = new QGraphicsLinearLayout(controller);
    contentLayout->setContentsMargins(0, 0, 0, 0);
    content = new QGraphicsWidget;
    content->setObjectName("ContentToAnimate");
    contentLayout->addItem(content);

    applicationMenuButton = new MApplicationMenuButton(content);
    applicationMenuButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    escapeButtonSlot = new MEscapeButtonSlot(content);
    escapeButtonSlot->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    closeButton = new MButton(escapeButtonSlot);
    closeButton->setViewType("icon");

    backButton = new MButton(escapeButtonSlot);
    backButton->setViewType("icon");

    layout = new MLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    content->setLayout(layout);

    toolBarSlot = new QGraphicsWidget(content);
    toolBarSlot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    toolBarLayout = new QGraphicsLinearLayout;
    toolBarLayout->setContentsMargins(0, 0, 0, 0);
    toolBarLayout->setSpacing(0);
    toolBarSlot->setLayout(toolBarLayout);

    menuToolbarEscapePolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal);
    menuToolbarEscapePolicy->setSpacing(0);
    menuToolbarEscapePolicy->addItem(applicationMenuButton);
    menuToolbarEscapePolicy->addItem(toolBarSlot);
    menuToolbarEscapePolicy->addItem(escapeButtonSlot);

    escapeToolbarMenuPolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal);
    escapeToolbarMenuPolicy->setSpacing(0);
    escapeToolbarMenuPolicy->addItem(escapeButtonSlot);
    escapeToolbarMenuPolicy->addItem(toolBarSlot);
    escapeToolbarMenuPolicy->addItem(applicationMenuButton);

    escapeToolbarPolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal);
    escapeToolbarPolicy->setSpacing(0);
    escapeToolbarPolicy->addItem(escapeButtonSlot);
    escapeToolbarPolicy->addItem(toolBarSlot);

    toolbarPolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal);
    toolbarPolicy->setSpacing(0);
    toolbarPolicy->addItem(toolBarSlot);

    toolbarMenuPolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal);
    toolbarMenuPolicy->setSpacing(0);
    toolbarMenuPolicy->addItem(toolBarSlot);
    toolbarMenuPolicy->addItem(applicationMenuButton);

    customContentPolicy = new MLinearLayoutPolicy(layout, Qt::Horizontal);
    customContentPolicy->setSpacing(0);

    layout->setPolicy(toolbarPolicy);

    // Connects button signals
    QObject::connect(applicationMenuButton, SIGNAL(clicked()), controller, SIGNAL(viewmenuTriggered()));
    QObject::connect(closeButton, SIGNAL(clicked()), controller, SIGNAL(closeButtonClicked()));
    QObject::connect(backButton, SIGNAL(clicked()), controller, SIGNAL(backButtonClicked()));

    toolBarIsEmptyWatcher = new MDynamicPropertyWatcher;
    toolBarIsEmptyWatcher->setPropertyName("isEmpty");
    q->connect(toolBarIsEmptyWatcher, SIGNAL(propertyChanged()),
               SLOT(_q_updateIsEmptyAndJustEscapeButtonProperties()));
}
Example #20
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!
	}
}
void ossimQtElevationManagerDialog::setupUi(QDialog *ossimQtElevationManagerDialog)
{
   ossimQtElevationManagerDialog->setObjectName(QString::fromUtf8("ossimQtElevationManagerDialog"));
   vboxLayout = new QVBoxLayout(ossimQtElevationManagerDialog);
   vboxLayout->setSpacing(6);
   vboxLayout->setMargin(11);
   vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
   vboxLayout1 = new QVBoxLayout();
   vboxLayout1->setSpacing(6);
   vboxLayout1->setMargin(0);
   vboxLayout1->setObjectName(QString::fromUtf8("vboxLayout1"));
   hboxLayout = new QHBoxLayout();
   hboxLayout->setSpacing(6);
   hboxLayout->setMargin(0);
   hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
   theElevationCellGroup = new QGroupBox(ossimQtElevationManagerDialog);
   theElevationCellGroup->setObjectName(QString::fromUtf8("theElevationCellGroup"));
   // theElevationCellGroup->setColumnLayout(0, Qt::Vertical);
//   theElevationCellGroup->layout()->setSpacing(6);
//   theElevationCellGroup->layout()->setMargin(0);
   gridLayout = new QGridLayout(theElevationCellGroup);//->layout());
   gridLayout->setAlignment(Qt::AlignTop);
   gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
   gridLayout->setMargin(0);
   theElevationListBox = new QListWidget(theElevationCellGroup);
   theElevationListBox->setObjectName(QString::fromUtf8("theElevationListBox"));

   gridLayout->addWidget(theElevationListBox, 0, 0, 1, 1);


   hboxLayout->addWidget(theElevationCellGroup);

   vboxLayout2 = new QVBoxLayout();
   vboxLayout2->setSpacing(6);
   vboxLayout2->setMargin(0);
   vboxLayout2->setObjectName(QString::fromUtf8("vboxLayout2"));
   theAddButton = new QPushButton(ossimQtElevationManagerDialog);
   theAddButton->setObjectName(QString::fromUtf8("theAddButton"));

   vboxLayout2->addWidget(theAddButton);

   theAddDirectoryButton = new QPushButton(ossimQtElevationManagerDialog);
   theAddDirectoryButton->setObjectName(QString::fromUtf8("theAddDirectoryButton"));

   vboxLayout2->addWidget(theAddDirectoryButton);

   theRemoveButton = new QPushButton(ossimQtElevationManagerDialog);
   theRemoveButton->setObjectName(QString::fromUtf8("theRemoveButton"));

   vboxLayout2->addWidget(theRemoveButton);

   theRemoveAllButton = new QPushButton(ossimQtElevationManagerDialog);
   theRemoveAllButton->setObjectName(QString::fromUtf8("theRemoveAllButton"));

   vboxLayout2->addWidget(theRemoveAllButton);

   theMoveUpButton = new QPushButton(ossimQtElevationManagerDialog);
   theMoveUpButton->setObjectName(QString::fromUtf8("theMoveUpButton"));

   vboxLayout2->addWidget(theMoveUpButton);

   theMoveDownButton = new QPushButton(ossimQtElevationManagerDialog);
   theMoveDownButton->setObjectName(QString::fromUtf8("theMoveDownButton"));

   vboxLayout2->addWidget(theMoveDownButton);

   theMoveToTopButton = new QPushButton(ossimQtElevationManagerDialog);
   theMoveToTopButton->setObjectName(QString::fromUtf8("theMoveToTopButton"));

   vboxLayout2->addWidget(theMoveToTopButton);

   theMoveToBottomButton = new QPushButton(ossimQtElevationManagerDialog);
   theMoveToBottomButton->setObjectName(QString::fromUtf8("theMoveToBottomButton"));

   vboxLayout2->addWidget(theMoveToBottomButton);

   theMosaicButton = new QPushButton(ossimQtElevationManagerDialog);
   theMosaicButton->setObjectName(QString::fromUtf8("theMosaicButton"));

   vboxLayout2->addWidget(theMosaicButton);

   hboxLayout->addLayout(vboxLayout2);

   vboxLayout1->addLayout(hboxLayout);

   hboxLayout1 = new QHBoxLayout();
   hboxLayout1->setSpacing(6);
   hboxLayout1->setMargin(0);
   hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
   theElevationEnabledCheckBox = new QCheckBox(ossimQtElevationManagerDialog);
   theElevationEnabledCheckBox->setObjectName(QString::fromUtf8("theElevationEnabledCheckBox"));

   hboxLayout1->addWidget(theElevationEnabledCheckBox);

   theAutoLoadCheckBox = new QCheckBox(ossimQtElevationManagerDialog);
   theAutoLoadCheckBox->setObjectName(QString::fromUtf8("theAutoLoadCheckBox"));

   hboxLayout1->addWidget(theAutoLoadCheckBox);

   theAutoSortCheckBox = new QCheckBox(ossimQtElevationManagerDialog);
   theAutoSortCheckBox->setObjectName(QString::fromUtf8("theAutoSortCheckBox"));

   hboxLayout1->addWidget(theAutoSortCheckBox);

   vboxLayout1->addLayout(hboxLayout1);

   vboxLayout3 = new QVBoxLayout();
   vboxLayout3->setSpacing(6);
   vboxLayout3->setMargin(0);
   vboxLayout3->addSpacing(10);
   vboxLayout3->setAlignment(Qt::AlignHCenter);
   vboxLayout3->setObjectName(QString::fromUtf8("vboxLayout3"));
   hboxLayout3 = new QHBoxLayout();
   hboxLayout3->setSpacing(0);
   hboxLayout3->setMargin(0);
   hboxLayout3->setObjectName(QString::fromUtf8("hboxLayout3"));
   theHgtOffsetLabel = new QLabel("                               Height Offset");
   vboxLayout1->addWidget(theHgtOffsetLabel);
   theElevOffsetWidget = new QSlider(Qt::Horizontal, ossimQtElevationManagerDialog);
   theElevOffsetWidget->setObjectName(QString::fromUtf8("theElevOffsetWidget"));
   theElevOffsetWidget->setSingleStep(1);
   theElevOffsetWidget->setSliderPosition(0);
   theElevOffsetWidget->setPageStep(10);
   theElevOffsetWidget->setRange(-400,400);
   theElevOffsetWidget->setFixedWidth(250);
   theElevOffsetWidget->setTracking(false);
   theHgtOffsetValueLabel = new QLabel("0.0");
   theHgtOffsetValueLabel->setFixedWidth(80);
   theHgtOffsetValueLabel->setAlignment(Qt::AlignHCenter);
   hboxLayout3->addWidget(theElevOffsetWidget);
   hboxLayout3->addWidget(theHgtOffsetValueLabel);

   theAutoRefreshCheckBox = new QCheckBox(ossimQtElevationManagerDialog);
   theAutoRefreshCheckBox->setChecked(false);
   theAutoRefreshCheckBox->setObjectName(QString::fromUtf8("theAutoRefreshCheckBox"));
   hboxLayout3->addWidget(theAutoRefreshCheckBox);
   vboxLayout1->addLayout(hboxLayout3);

   //vboxLayout1->addLayout(vboxLayout3);

   vboxLayout->addLayout(vboxLayout1);

   line1 = new QFrame(ossimQtElevationManagerDialog);
   line1->setObjectName(QString::fromUtf8("line1"));
   line1->setFrameShape(QFrame::HLine);
   line1->setFrameShadow(QFrame::Sunken);

   vboxLayout->addWidget(line1);

   hboxLayout2 = new QHBoxLayout();
   hboxLayout2->setSpacing(6);
   hboxLayout2->setMargin(0);
   hboxLayout2->setObjectName(QString::fromUtf8("hboxLayout2"));
   spacerItem = new QSpacerItem(215, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);


   hboxLayout2->addItem(spacerItem);

   theCloseButton = new QPushButton(ossimQtElevationManagerDialog);
   theCloseButton->setObjectName(QString::fromUtf8("theCloseButton"));
   QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(0), static_cast<QSizePolicy::Policy>(0));
   sizePolicy.setHorizontalStretch(0);
   sizePolicy.setVerticalStretch(0);
   sizePolicy.setHeightForWidth(theCloseButton->sizePolicy().hasHeightForWidth());
   theCloseButton->setSizePolicy(sizePolicy);
   theCloseButton->setDefault(true);
   hboxLayout2->addWidget(theCloseButton);

   spacerItem1 = new QSpacerItem(215, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);

   hboxLayout2->addItem(spacerItem1);


   vboxLayout->addLayout(hboxLayout2);


    retranslateUi(ossimQtElevationManagerDialog);

    QSize size(320, 393);
    size = size.expandedTo(ossimQtElevationManagerDialog->minimumSizeHint());
    ossimQtElevationManagerDialog->resize(size);

    QObject::connect(theAddButton, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(addButtonClicked()));
    QObject::connect(theRemoveButton, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(removeButtonClicked()));
    QObject::connect(theRemoveAllButton, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(removeAllButtonClicked()));
    QObject::connect(theCloseButton, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(closeButtonClicked()));
    QObject::connect(theAddDirectoryButton, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(addDirectoryClicked()));
    QObject::connect(theElevationEnabledCheckBox, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(elevationEnabledCheckBoxClicked()));
    QObject::connect(theAutoLoadCheckBox, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(autoLoadCheckBoxClicked()));
    QObject::connect(theAutoSortCheckBox, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(autoSortingCheckBoxClicked()));
    QObject::connect(theMosaicButton, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(mosaicButtonClicked()));
    QObject::connect(theMoveUpButton, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(moveUpButtonClicked()));
    QObject::connect(theMoveDownButton, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(moveDownButtonClicked()));
    QObject::connect(theMoveToBottomButton, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(moveToBottomButtonClicked()));
    QObject::connect(theMoveToTopButton, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(moveToTopButtonClicked()));
    QObject::connect(theElevOffsetWidget, SIGNAL(valueChanged(int)), ossimQtElevationManagerDialog, SLOT(elevOffsetChanged(int)));
    QObject::connect(theAutoRefreshCheckBox, SIGNAL(clicked()), ossimQtElevationManagerDialog, SLOT(autoRefreshCheckBoxClicked()));

    QMetaObject::connectSlotsByName(ossimQtElevationManagerDialog);
    } // setupUi
Example #22
0
void UIMainFrame::slot_butClicked()
{
    QPushButton *but=qobject_cast<QPushButton *>(sender());
    Q_ASSERT(but);
    QString obj_name=but->objectName();

    const struct _ {
        const char *but;
        int page;
    } cParas[]= {
        {"buttonRouterState",0}
        ,{"buttonPwdSeting",1}
        ,{"buttonSoftWareSetting",2}
        ,{"buttonBlackList",3}
    };
    for(int i=0; i<sizeof(cParas)/sizeof(cParas[0]); i++)
    {
        if(obj_name==QString::fromUtf8(cParas[i].but))
        {
            mStack->setCurrentIndex(cParas[i].page);
            return;
        }
    }
    if(obj_name==QString::fromUtf8("buttonExit"))
    {
        emit closeButtonClicked();
    }
    else if(obj_name==QString::fromUtf8("buttonQuestion"))
    {
        emit questionButtonClicked();
    }
    else if(obj_name==QString::fromUtf8("buttonYes"))
    {
        QList<QLineEdit *> edt_lst;
        QStringList text_lst;
        getLables(edt_lst,&text_lst);

        bool haveText=false;
        for(int i=0; i<LT_NUM; i++)
        {
            if(!text_lst[i].isEmpty())
            {
                haveText=true;
                break;
            }
        }

        if(!haveText)
        {
            //todo message "No Data To Set"
            app()->showMessage(120031);
            return;
        }

        if((text_lst[LT_NEW_WIFI_PWD]!=text_lst[LT_NEW_WIFI_PWD_CONFIRM])
                ||(text_lst[LT_NEW_ADMIN_PWD]!=text_lst[LT_NEW_ADMIN_PWD_CONFIRM])
          )
        {
            //todo message "pwd not the same"
            app()->showMessage(120032);
            return;
        }
        if(!text_lst[LT_NEW_WIFI_PWD].isEmpty() && !app()->validateWifiPassword(text_lst[LT_NEW_WIFI_PWD]))
        {
            app()->showMessage(110503);
            return;
        }


        {
            m_activeWifiPassword = text_lst[LT_NEW_WIFI_PWD];
            m_op = app()->bean()->changeRouterPassword
                   (text_lst[LT_NEW_WIFI_PWD],QString()
                    , text_lst[LT_NEW_ADMIN_PWD], text_lst[LT_OLD_ADMIN_PWD]);
            app()->wait(m_op, this, "slot_OpReturned");
        }
    }
    else if(obj_name==QString::fromUtf8("buttonNo"))
    {
        QList<QLineEdit *> edt_lst;
        getLables(edt_lst);
        foreach(QLineEdit *edt,edt_lst)
        {
            edt->clear();
        }
    }
Example #23
0
      void Tuning::setup()
      {
        layout_ = new TuningLayout(this);
        setLayout(layout_);

        setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);

        /// Setup title bar
        titleBar_ = new TitleBar("Projector",this);
        titleBar_->installEventFilter(this);
        connect(titleBar_,SIGNAL(closeButtonClicked()),this,SLOT(prepareRemove()));
        layout_->addWidget(titleBar_,TuningLayout::Role::TITLE);

        /// Setup preview window
        glView_ = new TuningGLView(this);
        QSizePolicy _sizePolicy(QSizePolicy::Ignored,QSizePolicy::Expanding);
        glView_->setSizePolicy(_sizePolicy);
        glView_->setKeepAspectRatio(true);
        glView_->setBorder(0.0);
        glView_->setViewOnly(true);
        glView_->installEventFilter(this);
        layout_->addWidget(glView_,TuningLayout::Role::PREVIEW);

        fullscreen_.reset(new TuningGLView());
        fullscreen_->setViewOnly(true);
        fullscreen_->setShowCursor(true);
        fullscreen_->hide();

        /// FOV view slider
        /// @todo Connect this with threshold slider
        auto* _fov =  addWidget("FOV",60.0,10.0,160.0);
        _fov->setSingleStep(4.0);
        _fov->setPageStep(45.0);
        _fov->setSuffix("°");
        connect(_fov,SIGNAL(valueChanged()),this,SLOT(setFov()));

        /// Throw ratio slider
        /// @todo Connect this with FOV slider
        auto* _throwRatio = addWidget("Throw Ratio",1.0,0.1,5.0);
        _throwRatio->setSingleStep(0.1);
        _throwRatio->setPageStep(0.3);
        connect(_throwRatio,SIGNAL(valueChanged()),this,SLOT(setThrowRatio()));

        /// Yaw angle slider (all projector setups)
        auto&& _yaw = addAngleWidget("Yaw",0.0,0.0,360.0);

        /// Tower height slider (PeripheralSetup only)
        auto&& _towerHeight = addOffsetWidget("Tower Height",2.0,-5.0,10.0);
        _towerHeight->setSingleStep(0.1);
        _towerHeight->setPageStep(1.0);
        _towerHeight->setPivot(0.0);

        /// Distance slider (PeripheralSetup only)
        auto&& _distance = addOffsetWidget("Distance",5.0,0.0,10.0);
        _distance->setPageStep(1.0);

        /// Shift offset slider (PeripheralSetup only)
        auto&& _shift = addOffsetWidget("Shift",0.0,-2.0,2.0);
        _shift->setPageStep(1.0);
        _shift->setPivot(0.0);

        /// X offset slider (FreeSetup only)
        auto&& _x = addOffsetWidget("X",0.0,-10.0,10.0);
        _x->setPageStep(1.0);
        _x->setPivot(0.0);

        /// Y offset slider (FreeSetup only)
        auto&& _y = addOffsetWidget("Y",0.0,-10.0,10.0);
        _y->setPageStep(1.0);
        _y->setPivot(0.0);

        /// Z offset slider (FreeSetup only)
        auto&& _z = addOffsetWidget("Z",0.0,-10.0,10.0);
        _z->setPageStep(1.0);
        _z->setPivot(0.0);

        /// Pitch angle slider (both setups)
        auto&& _pitch = addAngleWidget("Pitch",30.0,-90.0,90.0);
        _pitch->setPivot(0.0);

        /// Roll angle slider (both setups)
        auto&& _roll = addAngleWidget("Roll",0.0,-45.0,45.0);
        _roll->setSingleStep(1.0);
        _roll->setPageStep(5.0);
        _roll->setPivot(0.0);

        /// Delta yaw angle slider (PeripheralSetup only)
        auto&& _deltaYaw = addAngleWidget("Delta Yaw",0.0,-45.0,45.0);
        _deltaYaw->setSingleStep(1.0);
        _deltaYaw->setPageStep(5.0);
        _deltaYaw->setPivot(0.0);

        widgetgroup_type _titleAndPreview(
        {
          { titleBar_, TuningLayout::Role::TITLE } ,
          { glView_, TuningLayout::Role::PREVIEW }
        });

        auto addParameters = [&](widgetgroup_type const& _group, std::vector<QWidget*> const& _widgets) -> widgetgroup_type
        {
          widgetgroup_type _result = _group;
          for (auto& _widget : _widgets)
            _result.emplace_back(_widget,TuningLayout::Role::PARAMETER);
          return _result;
        };

        addGroup("Minimized", { { titleBar_, TuningLayout::Role::TITLE } });

        /// Make slider groups
        addGroup("PreviewOnly",_titleAndPreview);
        addGroup("FOVSliders",addParameters(_titleAndPreview, { _fov, _throwRatio }));
        addGroup("FreeSetup",addParameters( _titleAndPreview, {_yaw, _pitch, _roll, _x, _y, _z }));
        addGroup("PeripheralSetup",
                 addParameters( _titleAndPreview,
        { _yaw, _pitch, _distance, _towerHeight, _shift, _deltaYaw, _roll }));

        /// Setup/update mode
        sessionModeChange();
      }
void KTabBar::mouseMoveEvent( QMouseEvent *e )
{
    if ( e->state() == LeftButton ) {
        QTab *tab = selectTab( e->pos() );
        if ( mDragSwitchTab && tab != mDragSwitchTab ) {
          mActivateDragSwitchTabTimer->stop();
          mDragSwitchTab = 0;
        }

        int delay = KGlobalSettings::dndEventDelay();
        QPoint newPos = e->pos();
        if( newPos.x() > mDragStart.x()+delay || newPos.x() < mDragStart.x()-delay ||
            newPos.y() > mDragStart.y()+delay || newPos.y() < mDragStart.y()-delay )
         {
            if( tab!= 0L ) {
                emit( initiateDrag( indexOf( tab->identifier() ) ) );
                return;
           }
       }
    }
    else if ( e->state() == MidButton ) {
        if (mReorderStartTab==-1) {
            int delay = KGlobalSettings::dndEventDelay();
            QPoint newPos = e->pos();
            if( newPos.x() > mDragStart.x()+delay || newPos.x() < mDragStart.x()-delay ||
                newPos.y() > mDragStart.y()+delay || newPos.y() < mDragStart.y()-delay )
            {
                QTab *tab = selectTab( e->pos() );
                if( tab!= 0L && mTabReorderingEnabled ) {
                    mReorderStartTab = indexOf( tab->identifier() );
                    grabMouse( sizeAllCursor );
                    return;
                }
            }
        }
        else {
            QTab *tab = selectTab( e->pos() );
            if( tab!= 0L ) {
                int reorderStopTab = indexOf( tab->identifier() );
                if ( mReorderStartTab!=reorderStopTab && mReorderPreviousTab!=reorderStopTab ) {
                    emit( moveTab( mReorderStartTab, reorderStopTab ) );
                    mReorderPreviousTab=mReorderStartTab;
                    mReorderStartTab=reorderStopTab;
                    return;
                }
            }
        }
    }

    if ( mHoverCloseButtonEnabled && mReorderStartTab==-1) {
        QTab *t = selectTab( e->pos() );

        //BEGIN Workaround
        //Qt3.2.0 (and 3.2.1) emit wrong local coordinates
        //for MouseMove events when the pointer leaves a widget. Discard those
        //to avoid enabling the wrong hover button
#ifdef __GNUC__
#warning "Workaround for Qt 3.2.0, 3.2.1 bug"
#endif
        if ( e->globalPos() != mapToGlobal( e->pos() ) )
            return;
        //END Workaround

        if( t && t->iconSet() && t->isEnabled() ) {
            QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal );
            QRect rect( 0, 0, pixmap.width() + 4, pixmap.height() +4);

            int xoff = 0, yoff = 0;
            // The additional offsets were found by try and error, TODO: find the rational behind them
            if ( t == tab( currentTab() ) ) {
#if QT_VERSION >= 0x030200
                xoff = style().pixelMetric( QStyle::PM_TabBarTabShiftHorizontal, this ) + 3;
                yoff = style().pixelMetric( QStyle::PM_TabBarTabShiftVertical, this ) - 4;
#else
                xoff = 3;
                yoff = -4;
#endif
            }
            else {
                xoff = 7;
                yoff = 0;
            }
            rect.moveLeft( t->rect().left() + 2 + xoff );
            rect.moveTop( t->rect().center().y()-pixmap.height()/2 + yoff );
            if ( rect.contains( e->pos() ) ) {
                if ( mHoverCloseButton ) {
                    if ( mHoverCloseButtonTab == t )
                        return;
                    mEnableCloseButtonTimer->stop();
                    delete mHoverCloseButton;
                }

                mHoverCloseButton = new QPushButton( this );
                mHoverCloseButton->setIconSet( KGlobal::iconLoader()->loadIcon("fileclose", KIcon::Toolbar, KIcon::SizeSmall, KIcon::ActiveState) );
                mHoverCloseButton->setGeometry( rect );
                QToolTip::add(mHoverCloseButton,i18n("Close this tab"));
                mHoverCloseButton->setFlat(true);
                mHoverCloseButton->show();
                if ( mHoverCloseButtonDelayed ) {
                  mHoverCloseButton->setEnabled(false);
                  mEnableCloseButtonTimer->start( QApplication::doubleClickInterval(), true );
                }
                mHoverCloseButtonTab = t;
                connect( mHoverCloseButton, SIGNAL( clicked() ), SLOT( closeButtonClicked() ) );
                return;
            }
        }
        if ( mHoverCloseButton ) {
            mEnableCloseButtonTimer->stop();
            delete mHoverCloseButton;
            mHoverCloseButton = 0;
        }
    }

    QTabBar::mouseMoveEvent( e );
}
/**
 * Constructor
 */
PsiTabWidget::PsiTabWidget(QWidget *parent)
    : QWidget(parent) {
    tabsPosition_ = QTabWidget::East; // impossible => uninitialised state
    tabBar_ = new PsiTabBar(this);

    bool multiRow = PsiOptions::instance()->getOption("options.ui.tabs.multi-rows", true).toBool();
    tabBar_->setMultiRow(multiRow);
    tabBar_->setUsesScrollButtons(!multiRow);
    layout_ = new QVBoxLayout(this);
    layout_->setMargin(0);
    layout_->setSpacing(0);
    barLayout_ = new QHBoxLayout;
    layout_->addLayout(barLayout_);
    barLayout_->setMargin(0);
    barLayout_->setSpacing(0);
    barLayout_->addWidget(tabBar_, 2);
    barLayout_->setAlignment(Qt::AlignLeft);

    int buttonwidth = qMax(tabBar_->style()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, tabBar_),
                           QApplication::globalStrut().width());

    downButton_ = new QToolButton(this);
    downButton_->setMinimumSize(3,3);
    downButton_->setFixedWidth(buttonwidth);
    downButton_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    menu_ = new QMenu(this);
    downButton_->setMenu(menu_);
    downButton_->setStyleSheet(" QToolButton::menu-indicator { image:none } ");
    connect(menu_, SIGNAL(aboutToShow()), SLOT(menu_aboutToShow()));
    connect(menu_, SIGNAL(triggered(QAction*)), SLOT(menu_triggered(QAction*)));
    barLayout_->addWidget(downButton_);
    barLayout_->setAlignment(downButton_, Qt::AlignBottom);

    closeButton_ = new QToolButton(this);
    closeButton_->setMinimumSize(3,3);
    closeButton_->setFixedWidth(buttonwidth);
    closeButton_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    barLayout_->addWidget(closeButton_);
    barLayout_->setAlignment(closeButton_, Qt::AlignBottom);
    closeButton_->setText("x");
    downButton_->setArrowType(Qt::DownArrow);
    downButton_->setPopupMode(QToolButton::InstantPopup);
    stacked_ = new QStackedLayout(layout_);

    setTabPosition(QTabWidget::North);
    setLooks();

    if (!PsiOptions::instance()->getOption("options.ui.tabs.show-tab-buttons").toBool()) {
        closeButton_->hide();
        downButton_->hide();
    }
#if QT_VERSION >= 0x040500
    if (!PsiOptions::instance()->getOption("options.ui.tabs.show-tab-close-buttons").toBool()) {
        tabBar_->setTabsClosable(false);
    }
#endif
    connect( tabBar_, SIGNAL(mouseDoubleClickTab(int)), SLOT(mouseDoubleClickTab(int)));
    connect( tabBar_, SIGNAL(mouseMiddleClickTab(int)), SLOT(mouseMiddleClickTab(int)));
    connect( tabBar_, SIGNAL( currentChanged(int)), SLOT(tab_currentChanged(int)));
    connect( tabBar_, SIGNAL( contextMenu(QContextMenuEvent*,int)), SLOT( tab_contextMenu(QContextMenuEvent*,int)));
    connect( closeButton_, SIGNAL(clicked()), SIGNAL(closeButtonClicked()));
    connect(tabBar_, SIGNAL(tabMoved(int,int)),SLOT(widgetMoved(int,int)));
    connect(tabBar_, SIGNAL(tabCloseRequested(int)),SIGNAL(tabCloseRequested(int)));
}
Example #26
0
      void TitleBar::setup()
      {
        this->label_->setAlignment(Qt::AlignCenter);
        this->label_->setStyleSheet("QLabel {"
                                    "  background: transparent; "
                                    "  color : #0e0e0e; "
                                    "  font-size : 10pt; "
                                    "}");

        layout()->removeWidget(this->label_);

        ///////////////////// Setup buttons
        auto setupToolButton = [this](QWidgetPtr<QToolButton>& _btn)
                               {
                                 _btn.reset(new QToolButton());
                                 _btn->setAutoRaise(true);
                                 _btn->setStyleSheet("QToolButton { "
                                                     "     background : transparent; "
                                                     "     border: 0px; "
                                                     " } "
                                                     "QToolButton::menu-indicator { image: none; }");
                                 _btn->installEventFilter(this->parent());
                                 _btn->installEventFilter(this);
                               };

        setupToolButton(menuButton_);

        menuButton_->setArrowType(Qt::DownArrow);

        menu_.reset(new QMenu);

        /// Generate and add popup menu
        menuButton_->setMenu(menu_.get());
        menuButton_->setPopupMode(QToolButton::InstantPopup);
        menuButton_->setArrowType(Qt::NoArrow);
        menuButton_->setIcon(QIcon(":/arrows/212121_90.png"));
        auto *_changeColor = menu_->addAction("Change color...");
        connect(_changeColor, SIGNAL(triggered()), this, SLOT(selectColor()));

        menu_->addSeparator();
        auto *_peripheral = menu_->addAction("Peripheral Setup");
        connect(_peripheral, SIGNAL(triggered()), this,
                SIGNAL(peripheralSetupSelected()));

        auto *_free = menu_->addAction("Free Setup");
        connect(_free, SIGNAL(triggered()), this, SIGNAL(freeSetupSelected()));

        setupToolButton(displayButton_);
        displayButton_->setCheckable(true);
        displayButton_->setChecked(true);
        displayButton_->setIcon(QIcon(":/icons/eye.png"));
        connect(displayButton_.get(), SIGNAL(clicked(bool)), tuningWidget(),
                SLOT(fullscreenToggle(bool)));

        setupToolButton(maximizeButton_);
        maximizeButton_->setIcon(QIcon(":/icons/maximize.png"));
        connect(maximizeButton_.get(), SIGNAL(clicked()), tuningWidget(),
                SLOT(setNextWindowState()));

        setupToolButton(closeButton_);
        closeButton_->setIcon(QIcon(":/icons/close.png"));
        connect(closeButton_.get(), SIGNAL(clicked()), this,
                SIGNAL(closeButtonClicked()));

        ///////////////////// END Setup buttons

        /// Add widget in this left-to-right order to layout
        layout()->addWidget(menuButton_.get());
        layout()->addWidget(displayButton_.get());
        layout()->addWidget(this->label_);
        layout()->addWidget(maximizeButton_.get());
        layout()->addWidget(closeButton_.get());
        layout()->setSpacing(0);
        layout()->setContentsMargins(0, 0, 0, 0);

        if (tuningWidget_ && tuningWidget_->tuning()) setColor(
            tuningWidget_->tuning()->color());
      }