void EventDetailsDialog::updateContent(const CommitDetails& details)
{
    QStackedLayout *layout = (QStackedLayout *)this->layout();
    layout->setCurrentIndex(INDEX_DETAILS_VIEW);

    model_->setCommitDetails(details);
}
EventDetailsDialog::EventDetailsDialog(const SeafEvent& event, QWidget *parent)
    : QDialog(parent),
      event_(event)
{
    setWindowTitle(tr("Modification Details"));
    setWindowIcon(QIcon(":/images/seafile.png"));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    QStackedLayout *layout = new QStackedLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    setLayout(layout);

    loading_view_ = new LoadingView;
    layout->addWidget(loading_view_);

    tree_ = new EventDetailsListView(event);
    model_ = new EventDetailsListModel(event);
    tree_->setModel(model_);

    layout->addWidget(tree_);

    request_ = 0;

    sendRequest();
}
Example #3
0
Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
//! [0]
    QWidget *firstPageWidget = new QWidget;
    QWidget *secondPageWidget = new QWidget;
    QWidget *thirdPageWidget = new QWidget;

    QStackedLayout *stackedLayout = new QStackedLayout;
    stackedLayout->addWidget(firstPageWidget);
    stackedLayout->addWidget(secondPageWidget);
    stackedLayout->addWidget(thirdPageWidget);

//! [0] //! [1]
    QComboBox *pageComboBox = new QComboBox;
    pageComboBox->addItem(tr("Page 1"));
    pageComboBox->addItem(tr("Page 2"));
    pageComboBox->addItem(tr("Page 3"));
    connect(pageComboBox, SIGNAL(activated(int)),
            stackedLayout, SLOT(setCurrentIndex(int)));
//! [1]

//! [2]
    QVBoxLayout *mainLayout = new QVBoxLayout;
//! [2]
    mainLayout->addWidget(pageComboBox);
//! [3]
    mainLayout->addLayout(stackedLayout);
    setLayout(mainLayout);
//! [3]
}
CloudView::CloudView(QWidget *parent)
    : QWidget(parent),
      in_refresh_(false),
      list_repo_req_(NULL)
{
    repos_list_ = new ServerReposListView;
    repos_model_ = new ServerReposListModel;
    repos_list_->setModel(repos_model_);

    createLoadingView();

    QStackedLayout *stack = new QStackedLayout;
    stack->insertWidget(INDEX_LOADING_VIEW, loading_view_);
    stack->insertWidget(INDEX_REPOS_LIST, repos_list_);
    setLayout(stack);

    prepareAccountButtonMenu();

    refresh_timer_ = new QTimer(this);
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshRepos()));

    connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
            this, SLOT(setCurrentAccount(const Account&)));

    connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
            this, SLOT(updateAccountMenu()));

    connect(seafApplet->accountManager(), SIGNAL(accountRemoved(const Account&)),
            this, SLOT(updateAccountMenu()));
}
Example #5
0
QHelpBox::QHelpBox(QWidget *_parent) : QWidget(_parent)
{
    defaultMsg = "";
    parent = _parent;
    helpBox = new QLabel();
    helpBox->setStyleSheet("border: 1px solid; border-color: rgb(71,127,249); background-color: rgb(245,245,245); margin-top:0px; "
                                               "margin-bottom:0px; margin-left: 0px; padding-right: 4px; padding-top:2px; padding-bottom:2px; padding-left:60px; text-align:justify;"
                           "");
    helpBox->setWordWrap(true);

  
    QFont tinyFont = QApplication::font();
	#if defined Q_OS_WIN
    tinyFont.setPointSize(7);
	#endif
    helpBox->setFont(tinyFont);

    QPixmap pixmap(":/icons/help.png");
    helpIcon = new QLabel();
    helpIcon->setPixmap(pixmap.scaled(35,35, Qt::KeepAspectRatio, Qt::SmoothTransformation));
    helpIcon->setStyleSheet("margin-left: 10px");

    QStackedLayout *helpLayout = new QStackedLayout();
    helpLayout->addWidget(helpBox);
    helpLayout->addWidget(helpIcon);
    helpLayout->setStackingMode(QStackedLayout::StackAll);
    setLayout(helpLayout);
}
Example #6
0
void MainWindow::changeMainView(QWidget *newWidget)
{
    QStackedLayout *mainLayout = (QStackedLayout *)ui->mainWidget->layout();
    if (mainLayout->currentWidget() == settingWidget)
    {
        mpdCommand->updateConnection();
    }

    mainLayout->setCurrentWidget(newWidget);
}
Example #7
0
////public////
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent,Qt::FramelessWindowHint)

{

//    this->setAutoFillBackground(true);
//    QPalette palette;
//    QPixmap pixmap(":/images/dialogbackground.jpg");
//    palette.setBrush(QPalette::Window, QBrush(pixmap));
//    this->setPalette(palette);
    this->setWindowIcon(QIcon(":./iamges/window.icon"));
    this->setAttribute(Qt::WA_TranslucentBackground);

    arcR=10;
    centralwidget=new CentralWidget(this);

     play_label=new PlayLabel(centralwidget);
     player = new SimPlayer;
     contralwidget=new ContralWidget(this,player);
//   contralwidget->setMainWindow(this);



     play_label->setPlayer(player);



     //////////////////////////////////////////////////布局
 //    this->setCentralWidget(centralwidget);
     QStackedLayout *stack =new  QStackedLayout;
     stack->setStackingMode(QStackedLayout::StackAll);


     stack->addWidget(play_label);
     stack->addWidget(contralwidget);
 //   play_label->show();
      centralwidget->setLayout(stack);


      this->setGeometry(100,100,760,460);
      BaseSetting::readSettings();

      centralwidget->setGeometry(0,0,this->width()-15,this->height()-15);



    HideSDLWindow(); //先设置好这个,再创建线程

    connect(player,SIGNAL(display()),play_label,SLOT(display()));

}
static PyObject *meth_QStackedLayout_insertWidget(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        int a0;
        QWidget* a1;
        PyObject *a1Wrapper;
        QStackedLayout *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "Bi@J8", &sipSelf, sipType_QStackedLayout, &sipCpp, &a0, &a1Wrapper, sipType_QWidget, &a1))
        {
            int sipRes = 0;

#line 74 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/sip/QtGui/qstackedlayout.sip"
        Py_BEGIN_ALLOW_THREADS
        sipCpp->insertWidget(a0, a1);
        Py_END_ALLOW_THREADS
        
        // The layout's parent widget (if there is one) will now have ownership.
        QWidget *parent = sipCpp->parentWidget();
        
        if (parent)
        {
            PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
            
            if (py_parent)
                sipTransferTo(a1Wrapper, py_parent);
        }
        else
        {
            // For now give the Python ownership to the layout.  This maintains
            // compatibility with previous versions and allows insertWidget(QWidget()).
            sipTransferTo(a1Wrapper, sipSelf);
        }
#line 704 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/QtGui/sipQtGuiQStackedLayout.cpp"

            return SIPLong_FromLong(sipRes);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QStackedLayout, sipName_insertWidget, doc_QStackedLayout_insertWidget);

    return NULL;
}
bool ProcessController::addSensor(const QString& hostName,
                                 const QString& sensorName,
                                 const QString& sensorType,
                                 const QString& title)
{
    if (sensorType != "table")
        return false;


    QStackedLayout *layout = new QStackedLayout(this);
    mProcessList = new KSysGuardProcessList(this, hostName);
    mProcessList->setUpdateIntervalMSecs(0); //we will call updateList() manually
    mProcessList->setContentsMargins(0,0,0,0);
    mProcessList->setScriptingEnabled(true);
    addActions(mProcessList->actions());
    connect(mProcessList, &KSysGuardProcessList::updated, this, &ProcessController::updated);
    connect(mProcessList, &KSysGuardProcessList::processListChanged, this, &ProcessController::processListChanged);
    mProcessList->setContextMenuPolicy( Qt::CustomContextMenu );
    connect(mProcessList, &KSysGuardProcessList::customContextMenuRequested, this, &ProcessController::showContextMenu);

    layout->addWidget(mProcessList);

    /** To use a remote sensor, we need to drill down through the layers, to connect to the remote processes.  Then connect to its signals and slots.
     *  It's horrible I know :( */
    if(!hostName.isEmpty() && hostName != "localhost") {
        KSysGuard::Processes *processes = mProcessList->processModel()->processController();
        mProcesses = processes;
        if(processes) {
            connect(processes, &KSysGuard::Processes::runCommand, this, &ProcessController::runCommand);
        }

    }

    setPlotterWidget(mProcessList);

    QTimer::singleShot(0, mProcessList->filterLineEdit(), SLOT(setFocus()));

    registerSensor(new KSGRD::SensorProperties(hostName, sensorName, sensorType, title));
    /* This just triggers the first communication. The full set of
    * requests are send whenever the sensor reconnects (detected in
    * sensorError(). */
    sensors().at(0)->setIsOk(true); //Assume it is okay from the start
    setSensorOk(sensors().at(0)->isOk());
    emit processListChanged();
    return true;
}
Example #10
0
QHelpBox::QHelpBox(QWidget *_parent) : QWidget(_parent)
{
    parent = _parent;

    backgroundPanel = new QLabel();
    backgroundPanel->setStyleSheet("border: 1px solid; border-color: rgb(71,127,249); background-color: rgb(245,245,245); margin-top:0px; "
                                               "margin-bottom:0px; margin-left: 0px; padding-right: 4px; padding-top:4px; padding-bottom:4px; padding-left:60px;"
                           "");

    helpBox = new QLabel();

    #ifdef Q_OS_LINUX
    QFont tinyFont = QApplication::font();
    tinyFont.setPointSize(9);
    helpBox->setFont(tinyFont);
    #endif

    helpBox->setStyleSheet("margin-top:0px; margin-bottom:0px; margin-left: 0px; padding-right: 4px; padding-top:4px; padding-bottom:4px; padding-left:60px; text-align:justify;");
    helpBox->setWordWrap(true);    
    helpBox->setTextFormat(Qt::RichText);
    helpBox->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
    helpBox->setOpenExternalLinks(true);
    QPixmap pixmap(":/icons/help2.png");
    helpIcon = new QLabel();
    helpIcon->setPixmap(pixmap.scaled(50,50, Qt::KeepAspectRatio, Qt::SmoothTransformation));
    helpIcon->setStyleSheet("margin-left: 5px");

    QStackedLayout *helpLayout = new QStackedLayout();
    helpLayout->addWidget(backgroundPanel);
    helpLayout->addWidget(helpIcon);
    helpLayout->addWidget(helpBox);
    helpLayout->setStackingMode(QStackedLayout::StackAll);
    setLayout(helpLayout);

    #ifdef Q_OS_MAC
    this->setFixedHeight(90);
    #endif
    #ifdef Q_OS_WIN32
    this->setFixedHeight(120);
    #endif
    #ifdef Q_OS_LINUX
    this->setFixedHeight(120);
    #endif

}
SigalDialog::SigalDialog(int isright,QString filename, RTFDocument *doc, QWidget *parent):
    QDialog(parent),
    ui(new Ui::SigalDialog)
{
    ui->setupUi(this);
    this->isright = isright;
    this->doc = doc;
    QStackedLayout *layout = new QStackedLayout(ui->ImageContainer);
    this->label = new ClickLabel(isright,filename,doc,this);
    layout->addWidget(label);
//    /label->setPixmap(QPixmap(filename));
    this->setWindowFlags(Qt::Dialog
                         |Qt::WindowMaximizeButtonHint
                         |Qt::WindowMinimizeButtonHint
                         |Qt::WindowCloseButtonHint);
    this->showMaximized();
    ui->okBut->setEnabled(false);
}
SettingDialog::SettingDialog(QWidget *parent):
    QDialog(parent)
//    , m_settingLayout(new QVBoxLayout(this))
//    , m_stackedWidget(new QStackedWidget)
//    , m_okBtn(new QPushButton(this))
{
    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setFixedSize(479, 421);
    this->setFocusPolicy(Qt::ClickFocus);
    this->setWindowTitle(tr("Kylin Weather - Setting"));
    this->setWindowIcon(QIcon(":/res/indicator-china-weather.png"));
    //Why????? setStyleSheet将导致添加城市后,列表没有自动拉伸,出现重叠,但是qDebug打印的高度确实增加了,但是使用paintEvent可以
    //this->setStyleSheet("QDialog{border:1px solid #000000;border-radius:2px;background:rgba(255, 255, 255, 0.7);}QDialog:hover{background: rgba(255, 255, 255, 1.0);}");


    initSettings();
    initSearch();

    QStackedLayout *contentLayout = new QStackedLayout(this);
    contentLayout->setContentsMargins(20, 20, 20, 20);
    contentLayout->setMargin(0);
    contentLayout->setSpacing(0);
    contentLayout->addWidget(m_settingFrame);
    contentLayout->addWidget(m_searchFrame);
    m_settingFrame->setVisible(true);
}
Example #13
0
void MainWindow::createLayout() {
  QGridLayout *topLayout = new QGridLayout;
  topLayout->addWidget(inputFileListLabel, 0, 0, 1, 1);
  topLayout->addWidget(inputFileListLineEdit, 0, 1, 1, 1);
  topLayout->addWidget(resultFileLabel, 1, 0, 1, 1);
  topLayout->addWidget(resultFileLineEdit, 1, 1, 1, 1);

  QStackedLayout *stackedLayout = new QStackedLayout;
  stackedLayout->addWidget(helium3Widget);
  stackedLayout->addWidget(antiHelium3Widget);
  stackedLayout->addWidget(hypertritonWidget);
  stackedLayout->addWidget(antiHypertritonWidget);

  connect(listWidget, &QListWidget::currentRowChanged, stackedLayout, &QStackedLayout::setCurrentIndex);
  listWidget->setCurrentRow(0);

  QGridLayout *middleLayout = new QGridLayout;
  middleLayout->addWidget(listWidget, 0, 0, 1, 1);
  middleLayout->addLayout(stackedLayout, 0, 1, 1, 1);
  middleLayout->setColumnStretch(0, 1);
  middleLayout->setColumnStretch(1, 3);

  QHBoxLayout *bottomLayout = new QHBoxLayout;
  bottomLayout->addStretch();
  bottomLayout->addWidget(cancelPushButton);
  bottomLayout->addWidget(okPushButton);

  QVBoxLayout *mainLayout = new QVBoxLayout;
  mainLayout->addLayout(topLayout);
  mainLayout->addLayout(middleLayout);
  mainLayout->addLayout(bottomLayout);

  centralWidget = new QWidget(this);
  centralWidget->setLayout(mainLayout);
  this->setCentralWidget(centralWidget);
}
Example #14
0
toResultPlanAbstr::toResultPlanAbstr(QWidget *parent)
	: QWidget(parent)
	, CursorChildSel(NULL)
	, DisplayChildCombo(false)
	, Explaining(false)
	, Query(NULL)
{
    using namespace ToConfiguration;
    planTreeView = new toResultPlanView(this);
    planTreeText = new QPlainTextEdit(this);
    planTreeText->setReadOnly(true);
    planTreeText->setFont(Utils::toStringToFont(toConfigurationNewSingle::Instance().option(Editor::ConfTextFont).toString()));

    //toExplainTypeButtonSingle::Instance().
    QStackedLayout  *mainLayout = new QStackedLayout;
    mainLayout->setSpacing(0);
    mainLayout->setContentsMargins(0, 0, 0, 0);

    mainLayout->addWidget(planTreeView);
    mainLayout->addWidget(planTreeText);
    mainLayout->setCurrentIndex(0);
    //mainLayout->setStackingMode(QStackedLayout::StackAll);
    setLayout(mainLayout);
}
Example #15
0
Speed::Speed(QWidget *parent): QWidget(parent)
{
	QHBoxLayout *layout = new QHBoxLayout();
	layout->setSpacing(0);
	layout->setMargin(0);
	
	setStyleSheet("padding: 0;");
	
		QVBoxLayout *contentLayout = new QVBoxLayout();
		contentLayout->setSpacing(2);
		contentLayout->setMargin(0);
		contentLayout->setContentsMargins(0, 2, 0, 0);
		
		QWidget *content = new QWidget();
		content->setLayout(contentLayout);
		content->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
			
			QStackedLayout *speedometerLayout = new QStackedLayout(contentLayout);
			speedometerLayout->setSpacing(2);
			speedometerLayout->setMargin(0);
			speedometerLayout->setContentsMargins(0, 2, 0, 0);
			speedometerLayout->setStackingMode(QStackedLayout::StackAll);
			
			speedometerNeedle = new RotatableImageView(":/resources/speedometer-needle_160x160.png");
			speedometerNeedle->rotate(-129);
			speedometerLayout->addWidget(speedometerNeedle);
			
			QLabel *speedometer = new QLabel();
			speedometer->setPixmap(QPixmap(":/resources/speedometer_160x160.png"));
			speedometer->setMargin(2);
			speedometerLayout->addWidget(speedometer);
			
			speedometerLabel = new QLabel("N/A");
			speedometerLabel->setAlignment(Qt::AlignCenter);
			speedometerLabel->setStyleSheet("font: 13pt; font-weight: bold;");
			contentLayout->addWidget(speedometerLabel);
		
		TitledBox *box = new TitledBox(tr("Speed"), content);
		layout->addWidget(box);
		
	QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect();
	dropShadow->setBlurRadius(6);
	dropShadow->setColor(QColor(0, 0, 0));
	dropShadow->setOffset(0, 0);
	
	setGraphicsEffect(dropShadow);
	
	setLayout(layout);
}
WeatherPlugin::WeatherPlugin(QObject *parent)
    : QObject(parent),
      m_view(new QFrame),
      m_requestManager(new WeatherRequest(this))
{
    WeatherWidget *weatherWidget = new WeatherWidget(m_requestManager);
    SetLocationPage *locationPage = new SetLocationPage(m_requestManager);

    QStackedLayout *layout = new QStackedLayout;
    layout->setSpacing(0);
    layout->setMargin(0);

    layout->addWidget(weatherWidget);
    layout->addWidget(locationPage);

    m_view->setLayout(layout);
    m_view->setObjectName("WeatherView");
    m_view->setStyleSheet("#WeatherView {"
                          "background-color: rgba(255, 255, 255, .03);"
                          "}");

    connect(weatherWidget, &WeatherWidget::locationButtonClicked, this, [this, layout, locationPage] {
        locationPage->reset();
        locationPage->setCurrentCity(m_requestManager->city());
        layout->setCurrentWidget(locationPage);
    });

    connect(locationPage, &SetLocationPage::citySet, this, [this, layout, weatherWidget] (const QString &preferredService, const City &city) {
        qDebug() << "set city to " << city.localizedName;
        QList<WeatherItem> empty;
        weatherWidget->refreshView(empty);
        m_requestManager->setPreferredWeatherService(preferredService);
        m_requestManager->setCity(city);
        layout->setCurrentWidget(weatherWidget);
    });

    connect(locationPage, &SetLocationPage::cancelled, this, [=] {
        qDebug() << "cancelled setting city" ;
        layout->setCurrentWidget(weatherWidget);
    });
}
Example #17
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    settingWidget = new SettingWidget();
    playListWidget = new PlayListWidget();
    nowPlayingWidget = new NowPlayingWidget();
    mediaLibraryWidget = new MediaLibraryWidget();
    mpdCommand = MpdCommand::getInstance();

    QStackedLayout *mainLayout = new QStackedLayout();
    mainLayout->addWidget(settingWidget);
    mainLayout->addWidget(nowPlayingWidget);
    mainLayout->addWidget(playListWidget);
    mainLayout->addWidget(mediaLibraryWidget);
    mainLayout->setCurrentWidget(settingWidget);
    ui->mainWidget->setLayout(mainLayout);

    connect(mpdCommand, SIGNAL(error(int, const QString&)),
            this, SLOT(displayError(int, const QString&)));
}
Example #18
0
void ScriptToolbox::layoutStackedInsertWidget(QObject * obj, int index, QWidget * widget)
{
  QStackedLayout * layout = qobject_cast<QStackedLayout*>(obj);
  if(layout && widget)
    layout->insertWidget(index, widget);
}
Example #19
0
void ServiceBrowser::initWidgets()
{
    showAllServicesItem = new QListWidgetItem(tr("(All registered services)"));

    servicesListWidget = new QListWidget;
    interfacesListWidget = new QListWidget;
    interfacesListWidget->addItem(tr("(Select a service)"));
    attributesListWidget = new QListWidget;
    attributesListWidget->addItem(tr("(Select an interface implementation)"));

    connect(servicesListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
            this, SLOT(reloadInterfaceImplementationsList()));

    connect(interfacesListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
            this, SLOT(currentInterfaceImplChanged(QListWidgetItem*,QListWidgetItem*)));

    defaultInterfaceButton = new QPushButton(tr("Set as default implementation"));
    defaultInterfaceButton->setEnabled(false);
    connect(defaultInterfaceButton, SIGNAL(clicked()),
            this, SLOT(setDefaultInterfaceImplementation()));

    selectedImplRadioButton = new QRadioButton(tr("Selected interface implementation"));
    defaultImplRadioButton = new QRadioButton(tr("Default implementation"));
    selectedImplRadioButton->setChecked(true);

    QButtonGroup *radioButtons = new QButtonGroup(this);
    radioButtons->addButton(selectedImplRadioButton);
    radioButtons->addButton(defaultImplRadioButton);
    connect(radioButtons, SIGNAL(buttonClicked(QAbstractButton*)),
            this, SLOT(reloadAttributesList()));

    QGroupBox *servicesGroup = new QGroupBox(tr("Show services for:"));
    QVBoxLayout *servicesLayout = new QVBoxLayout;
    servicesLayout->addWidget(servicesListWidget);
    servicesGroup->setLayout(servicesLayout);

    interfacesGroup = new QGroupBox(tr("Interface implementations"));
    QVBoxLayout *interfacesLayout = new QVBoxLayout;
    interfacesLayout->addWidget(interfacesListWidget);
    interfacesLayout->addWidget(defaultInterfaceButton);
    interfacesGroup->setLayout(interfacesLayout);

    attributesGroup = new QGroupBox(tr("Invokable attributes"));
    QVBoxLayout *attributesLayout = new QVBoxLayout;
    attributesLayout->addWidget(attributesListWidget);
#if !defined(Q_WS_MAEMO_5)
    // No space on the screen to show following title in Maemo
    attributesLayout->addWidget(new QLabel(tr("Show attributes for:")));
#endif
    attributesLayout->addWidget(selectedImplRadioButton);
    attributesLayout->addWidget(defaultImplRadioButton);
    attributesGroup->setLayout(attributesLayout);

#if defined(Q_WS_MAEMO_5)
    // Maemo 5 style doesn't take group box titles into account.
    int spacingHack = QFontMetrics(QFont()).height();
    interfacesLayout->setContentsMargins(0, spacingHack, 0, 0);
    attributesLayout->setContentsMargins(0, spacingHack, 0, 0);
    servicesLayout->setContentsMargins(0, spacingHack, 0, 0);
#endif
#if defined(MEEGO_EDITION_HARMATTAN)
    QGridLayout *layout = new QGridLayout;
    layout->addWidget(servicesGroup, 0, 0);
    layout->addWidget(attributesGroup, 0, 1, 2, 1);
    layout->addWidget(interfacesGroup, 1, 0);
#else
    QVBoxLayout *layout = new QVBoxLayout;    
    QStackedLayout *stackedLayout = new QStackedLayout;
    stackedLayout->addWidget(servicesGroup);
    stackedLayout->addWidget(interfacesGroup);
    stackedLayout->addWidget(attributesGroup);
    
    QComboBox *pageComboBox = new QComboBox;
    pageComboBox->addItem(tr("Services"));
    pageComboBox->addItem(tr("Interfaces"));
    pageComboBox->addItem(tr("Attributes"));
    connect(pageComboBox, SIGNAL(activated(int)),
            stackedLayout, SLOT(setCurrentIndex(int)));
    
    layout->addWidget(pageComboBox);
    layout->addLayout(stackedLayout);
#endif

    setLayout(layout);
}
void CloudView::showReposList()
{
    QStackedLayout *stack = (QStackedLayout *)(layout());
    stack->setCurrentIndex(INDEX_REPOS_LIST);
}
void CloudView::showLoadingView()
{
    QStackedLayout *stack = (QStackedLayout *)(layout());

    stack->setCurrentIndex(INDEX_LOADING_VIEW);
}
void RackWindow::createPluginHost(int position)
{
    //layout settings widget:
    QWidget *settingsWidget = new QWidget;
    settingsWidget->setPalette(QPalette(QColor(0,0,0,160)));
    settingsWidget->setAutoFillBackground(true);

    RPushButton *leftButton = new RPushButton;
    leftButton->setObjectName("rackSettingsLeftArrowButton");
    RPushButton *rightButton = new RPushButton;
    rightButton->setObjectName("rackSettingsRightArrowButton");
    RPushButton *topButton = new RPushButton;
    topButton->setObjectName("rackSettingsTopArrowButton");
    RPushButton *bottomButton = new RPushButton;
    bottomButton->setObjectName("rackSettingsBottomArrowButton");
    RPushButton *closeButton = new RPushButton;
    closeButton->setObjectName("rackSettingsCloseButton");

    //vertical toolbar for plugin buttons:
    QToolBar *pluginHostToolBar = new QToolBar;
    pluginHostToolBar->setObjectName("rackPluginHostToolBar");
    pluginHostToolBar->setOrientation(Qt::Vertical);
    //actiongroup for exclusive handling of buttons:
    QActionGroup *ag = new QActionGroup(pluginHostToolBar);
    ag->setExclusive(true);

    RPushButton *addPluginWidgetButton = new RPushButton(tr("Add Widget ..."));
    addPluginWidgetButton->setObjectName("rackAddPluginWidgetButton");

    QWidget *middleWidget = new QWidget;
    QVBoxLayout *middleLayout = new QVBoxLayout(middleWidget);
    middleLayout->setSpacing(0);
    middleLayout->setContentsMargins(0,0,0,0);
    middleLayout->addWidget(pluginHostToolBar, 0, Qt::AlignHCenter);
    middleLayout->addWidget(addPluginWidgetButton, 0, Qt::AlignHCenter);

    QGridLayout *settingsLayout = new QGridLayout(settingsWidget);
    settingsLayout->setSpacing(0);
    settingsLayout->setContentsMargins(0,0,0,0);
    settingsLayout->addWidget(topButton,0,1, Qt::AlignTop | Qt::AlignHCenter);
    settingsLayout->addWidget(closeButton,0,2, Qt::AlignTop | Qt::AlignRight);
    settingsLayout->addWidget(leftButton,1,0, Qt::AlignLeft);
    settingsLayout->addWidget(rightButton,1,2, Qt::AlignRight);
    settingsLayout->addWidget(bottomButton,2,1, Qt::AlignBottom| Qt::AlignHCenter);
    settingsLayout->addWidget(middleWidget,1,1);

    QStackedWidget *pluginStack = new QStackedWidget;
    pluginStack->setObjectName("rackPluginStack");
    pluginStack->setAutoFillBackground(true);

    QWidget *pluginHost = new QWidget;
    pluginHost->setMinimumSize(200,80);

    QStackedLayout *overlayLayout = new QStackedLayout(pluginHost);
    overlayLayout->setStackingMode(QStackedLayout::StackAll);
    overlayLayout->addWidget(pluginStack);
    overlayLayout->addWidget(settingsWidget);
    overlayLayout->setCurrentIndex(1);

    //enter/leave settings signals:
    QSignalMapper *mapperShowSettingsMode = new QSignalMapper(pluginHost);
    QObject::connect(this, SIGNAL(enterSettingsMode()), mapperShowSettingsMode, SLOT(map()));
    mapperShowSettingsMode->setMapping(this, 1);
    QSignalMapper *mapperHideSettingsMode = new QSignalMapper(pluginHost);
    QObject::connect(this, SIGNAL(leaveSettingsMode()), mapperHideSettingsMode, SLOT(map()));
    mapperHideSettingsMode->setMapping(this, 0);
    QObject::connect(mapperShowSettingsMode, SIGNAL(mapped(int)), overlayLayout, SLOT(setCurrentIndex(int)));
    QObject::connect(mapperHideSettingsMode, SIGNAL(mapped(int)), overlayLayout, SLOT(setCurrentIndex(int)));

    //create plugin host widget signals:
    QSignalMapper *mapperCreatePluginHost = new QSignalMapper(pluginHost);
    QObject::connect(leftButton, SIGNAL(clicked()), mapperCreatePluginHost, SLOT(map()));
    QObject::connect(rightButton, SIGNAL(clicked()), mapperCreatePluginHost, SLOT(map()));
    QObject::connect(topButton, SIGNAL(clicked()), mapperCreatePluginHost, SLOT(map()));
    QObject::connect(bottomButton, SIGNAL(clicked()), mapperCreatePluginHost, SLOT(map()));
    mapperCreatePluginHost->setMapping(leftButton, NewSplitterLeft);
    mapperCreatePluginHost->setMapping(rightButton, NewSplitterRight);
    mapperCreatePluginHost->setMapping(topButton, NewSplitterTop);
    mapperCreatePluginHost->setMapping(bottomButton, NewSplitterBottom);
    QObject::connect(mapperCreatePluginHost, SIGNAL(mapped(int)), SLOT(createPluginHost(int)));

    //load plugin signal:
    QObject::connect(addPluginWidgetButton, SIGNAL(clicked()), m_mapperLoadNewPlugin, SLOT(map()));
    m_mapperLoadNewPlugin->setMapping(addPluginWidgetButton, pluginHost);

    //close plugin host signal:
    QObject::connect(closeButton, SIGNAL(clicked()), m_mapperClosePluginHost, SLOT(map()));
    m_mapperClosePluginHost->setMapping(closeButton, pluginHost);

    //create plugin switch signalmapper
    QSignalMapper *mapperSwitchPlugin = new QSignalMapper(pluginHost);
    mapperSwitchPlugin->setObjectName("rackPluginSwitchMapper");
    QObject::connect(mapperSwitchPlugin, SIGNAL(mapped(QWidget *)), pluginStack, SLOT(setCurrentWidget(QWidget *)));


    ////test show/hide plugin widget

    ////QObject::connect(mapperSwitchPlugin, SIGNAL(mapped(QWidget *)), this, SLOT(showHidePluginWidget(QWidget*)));


    //////


    //create plugin toolbar for mainwindow
    QToolBar *pluginToolBar = new QToolBar;
    pluginToolBar->setObjectName("rackPluginToolBar");
    pluginToolBar->setMovable(false);
    pluginToolBar->hide();
    addToolBar(Qt::BottomToolBarArea, pluginToolBar);

    //store the toolbar pointer as dynamic property to access later when creating plugin toolbar buttons
    pluginHost->setProperty("pluginToolBar", qVariantFromValue((QWidget *)pluginToolBar));

    //plugin bar signals & slots:
    QObject::connect(this, SIGNAL(enterSettingsMode()), pluginToolBar, SLOT(hide()));
    QObject::connect(this, SIGNAL(leaveSettingsMode()), pluginToolBar, SLOT(show()));







    //insert new pluginhost widget in splitter, create new splitter if necessary
    if (position == 0)
    {
        m_mainSplitter->addWidget(pluginHost);
        return;
    }
    QSignalMapper *sm = qobject_cast<QSignalMapper *>(sender());
    QWidget *senderPluginHost = qobject_cast<QWidget *>(sm->mapping(position)->parent()->parent());
    RSplitter *parentSplitter = qobject_cast<RSplitter *>(senderPluginHost->parent());
    QList<int> widgetsizes;
    int senderpos = parentSplitter->indexOf(senderPluginHost);
    int newposition;
    if ((position == NewSplitterLeft) or (position == NewSplitterTop)) newposition = senderpos;
    else newposition = senderpos + 1;
    switch (position + parentSplitter->orientation()) {             //horizontal=1 vertical=2
    case 0:                                                         //left   horizontal / top vertical
    case 2:                                                         //right  horizontal
    case 4:                                                         //bottom vertical
        widgetsizes = parentSplitter->sizes();
        widgetsizes.replace(senderpos, int(widgetsizes.at(senderpos)/2));
        widgetsizes.insert(senderpos + 1, widgetsizes.at(senderpos));
        parentSplitter->insertWidget(newposition, pluginHost);
        parentSplitter->setSizes(widgetsizes);
        break;
    case  1:                                                        //left  vertical
    case  3:                                                        //right vertical / bottom horizontal
    case -1:                                                        //top   horizontal
        if (parentSplitter->count() == 1)
        {
            parentSplitter->setOrientation(Qt::Orientation(abs(position)));
            widgetsizes = parentSplitter->sizes();
            widgetsizes.replace(0, int(widgetsizes.at(0)/2));
            widgetsizes.append(widgetsizes.at(0));
            parentSplitter->insertWidget(newposition, pluginHost);
            parentSplitter->setSizes(widgetsizes);
        }
        else if (parentSplitter->count() > 1)
        {
            RSplitter *newSplitter = new RSplitter(Qt::Orientation(abs(position)));
            QObject::connect(this, SIGNAL(enterSettingsMode()), newSplitter, SIGNAL(enterSettingsMode()));
            QObject::connect(this, SIGNAL(leaveSettingsMode()), newSplitter, SIGNAL(leaveSettingsMode()));
            widgetsizes = parentSplitter->sizes();
            parentSplitter->insertWidget(parentSplitter->indexOf(senderPluginHost), newSplitter);
            newSplitter->addWidget(senderPluginHost);
            QList<int> newsizes = newSplitter->sizes();
            newsizes.replace(0, int(newsizes.at(0)/2));
            newsizes.append(newsizes.at(0));
            if ((position == NewSplitterLeft) or (position == NewSplitterTop)) newSplitter->insertWidget(0, pluginHost);
            else newSplitter->addWidget(pluginHost);
            newSplitter->setSizes(newsizes);
            parentSplitter->setSizes(widgetsizes);
        }
        break;
    }
}
Example #23
0
NewFileDialog::NewFileDialog(QWidget *parent):QDialog(parent)
{

  this->setupUi(this);
  this->createButton->setDisabled(true);
  connect(this->browse,SIGNAL(clicked()),SLOT(browseFile()));
  connect(this->filepath,SIGNAL(textChanged(QString)),SLOT(setButtonStatus()));
  this->filetypes->addItem(QString("Client-Side Files"));
  this->filetypes->addItem(QString("Server-Side Files"));
  this->filetypes->setCurrentRow(0);

  //the client side widgets);
  this->clientside = new QWidget(this);
  QHBoxLayout *clientsidelayout = new QHBoxLayout(this->clientside);
  this->clientside->setLayout(clientsidelayout);
  clientsidelayout->setMargin(0);
  this->clientSideFileTypes = new QListWidget(this);
  this->clientSideFileTypes->addItem(tr("HTML File"));
  this->clientSideFileTypes->addItem(tr("CSS File"));
  this->clientSideFileTypes->addItem(tr("Javascript File"));
  this->clientSideFileTypes->addItem(tr("Adobe Flex MXML File"));
  this->clientSideFileTypes->setCurrentRow(0);

  this->clientsidedetail = new QWidget(this);
  QStackedLayout *clientsidedetaillayout = new QStackedLayout(this->clientsidedetail);
  this->clientsidedetail->setLayout(clientsidedetaillayout);
  clientsidedetaillayout->setMargin(0);

  QListWidget *htmlTemplates = new QListWidget(this);
  htmlTemplates->addItem(tr("Plain HTML File"));
  htmlTemplates->setCurrentRow(0);

  QListWidget *cssTemplates = new QListWidget(this);
  cssTemplates->addItem(tr("Plain CSS File"));
  cssTemplates->setCurrentRow(0);

  QListWidget *jsTemplates = new QListWidget(this);
  jsTemplates->addItem(tr("Plain JS File"));
  jsTemplates->setCurrentRow(0);

  QListWidget *mxmlTemplates = new QListWidget(this);
  mxmlTemplates->addItem(tr("Plain MXML File"));
  mxmlTemplates->setCurrentRow(0);

  clientsidedetaillayout->addWidget(htmlTemplates);
  clientsidedetaillayout->addWidget(cssTemplates);
  clientsidedetaillayout->addWidget(jsTemplates);
  clientsidedetaillayout->addWidget(mxmlTemplates);
  connect(this->clientSideFileTypes,SIGNAL(currentRowChanged(int)),clientsidedetaillayout,SLOT(setCurrentIndex(int)));


  clientsidelayout->addWidget(this->clientSideFileTypes);
  clientsidelayout->addWidget(this->clientsidedetail);

  this->serverSideFileTypes = new QListWidget(this);
  this->serverSideFileTypes->addItem(tr("PHP File"));
  this->serverSideFileTypes->setCurrentRow(0);
  //this->serverSideFileTypes->addItem(tr("Python File"));

  this->detailLayout = new QStackedLayout();
  detailLayout->setMargin(0);
  this->detail->setLayout(this->detailLayout);
  detailLayout->addWidget(this->clientside);
  detailLayout->addWidget(this->serverSideFileTypes);

  connect(this->filetypes,SIGNAL(currentRowChanged(int)),this->detailLayout,SLOT(setCurrentIndex(int)));


}
Example #24
0
void
MainWindow::useNewUI()
{
#if (QT_VERSION >= 0x040400)
    QVBoxLayout *mainLayout;
    QStackedLayout *logoLayout;
    QGridLayout *bottomLayout;

    QHBoxLayout *pathSizeLayout;
    QPushButton *writeButton;

    // Set the background colour
    QPalette pal = palette();
    pal.setColor(QPalette::Window, Qt::white);
    setPalette(pal);

    imageLabel = new CustomLabel(this);
    imageLabel->setBackgroundRole(QPalette::Base);
    imageLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    imageLabel->setScaledContents(false);
    QImage image(":logo-empty.png");
    imageLabel->setPixmap(QPixmap::fromImage(image));
    imageLabel->setAlignment(Qt::AlignCenter);

    directive = new CustomLabel(this);
    directive->setText(tr("Drag disk image here\n or click to select."));
    directive->setAlignment(Qt::AlignCenter);
    deviceComboBox = new QComboBox;
    deviceComboBox->addItem(DROPDOWN_DIRECTIVE);
    writeButton = new QPushButton(tr("Write"));
    connect(writeButton, SIGNAL(clicked()), this, SLOT(write()));

    // These layouts are kind of a mess
    logoLayout = new QStackedLayout;
    logoLayout->setStackingMode(QStackedLayout::StackAll);
    logoLayout->addWidget(directive);
    logoLayout->addWidget(imageLabel);

    pathSizeLayout = new QHBoxLayout;
    pathSizeLayout->addWidget(fileLabel, Qt::AlignLeft);
    pathSizeLayout->addWidget(fileSize, Qt::AlignLeft);

    bottomLayout = new QGridLayout;
    bottomLayout->addLayout(pathSizeLayout, 0, 0);

    mainLayout = new QVBoxLayout;
    AboutLabel *aboutLabel = new AboutLabel();
    aboutLabel->setText("<u>About</u>");

    mainLayout->addWidget(aboutLabel,0,Qt::AlignTop|Qt::AlignLeft);
    mainLayout->addLayout(logoLayout, Qt::AlignHCenter);

    QGridLayout *comboLayout = new QGridLayout;
    comboLayout->addLayout(bottomLayout, 0, 0, Qt::AlignBottom);
    comboLayout->addWidget(deviceComboBox, 1,0);
    comboLayout->addWidget(writeButton, 1, 1, Qt::AlignRight);
    mainLayout->addLayout(comboLayout);

    setLayout(mainLayout);
    if (!mMaximized)
        resize(600, 400);

    setAcceptDrops(true);
#endif

    return;
}
void MainWindow::setupGui()
{
    QWidget* centralWidget = NULL;
#ifdef USE_OPENGL_RENDER

    if(player() && player()->isSupportOpenGL() && m_opengl_enabled)
    {
        bool opengl_windget_created = false;
        do {
            // Enable OpenGL render
            centralWidget = new OpenGLWidgetContainer;
            QOpenGLWidget* opengl_widget = dynamic_cast<QOpenGLWidget*>(centralWidget);
            if(!opengl_widget)
            {
                WARN() << "OpenGL widget not created!";
                break;
            }

            QOpenGLContext* opengl_context = opengl_widget->context();
            if(!opengl_context)
            {
                WARN() << "Invalid OpenGL context!";
                break;
            }
            QPair<int,int> opengl_version = opengl_context->format().version();
            if(!opengl_widget->isValid() || opengl_version.first < 2) // Disable OpenGL for virtualbox
            {
                WARN() << "Invalid OpenGL version!";
                break;
            }
        } while(false);

        if(!opengl_windget_created)
        {
            WARN() << "Can't instantinate OpenGL widget. Falling back to QWidget";
            delete centralWidget;
            centralWidget = new QWidget(this);
        }
    }
    else
    {
        DEBUG() << "OpenGL is disabled or player doesn't support OpenGL rendering. Creating a QWidget renderer";
        centralWidget = new QWidget(this);
    }

#else
    centralWidget = new QWidget(this);
#endif //USE_OPENGL_RENDER
    QStackedLayout* stackedLayout = new QStackedLayout;
    stackedLayout->setObjectName("stackedLayout");
    centralWidget->setLayout(stackedLayout);
    //centralWidget->setAttribute(Qt::WA_TransparentForMouseEvents, true);
    this->setCentralWidget(centralWidget);

    if(browser())
    {
        browser()->setParentWidget(centralWidget);
        browser()->setLayout(stackedLayout);
        browser()->createNewPage();
    }
    else
        WARN() << "Browser plugin not found! The app may not work correctly!";

    if(player() != NULL && player()->isInitialized())
    {
        player()->setAspectRatio(SDK::ASPECT_RATIO_AUTO);
        player()->widget()->setParent(centralWidget);
        stackedLayout->addWidget(player()->widget());
        player()->show();
    }
    else
        WARN() << "No mediplayer plugin found. Media will be disabled!";

    gui()->setTopWidget(SDK::GUI::TOP_WIDGET_BROWSER);

    setMouseTracking(true);
    resizeWebView();

    for(QObject* widget: centralWidget->children())
    {
        DEBUG() << "Stack child" << widget;
    }
}
Example #26
0
void PConverter::volformatChanged (int )
{
    QComboBox* sender = static_cast<QComboBox*>(QObject::sender());
    QStackedLayout *buttonLayout = 0;
    QPushButton *dirButton = 0;
    QPushButton *fileButton = 0;
    if(sender == outFormatCBox)
    {
        buttonLayout = outButtonLayout;
        dirButton    = outDirButton;
        fileButton   = outFileButton;
    }
    else // both inFormatCBox and timeSeriesCheckBox
    {
        sender = inFormatCBox;
        buttonLayout = inButtonLayout;
        dirButton    = inDirButton;
        fileButton   = inFileButton;
    }

    if(sender->currentText().compare(iim::STACKED_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Three-leveled (y,x,z) hierarchy of tiles with each tile composed by a series of 2D TIFF files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(false);
    }
    else if(sender->currentText().compare(iim::SIMPLE_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("A folder containing a series (1+) of 2D TIFF files");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(false);
    }
    else if(sender->currentText().compare(iim::TILED_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Three-leveled (y,x,z) hierarchy of tiles with each tile composed by a series of Vaa3D 3D raw files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(true);
    }
    else if(sender->currentText().compare(iim::TILED_MC_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Four-leveled (c,y,x,z) hierarchy of tiles with each tile composed by a series of Vaa3D 3D raw files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(true);
    }
    else if(sender->currentText().compare(iim::RAW_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Single Vaa3D 3D raw file");
        if(timeSeriesCheckBox->isChecked())
            buttonLayout->setCurrentWidget(dirButton);
        else
            buttonLayout->setCurrentWidget(fileButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(false);
    }
    else if(sender->currentText().compare(iim::SIMPLE_RAW_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("A folder containing a series (1+) of Vaa3D 2D raw files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(false);
    }
    else if(sender->currentText().compare(iim::TILED_TIF3D_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Three-leveled (y,x,z) hierarchy of tiles with each tile composed by a series of multipage (3D) TIFF files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(true);
    }
    else if(sender->currentText().compare(iim::TILED_MC_TIF3D_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Four-leveled (c,y,x,z) hierarchy of tiles with each tile composed by a series of multipage (3D) TIFF files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(true);
    }
    else if(sender->currentText().compare(iim::TIF3D_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("A single multipage (3D) TIFF file.");
        if(timeSeriesCheckBox->isChecked())
            buttonLayout->setCurrentWidget(dirButton);
        else
            buttonLayout->setCurrentWidget(fileButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(false);
    }
    else if(sender->currentText().compare(iim::BDV_HDF5_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("BigDataViewer HDF5 format (see <a href=\"http://fiji.sc/BigDataViewer#About_the_BigDataViewer_data_format\">this</a> link)");
        buttonLayout->setCurrentWidget(fileButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(true);
    }
    else
        helpBox->setText("<html><p style=\"text-align:justify;\"> Format not yet supported. </p></html>");
}