ControlEditorDialog::ControlEditorDialog
        (
            QWidget *parent,
            RosegardenDocument *doc,
            DeviceId device
       ):
        QMainWindow(parent),
        m_studio(&doc->getStudio()),
        m_doc(doc),
        m_device(device),
        m_modified(false)
{
    RG_DEBUG << "ControlEditorDialog::ControlEditorDialog: device is " << m_device << endl;

    QWidget *mainFrame = new QWidget(this);
    QVBoxLayout *mainFrameLayout = new QVBoxLayout;
    setCentralWidget(mainFrame);
    setAttribute(Qt::WA_DeleteOnClose);

    // everything else failed, so screw it, let's just set the fscking minimum
    // width the brute force way
    setMinimumWidth(935);

    setWindowTitle(tr("Manage Controllers"));

    QString deviceName(tr("<no device>"));
    MidiDevice *md =
        dynamic_cast<MidiDevice *>(m_studio->getDevice(m_device));
    if (md)
        deviceName = strtoqstr(md->getName());

    // spacing hack!
    new QLabel("", mainFrame);
    new QLabel(tr("  Controllers for %1 (device %2)")
           .arg(deviceName)
           .arg(device), mainFrame);
    new QLabel("", mainFrame);
    
    QStringList sl;
    sl  << tr("Name  ")
        << tr("Type  ")
        << tr("Number  ")
        << tr("Description  ")
        << tr("Min. value  ")
        << tr("Max. value  ")
        << tr("Default value  ")
        << tr("Color  ")
        << tr("Position on instrument panel");
    
    m_treeWidget = new QTreeWidget(mainFrame);
    m_treeWidget->setHeaderLabels(sl);
    m_treeWidget->setSortingEnabled(true);
    
    mainFrameLayout->addWidget(m_treeWidget);
    
    QFrame *btnBox = new QFrame(mainFrame);
    mainFrameLayout->addWidget(btnBox);
    mainFrame->setLayout(mainFrameLayout);

    btnBox->setSizePolicy(
        QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));

    // QT3: I don't think it's necessary to replace the following ",4, 10" with
    // anything to explicitly set the dimensions of the HBox, but there might be
    // some compatibility trickery I'm not remembering, etc.  Leaving as a
    // reminder in case the layout turns out broken:
    QHBoxLayout* layout = new QHBoxLayout(btnBox /*, 4, 10 */);

    m_addButton = new QPushButton(tr("Add"), btnBox);
    m_deleteButton = new QPushButton(tr("Delete"), btnBox);

    m_closeButton = new QPushButton(tr("Close"), btnBox);

    m_addButton->setToolTip(tr("Add a Control Parameter to the Studio"));

    m_deleteButton->setToolTip(tr("Delete a Control Parameter from the Studio"));

    m_closeButton->setToolTip(tr("Close the Control Parameter editor"));

    layout->addStretch(10);
    layout->addWidget(m_addButton);
    layout->addWidget(m_deleteButton);
    layout->addSpacing(30);

    layout->addWidget(m_closeButton);
    layout->addSpacing(5);

    connect(m_addButton, SIGNAL(released()),
            SLOT(slotAdd()));

    connect(m_deleteButton, SIGNAL(released()),
            SLOT(slotDelete()));

    setupActions();

    connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()),
            this, SLOT(slotUpdate()));

    connect(m_treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
            SLOT(slotEdit(QTreeWidgetItem *, int)));

    // Highlight all columns - enable extended selection mode
    //
    m_treeWidget->setAllColumnsShowFocus(true);
    
    m_treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);

    initDialog();
    
    // Set the top item in the list, if able.
    if (m_treeWidget->topLevelItemCount()) {
        m_treeWidget->setCurrentItem(m_treeWidget->topLevelItem(0));
    }
}
//! [0]
MainWindow::MainWindow()
{
//! [0]
    currentPath = QDir::homePath();
    model = new ImageModel(this);

    QWidget *centralWidget = new QWidget;

//! [1]
    view = new QTableView;
    view->setShowGrid(false);
    view->horizontalHeader()->hide();
    view->verticalHeader()->hide();
    view->horizontalHeader()->setMinimumSectionSize(1);
    view->verticalHeader()->setMinimumSectionSize(1);
    view->setModel(model);
//! [1]

//! [2]
    PixelDelegate *delegate = new PixelDelegate(this);
    view->setItemDelegate(delegate);
//! [2]

//! [3]
    QLabel *pixelSizeLabel = new QLabel(tr("Pixel size:"));
    QSpinBox *pixelSizeSpinBox = new QSpinBox;
    pixelSizeSpinBox->setMinimum(4);
    pixelSizeSpinBox->setMaximum(32);
    pixelSizeSpinBox->setValue(12);
//! [3]

    QMenu *fileMenu = new QMenu(tr("&File"), this);
    QAction *openAction = fileMenu->addAction(tr("&Open..."));
    openAction->setShortcuts(QKeySequence::Open);

    printAction = fileMenu->addAction(tr("&Print..."));
    printAction->setEnabled(false);
    printAction->setShortcut(QKeySequence::Print);

    QAction *quitAction = fileMenu->addAction(tr("E&xit"));
    quitAction->setShortcuts(QKeySequence::Quit);

    QMenu *helpMenu = new QMenu(tr("&Help"), this);
    QAction *aboutAction = helpMenu->addAction(tr("&About"));

    menuBar()->addMenu(fileMenu);
    menuBar()->addSeparator();
    menuBar()->addMenu(helpMenu);

    connect(openAction, SIGNAL(triggered()), this, SLOT(chooseImage()));
    connect(printAction, SIGNAL(triggered()), this, SLOT(printImage()));
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(showAboutBox()));
//! [4]
    connect(pixelSizeSpinBox, SIGNAL(valueChanged(int)),
            delegate, SLOT(setPixelSize(int)));
    connect(pixelSizeSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(updateView()));
//! [4]

    QHBoxLayout *controlsLayout = new QHBoxLayout;
    controlsLayout->addWidget(pixelSizeLabel);
    controlsLayout->addWidget(pixelSizeSpinBox);
    controlsLayout->addStretch(1);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(view);
    mainLayout->addLayout(controlsLayout);
    centralWidget->setLayout(mainLayout);

    setCentralWidget(centralWidget);

    setWindowTitle(tr("Pixelator"));
    resize(640, 480);
//! [5]
}
Example #3
0
DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
    : QStackedWidget(parent)
    , m_db(db)
    , m_searchUi(new Ui::SearchWidget())
    , m_searchWidget(new QWidget())
    , m_newGroup(Q_NULLPTR)
    , m_newEntry(Q_NULLPTR)
    , m_newParent(Q_NULLPTR)
{
    m_searchUi->setupUi(m_searchWidget);

    m_searchTimer = new QTimer(this);
    m_searchTimer->setSingleShot(true);

    m_mainWidget = new QWidget(this);
    QLayout* layout = new QHBoxLayout(m_mainWidget);
    QSplitter* splitter = new QSplitter(m_mainWidget);

    QWidget* rightHandSideWidget = new QWidget(splitter);
    m_searchWidget->setParent(rightHandSideWidget);

    m_groupView = new GroupView(db, splitter);
    m_groupView->setObjectName("groupView");
    m_groupView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_groupView, SIGNAL(customContextMenuRequested(QPoint)),
            SLOT(emitGroupContextMenuRequested(QPoint)));

    m_entryView = new EntryView(rightHandSideWidget);
    m_entryView->setObjectName("entryView");
    m_entryView->setContextMenuPolicy(Qt::CustomContextMenu);
    m_entryView->setGroup(db->rootGroup());
    connect(m_entryView, SIGNAL(customContextMenuRequested(QPoint)),
            SLOT(emitEntryContextMenuRequested(QPoint)));

    QSizePolicy policy;
    policy = m_groupView->sizePolicy();
    policy.setHorizontalStretch(30);
    m_groupView->setSizePolicy(policy);
    policy = rightHandSideWidget->sizePolicy();
    policy.setHorizontalStretch(70);
    rightHandSideWidget->setSizePolicy(policy);

    QAction* closeAction = new QAction(m_searchWidget);
    QIcon closeIcon = filePath()->icon("actions", "dialog-close");
    closeAction->setIcon(closeIcon);
    m_searchUi->closeSearchButton->setDefaultAction(closeAction);
    m_searchUi->closeSearchButton->setShortcut(Qt::Key_Escape);
    m_searchWidget->hide();
    m_searchUi->caseSensitiveCheckBox->setVisible(false);

    QVBoxLayout* vLayout = new QVBoxLayout(rightHandSideWidget);
    vLayout->setMargin(0);
    vLayout->addWidget(m_searchWidget);
    vLayout->addWidget(m_entryView);

    rightHandSideWidget->setLayout(vLayout);

    splitter->addWidget(m_groupView);
    splitter->addWidget(rightHandSideWidget);

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

    m_editEntryWidget = new EditEntryWidget();
    m_editEntryWidget->setObjectName("editEntryWidget");
    m_historyEditEntryWidget = new EditEntryWidget();
    m_editGroupWidget = new EditGroupWidget();
    m_editGroupWidget->setObjectName("editGroupWidget");
    m_changeMasterKeyWidget = new ChangeMasterKeyWidget();
    m_changeMasterKeyWidget->headlineLabel()->setText(tr("Change master key"));
    QFont headlineLabelFont = m_changeMasterKeyWidget->headlineLabel()->font();
    headlineLabelFont.setBold(true);
    headlineLabelFont.setPointSize(headlineLabelFont.pointSize() + 2);
    m_changeMasterKeyWidget->headlineLabel()->setFont(headlineLabelFont);
    m_databaseSettingsWidget = new DatabaseSettingsWidget();
    m_databaseSettingsWidget->setObjectName("databaseSettingsWidget");
    m_databaseOpenWidget = new DatabaseOpenWidget();
    m_databaseOpenWidget->setObjectName("databaseOpenWidget");
    m_keepass1OpenWidget = new KeePass1OpenWidget();
    m_keepass1OpenWidget->setObjectName("keepass1OpenWidget");
    m_unlockDatabaseWidget = new UnlockDatabaseWidget();
    m_unlockDatabaseWidget->setObjectName("unlockDatabaseWidget");
    addWidget(m_mainWidget);
    addWidget(m_editEntryWidget);
    addWidget(m_editGroupWidget);
    addWidget(m_changeMasterKeyWidget);
    addWidget(m_databaseSettingsWidget);
    addWidget(m_historyEditEntryWidget);
    addWidget(m_databaseOpenWidget);
    addWidget(m_keepass1OpenWidget);
    addWidget(m_unlockDatabaseWidget);

    connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(clearLastGroup(Group*)));
    connect(m_groupView, SIGNAL(groupChanged(Group*)), SIGNAL(groupChanged()));
    connect(m_groupView, SIGNAL(groupChanged(Group*)), m_entryView, SLOT(setGroup(Group*)));
    connect(m_entryView, SIGNAL(entryActivated(Entry*, EntryModel::ModelColumn)),
            SLOT(entryActivationSignalReceived(Entry*, EntryModel::ModelColumn)));
    connect(m_entryView, SIGNAL(entrySelectionChanged()), SIGNAL(entrySelectionChanged()));
    connect(m_editEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
    connect(m_editEntryWidget, SIGNAL(historyEntryActivated(Entry*)), SLOT(switchToHistoryView(Entry*)));
    connect(m_historyEditEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchBackToEntryEdit()));
    connect(m_editGroupWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
    connect(m_changeMasterKeyWidget, SIGNAL(editFinished(bool)), SLOT(updateMasterKey(bool)));
    connect(m_databaseSettingsWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
    connect(m_databaseOpenWidget, SIGNAL(editFinished(bool)), SLOT(openDatabase(bool)));
    connect(m_keepass1OpenWidget, SIGNAL(editFinished(bool)), SLOT(openDatabase(bool)));
    connect(m_unlockDatabaseWidget, SIGNAL(editFinished(bool)), SLOT(unlockDatabase(bool)));
    connect(this, SIGNAL(currentChanged(int)), this, SLOT(emitCurrentModeChanged()));
    connect(m_searchUi->searchEdit, SIGNAL(textChanged(QString)), this, SLOT(startSearchTimer()));
    connect(m_searchUi->caseSensitiveCheckBox, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
    connect(m_searchUi->searchCurrentRadioButton, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
    connect(m_searchUi->searchRootRadioButton, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
    connect(m_searchUi->searchEdit, SIGNAL(returnPressed()), m_entryView, SLOT(setFocus()));
    connect(m_searchTimer, SIGNAL(timeout()), this, SLOT(search()));
    connect(closeAction, SIGNAL(triggered()), this, SLOT(closeSearch()));

    setCurrentWidget(m_mainWidget);
}
Example #4
0
CWindowMain::CWindowMain(QWidget *parent)
    : QMainWindow(parent),
      m_executThread(NULL)
{
    m_widgetBFGenerate  = new CWidgetBFGenerate(this);
    m_widgetBFList      = new CWidgetBFList(this);
    m_widgetBFView      = new CWidgetBFView(this);
    m_widgetConsol      = new CWidgetConsol(this);
    m_widgetConsol->setVisible(false);
    m_widgetPanelMode   = new CWidgetPanelMode(this);
    m_widgetTreeSat     = new CWidgetTreeSat(this);

    QWidget *wBFViewBFGenerate = new QWidget();
    QVBoxLayout *boxBFViewBFGenerate = new QVBoxLayout();
    boxBFViewBFGenerate->addWidget(m_widgetBFGenerate);
    boxBFViewBFGenerate->addWidget(m_widgetBFView);
    boxBFViewBFGenerate->setMargin(0);
    boxBFViewBFGenerate->setSpacing(0);
    boxBFViewBFGenerate->setStretch(1,100);
    wBFViewBFGenerate->setLayout(boxBFViewBFGenerate);

    QSplitter *spListBFTreeAlg = new QSplitter(Qt::Vertical);
    spListBFTreeAlg->addWidget(m_widgetBFList);
    spListBFTreeAlg->addWidget(m_widgetTreeSat);

    QSplitter *spTreeView = new QSplitter(Qt::Horizontal);
    spTreeView->addWidget(spListBFTreeAlg);
    spTreeView->addWidget(wBFViewBFGenerate);
    spTreeView->setStretchFactor(1,100);

    QSplitter *spMain = new QSplitter(Qt::Vertical);
    spMain->addWidget(spTreeView);
    spMain->addWidget(m_widgetConsol);
    spMain->setStretchFactor(0,100);

    QWidget *widgetCenter = new QWidget(this);
    setCentralWidget(widgetCenter);

    QHBoxLayout *hbox = new QHBoxLayout();
    centralWidget()->setLayout(hbox);

    hbox->addWidget(m_widgetPanelMode);
    hbox->addWidget(spMain);
    hbox->setMargin(0);
    hbox->setSpacing(0);
    hbox->setStretch(1,100);

    m_actOpen = new QAction(QIcon(":/ico/main_open.png"),tr("&Открыть"),this);
    m_actOpen->setShortcut(QKeySequence::Open);
    connect(m_actOpen,SIGNAL(triggered()),this,SLOT(on_open()));

    m_actSave = new QAction(QIcon(":/ico/main_save.png"),tr("&Сохранить"),this);
    m_actSave->setShortcut(QKeySequence::Save);
    connect(m_actSave,SIGNAL(triggered()),this,SLOT(on_save()));

    m_actSaveAs = new QAction(QIcon(":/ico/main_save_as.png"),tr("&Сохранить как"),this);
    m_actSaveAs->setShortcut(QKeySequence::SaveAs);
    connect(m_actSaveAs,SIGNAL(triggered()),this,SLOT(on_save_as()));

    m_actQuit = new QAction(QIcon("://ico/main_quit.png"),tr("Выйти"),this);
    m_actQuit->setShortcut(QKeySequence::Close);
    m_actQuit->setStatusTip(tr("Выйти из приложения"));
    connect(m_actQuit, SIGNAL(triggered()), this, SLOT(close()));

    mainMenu = menuBar()->addMenu(tr("Файл"));
    mainMenu->addAction(m_actOpen);
    mainMenu->addAction(m_actSave);
    mainMenu->addAction(m_actSaveAs);
    mainMenu->addSeparator();
    mainMenu->addAction(m_actQuit);

    mainMenu = menuBar()->addMenu(tr("Вид"));
    mainMenu->addAction(m_widgetBFGenerate->actVisible());
    mainMenu->addAction(m_widgetConsol->actVisible());

    // m_widgetPanelMode
    connect(m_widgetPanelMode,SIGNAL(run()),
            m_widgetTreeSat,SLOT(on_runChecked()));

    connect(m_widgetPanelMode,SIGNAL(run()),
            m_widgetBFGenerate,SLOT(on_resetTriggered()));

    connect(m_widgetPanelMode,SIGNAL(runLog()),
            m_widgetTreeSat,SLOT(on_runLogChecked()));

    connect(m_widgetPanelMode,SIGNAL(runLog()),
            m_widgetBFGenerate,SLOT(on_resetTriggered()));

    connect(m_widgetPanelMode,SIGNAL(terminate()),
            this,SIGNAL(terminated()));

    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFList,SLOT(setVisible(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFList,SLOT(on_disabledHide(bool)));

    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFGenerate,SLOT(setVisible(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFGenerate->actVisible(),SLOT(setChecked(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFGenerate->actVisible(),SLOT(setEnabled(bool)));

    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetTreeSat,SLOT(setVisible(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetTreeSat,SLOT(on_disabledHide(bool)));

    // m_widgetBFView
    connect(m_widgetBFView,SIGNAL(message(QString)),
            this,SIGNAL(messageAppend(QString)));

    connect(m_widgetBFView,SIGNAL(getLogSelectSat(bool)),
            m_widgetTreeSat,SLOT(on_returnLogSelectSat(bool)));

    // m_widgetBFList
    connect(m_widgetBFList,SIGNAL(generate()),
            m_widgetBFGenerate,SLOT(on_generate()));

    connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)),
            m_widgetBFGenerate,SLOT(on_set(QString,CBoolFormula*)));

    connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)),
            m_widgetTreeSat,SLOT(on_set(QString,CBoolFormula*)));

    connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)),
            m_widgetBFView,SLOT(on_set(QString,CBoolFormula*)));

    connect(m_widgetBFList,SIGNAL(message(QString)),
            this,SIGNAL(messageAppend(QString)));

    // m_widgetBFGenerate
    connect(m_widgetBFGenerate,SIGNAL(append(QString,CBoolFormula*)),
            m_widgetBFList,SIGNAL(appendgen(QString,CBoolFormula*)));

    connect(m_widgetBFGenerate,SIGNAL(append(QString,CBoolFormula*)),
            m_widgetPanelMode,SLOT(on_resetTriggered()));

    connect(m_widgetBFGenerate,SIGNAL(execut(QList<CExecutObject*>)),
            this,SLOT(on_execut(QList<CExecutObject*>)));

    connect(m_widgetBFGenerate,SIGNAL(replace(QString,CBoolFormula*)),
            m_widgetBFList,SIGNAL(replace(QString,CBoolFormula*)));

    connect(m_widgetBFGenerate,SIGNAL(replace(QString,CBoolFormula*)),
            m_widgetPanelMode,SLOT(on_resetTriggered()));

    connect(m_widgetBFGenerate,SIGNAL(remove(QString)),
            m_widgetBFList,SIGNAL(remove(QString)));

    connect(m_widgetBFGenerate,SIGNAL(terminated()),
            this,SIGNAL(terminated()));

    // m_widgetTreeSat
    connect(m_widgetTreeSat,SIGNAL(execut(QList<CExecutObject*>)),
            this,SLOT(on_execut(QList<CExecutObject*>)));

    connect(m_widgetTreeSat,SIGNAL(logSelectSat(QString)),
            m_widgetBFView,SIGNAL(setText(QString)));

    // main
    connect(this,SIGNAL(messageAppend(QString)),
            m_widgetConsol,SLOT(messageAppend(QString)));

    connect(this,SIGNAL(messageSet(QString)),
            m_widgetConsol,SLOT(messageSet(QString)));

    connect(this,SIGNAL(executingOperation(QString)),
            m_widgetConsol,SLOT(executingOperation(QString)));

    connect(this,SIGNAL(append(QString,CBoolFormula*)),
            m_widgetBFList,SIGNAL(append(QString,CBoolFormula*)));

    connect(this,SIGNAL(locked()),m_widgetPanelMode,SLOT(on_locked()));
    connect(this,SIGNAL(unlocked()),m_widgetPanelMode,SLOT(on_unlocked()));

    connect(this,SIGNAL(locked()),m_widgetBFGenerate,SLOT(on_locked()));
    connect(this,SIGNAL(unlocked()),m_widgetBFGenerate,SLOT(on_unlocked()));

    connect(this,SIGNAL(updateView()),m_widgetBFView,SLOT(on_viewUpdate()));

    m_widgetPanelMode->on_checkedRand();  // set checked Random bool formula state for start application
}
Example #5
0
//
// Replace home window when no ride
//
BlankStatePage::BlankStatePage(Context *context) : context(context), canShow_(true)
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->addStretch();
    QHBoxLayout *homeLayout = new QHBoxLayout;
    mainLayout->addLayout(homeLayout);
    homeLayout->setAlignment(Qt::AlignCenter);
    homeLayout->addSpacing(20); // left margin
    setAutoFillBackground(true);
    setProperty("color", QColor(Qt::white));
    setProperty("nomenu", true);

    // left part
    QWidget *left = new QWidget(this);
    leftLayout = new QVBoxLayout(left);
    leftLayout->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
    left->setLayout(leftLayout);

    welcomeTitle = new QLabel(left);
    welcomeTitle->setFont(QFont("Helvetica", 30, QFont::Bold, false));
    leftLayout->addWidget(welcomeTitle);

    welcomeText = new QLabel(left);
    welcomeText->setFont(QFont("Helvetica", 16, QFont::Light, false));
    leftLayout->addWidget(welcomeText);

    leftLayout->addSpacing(10);

    homeLayout->addWidget(left);
    homeLayout->addSpacing(50);

    QWidget *right = new QWidget(this);
    QVBoxLayout *rightLayout = new QVBoxLayout(right);
    rightLayout->setAlignment(Qt::AlignRight | Qt::AlignBottom);
    right->setLayout(rightLayout);

    img = new QToolButton(this);
    img->setFocusPolicy(Qt::NoFocus);
    img->setToolButtonStyle(Qt::ToolButtonIconOnly);
    img->setStyleSheet("QToolButton {text-align: left;color : blue;background: transparent}");
    rightLayout->addWidget(img);

    homeLayout->addWidget(right);
    // right margin
    homeLayout->addSpacing(20);

    // control if shown or not in future
    QHBoxLayout *bottomRow = new QHBoxLayout;
    mainLayout->addSpacing(20);
    mainLayout->addLayout(bottomRow);

    dontShow = new QCheckBox(tr("Don't show this next time."), this);
    dontShow->setFocusPolicy(Qt::NoFocus);
    closeButton = new QPushButton(tr("Close"), this);
    closeButton->setFocusPolicy(Qt::NoFocus);
    bottomRow->addWidget(dontShow);
    bottomRow->addStretch();
    bottomRow->addWidget(closeButton);

    connect(closeButton, SIGNAL(clicked()), this, SLOT(setCanShow()));
    connect(closeButton, SIGNAL(clicked()), this, SIGNAL(closeClicked()));
}
Example #6
0
/*
 * Initialize the GUI interface for the plugin - this is only called once when the plugin is
 * added to the plugin registry in the QGIS application.
 */
void CoordinateCapture::initGui()
{
  mCrs.createFromSrsId( GEOCRS_ID ); // initialize the CRS object

  connect( mQGisIface->mapCanvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setSourceCrs() ) );
  connect( mQGisIface, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );

  setSourceCrs(); //set up the source CRS
  mTransform.setDestCRS( mCrs ); // set the CRS in the transform
  mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 5 : 3; // precision depends on CRS units

  // Create the action for tool
  mQActionPointer = new QAction( QIcon(), tr( "Coordinate Capture" ), this );
  // Set the what's this text
  mQActionPointer->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
  // Connect the action to the run
  connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
  mQGisIface->addPluginToMenu( tr( "&Coordinate Capture" ), mQActionPointer );

  // create our map tool
  mpMapTool = new CoordinateCaptureMapTool( mQGisIface->mapCanvas() );
  connect( mpMapTool, SIGNAL( mouseMoved( QgsPoint ) ), this, SLOT( mouseMoved( QgsPoint ) ) );
  connect( mpMapTool, SIGNAL( mouseClicked( QgsPoint ) ), this, SLOT( mouseClicked( QgsPoint ) ) );


  // create a little widget with x and y display to put into our dock widget
  QWidget * mypWidget = new QWidget();
  QGridLayout *mypLayout = new QGridLayout( mypWidget );
  mypLayout->setColumnMinimumWidth( 0, 36 );
  mypWidget->setLayout( mypLayout );

  mypUserCrsToolButton = new QToolButton( mypWidget );
  mypUserCrsToolButton->setToolTip( tr( "Click to select the CRS to use for coordinate display" ) );
  connect( mypUserCrsToolButton, SIGNAL( clicked() ), this, SLOT( setCRS() ) );

  mypCRSLabel = new QLabel( mypWidget );
  mypCRSLabel->setGeometry( mypUserCrsToolButton->geometry() );

  mpUserCrsEdit = new QLineEdit( mypWidget );
  mpUserCrsEdit->setReadOnly( true );
  mpUserCrsEdit->setToolTip( tr( "Coordinate in your selected CRS" ) );

  mpCanvasEdit = new QLineEdit( mypWidget );
  mpCanvasEdit->setReadOnly( true );
  mpCanvasEdit->setToolTip( tr( "Coordinate in map canvas coordinate reference system" ) );

  QPushButton * mypCopyButton = new QPushButton( mypWidget );
  mypCopyButton->setText( tr( "Copy to clipboard" ) );
  connect( mypCopyButton, SIGNAL( clicked() ), this, SLOT( copy() ) );

  mpTrackMouseButton = new QToolButton( mypWidget );
  mpTrackMouseButton->setCheckable( true );
  mpTrackMouseButton->setToolTip( tr( "Click to enable mouse tracking. Click the canvas to stop" ) );
  mpTrackMouseButton->setChecked( false );

  // Create the action for tool
  mpCaptureButton = new QPushButton( mypWidget );
  mpCaptureButton->setText( tr( "Start capture" ) );
  mpCaptureButton->setToolTip( tr( "Click to enable coordinate capture" ) );
  mpCaptureButton->setIcon( QIcon( ":/coordinate_capture/coordinate_capture.png" ) );
  mpCaptureButton->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
  connect( mpCaptureButton, SIGNAL( clicked() ), this, SLOT( run() ) );

  // Set the icons
  setCurrentTheme( "" );

  mypLayout->addWidget( mypUserCrsToolButton, 0, 0 );
  mypLayout->addWidget( mpUserCrsEdit, 0, 1 );
  mypLayout->addWidget( mypCRSLabel, 1, 0 );
  mypLayout->addWidget( mpCanvasEdit, 1, 1 );
  mypLayout->addWidget( mpTrackMouseButton, 2, 0 );
  mypLayout->addWidget( mypCopyButton, 2, 1 );
  mypLayout->addWidget( mpCaptureButton, 3, 1 );


  //create the dock widget
  mpDockWidget = new QDockWidget( tr( "Coordinate Capture" ), mQGisIface->mainWindow() );
  mpDockWidget->setObjectName( "CoordinateCapture" );
  mpDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
  mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mpDockWidget );

  // now add our custom widget to the dock - ownership of the widget is passed to the dock
  mpDockWidget->setWidget( mypWidget );

}
Example #7
0
FunctionViewer::FunctionViewer(QWidget *parent, Qt::WFlags flags)
#endif
    : QSplitter(parent)
    , m_xshHandle(0)
    , m_frameHandle(0)
    , m_objectHandle(0)
    , m_fxHandle(0)
    , m_columnHandle(0)
    , m_curve(0)
    , m_selection(new FunctionSelection())
    , m_sceneHandle(0) {
  setObjectName("FunctionEditor");

  // Prepare local timeline
  m_localFrame.setFrame(0);
  setFocusPolicy(Qt::NoFocus);

  m_treeView         = new FunctionTreeView(this);
  m_functionGraph    = new FunctionPanel(this);
  m_numericalColumns = new FunctionSheet();
  m_toolbar          = new FunctionToolbar;
  m_segmentViewer =
      new FunctionSegmentViewer(this, m_numericalColumns, m_functionGraph);
  QWidget *leftPanel  = new QWidget();
  QWidget *rightPanel = new QWidget();

  //----
  m_treeView->resize(150, m_treeView->size().height());
  m_treeView->setMinimumWidth(0);

  FunctionTreeModel *ftModel =
      dynamic_cast<FunctionTreeModel *>(m_treeView->model());
  m_functionGraph->setModel(ftModel);
  m_numericalColumns->setModel(ftModel);

  m_functionGraph->setSelection(getSelection());
  m_numericalColumns->setSelection(getSelection());

  m_numericalColumns->setViewer(this);

  m_toolbar->setSelection(m_selection);
  m_toolbar->setFocusPolicy(Qt::NoFocus);

  m_toolbar->setFrameHandle(
      &m_localFrame);  // The function editor adopts an internal timeline
  m_functionGraph->setFrameHandle(
      &m_localFrame);  // synchronized among its various sub-widgets.
  m_numericalColumns->setFrameHandle(
      &m_localFrame);  // In case an external m_frameHandle is specified,
                       // it synchronizes with that, too.

  //---- layout

  QVBoxLayout *leftLayout = new QVBoxLayout();
  leftLayout->setMargin(0);
  leftLayout->setSpacing(0);
  {
    leftLayout->addWidget(m_toolbar);
    leftLayout->addSpacing(36);
    leftLayout->addWidget(m_numericalColumns);
  }
  leftPanel->setLayout(leftLayout);

  addWidget(leftPanel);

  QVBoxLayout *rightLayout = new QVBoxLayout();
  rightLayout->setMargin(0);
  rightLayout->setSpacing(5);
  {
    rightLayout->addWidget(m_segmentViewer, 0);
    rightLayout->addWidget(m_treeView, 1);
  }
  rightPanel->setLayout(rightLayout);

  addWidget(rightPanel);

  //--- set the splitter's default size
  setSizes(QList<int>() << 500 << 200);
  setStretchFactor(0, 5);
  setStretchFactor(1, 2);

  //---- signal-slot connections
  bool ret = true;
  ret      = ret && connect(m_toolbar, SIGNAL(numericalColumnToggled()), this,
                       SLOT(toggleMode()));
  ret = ret && connect(ftModel, SIGNAL(activeChannelsChanged()),
                       m_functionGraph, SLOT(update()));
  ret = ret && connect(ftModel, SIGNAL(activeChannelsChanged()),
                       m_numericalColumns, SLOT(updateAll()));
  ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_treeView,
                       SLOT(update()));
  ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_functionGraph,
                       SLOT(update()));
  ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_numericalColumns,
                       SLOT(updateAll()));
  ret = ret && connect(ftModel, SIGNAL(curveSelected(TDoubleParam *)), this,
                       SLOT(onCurveSelected(TDoubleParam *)));
  ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), m_segmentViewer,
                       SLOT(onCurveChanged()));
  ret = ret && connect(ftModel, SIGNAL(curveChanged(bool)), this,
                       SLOT(onCurveChanged(bool)));
  ret = ret && connect(&m_localFrame, SIGNAL(frameSwitched()), this,
                       SLOT(onFrameSwitched()));
  ret = ret && connect(getSelection(), SIGNAL(selectionChanged()), this,
                       SLOT(onSelectionChanged()));
  ret = ret && connect(m_functionGraph, SIGNAL(keyframeSelected(double)),
                       m_toolbar, SLOT(setFrame(double)));

  ret = ret && connect(m_treeView, SIGNAL(switchCurrentObject(TStageObject *)),
                       this, SLOT(doSwitchCurrentObject(TStageObject *)));
  ret = ret && connect(m_treeView, SIGNAL(switchCurrentFx(TFx *)), this,
                       SLOT(doSwitchCurrentFx(TFx *)));

  ret = ret &&
        connect(ftModel,
                SIGNAL(currentChannelChanged(FunctionTreeModel::Channel *)),
                m_numericalColumns,
                SLOT(onCurrentChannelChanged(FunctionTreeModel::Channel *)));

  assert(ret);

  m_functionGraph->hide();
}
void WindowMaterialGasMixtureInspectorView::createLayout()
{
  QWidget* visibleWidget = new QWidget();
  this->stackedWidget()->addWidget(visibleWidget);

  QGridLayout* mainGridLayout = new QGridLayout();
  mainGridLayout->setContentsMargins(7,7,7,7);
  mainGridLayout->setSpacing(14);
  visibleWidget->setLayout(mainGridLayout);

  unsigned row = 0;
  unsigned col = 0;

  // Name

  QLabel * label = new QLabel("Name: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,col);

  m_nameEdit = new OSLineEdit();
  mainGridLayout->addWidget(m_nameEdit,row++,0,1,3);

  // Thickness

  label = new QLabel("Thickness: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,col);

  m_thickness = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasMixtureInspectorView::toggleUnitsClicked, m_thickness, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_thickness,row++,0,1,3);

  // Number Of Gases In Mixture

  label = new QLabel("Number Of Gases In Mixture: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,col);

  m_numberOfGasesInMixture = new OSIntegerEdit();
  mainGridLayout->addWidget(m_numberOfGasesInMixture,row++,0,1,3);

  //************************* 1 *************************

  // Gas Fraction

  label = new QLabel("Gas 1 Fraction: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,col);

  m_gas1Fraction = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasMixtureInspectorView::toggleUnitsClicked, m_gas1Fraction, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_gas1Fraction,row++,0,1,3);

  // Gas Type

  label = new QLabel("Gas 1 Type: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,col);

  m_gas1Type = new OSComboBox();
  m_gas1Type->addItem("Air");
  m_gas1Type->addItem("Argon");
  m_gas1Type->addItem("Krypton");
  m_gas1Type->addItem("Xenon");
  mainGridLayout->addWidget(m_gas1Type,row++,0,1,3);


  //************************* 2 *************************

  // Gas Fraction

  label = new QLabel("Gas 2 Fraction: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,col);

  m_gas2Fraction = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasMixtureInspectorView::toggleUnitsClicked, m_gas2Fraction, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_gas2Fraction,row++,0,1,3);

  // Gas Type

  label = new QLabel("Gas 2 Type: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,col);

  m_gas2Type = new OSComboBox();
  m_gas2Type->addItem("Air");
  m_gas2Type->addItem("Argon");
  m_gas2Type->addItem("Krypton");
  m_gas2Type->addItem("Xenon");
  mainGridLayout->addWidget(m_gas2Type,row++,0,1,3);

  //************************* 3 *************************

  // Gas Fraction

  label = new QLabel("Gas 3 Fraction: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,col);

  m_gas3Fraction = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasMixtureInspectorView::toggleUnitsClicked, m_gas3Fraction, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_gas3Fraction,row++,0,1,3);

  // Gas Type

  label = new QLabel("Gas 3 Type: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,col);

  m_gas3Type = new OSComboBox();
  m_gas3Type->addItem("Air");
  m_gas3Type->addItem("Argon");
  m_gas3Type->addItem("Krypton");
  m_gas3Type->addItem("Xenon");
  mainGridLayout->addWidget(m_gas3Type,row++,0,1,3);

  //************************* 4 *************************

  // Gas Fraction

  label = new QLabel("Gas 4 Fraction: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,col);

  m_gas4Fraction = new OSQuantityEdit(m_isIP);
  connect(this, &WindowMaterialGasMixtureInspectorView::toggleUnitsClicked, m_gas4Fraction, &OSQuantityEdit::onUnitSystemChange);
  mainGridLayout->addWidget(m_gas4Fraction,row++,0,1,3);

  // Gas Type

  label = new QLabel("Gas 4 Type: ");
  label->setObjectName("H2");
  mainGridLayout->addWidget(label,row++,col);

  m_gas4Type = new OSComboBox();
  m_gas4Type->addItem("Air");
  m_gas4Type->addItem("Argon");
  m_gas4Type->addItem("Krypton");
  m_gas4Type->addItem("Xenon");
  mainGridLayout->addWidget(m_gas4Type,row++,0,1,3);

  // Stretch

  mainGridLayout->setRowStretch(100,100);

  mainGridLayout->setColumnStretch(100,100);
}
AudioRecorder::AudioRecorder()
{
//! [create-objs-1]
    audiosource = new QAudioCaptureSource;
    capture = new QMediaRecorder(audiosource);
//! [create-objs-1]

    // set a default file
    capture->setOutputLocation(QUrl("test.raw"));

    QWidget *window = new QWidget;
    QGridLayout* layout = new QGridLayout;

    QLabel* deviceLabel = new QLabel;
    deviceLabel->setText("Devices");
    deviceBox = new QComboBox(this);
    deviceBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);

    QLabel* codecLabel = new QLabel;
    codecLabel->setText("Codecs");
    codecsBox = new QComboBox(this);
    codecsBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);

    QLabel* qualityLabel = new QLabel;
    qualityLabel->setText("Quality");
    qualityBox = new QComboBox(this);
    qualityBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);

//! [device-list]
    for(int i = 0; i < audiosource->deviceCount(); i++)
        deviceBox->addItem(audiosource->name(i));
//! [device-list]

//! [codec-list]
    QStringList codecs = capture->supportedAudioCodecs();
    for(int i = 0; i < codecs.count(); i++)
        codecsBox->addItem(codecs.at(i));
//! [codec-list]

    qualityBox->addItem("Low");
    qualityBox->addItem("Medium");
    qualityBox->addItem("High");

    connect(capture, SIGNAL(durationChanged(qint64)), this, SLOT(updateProgress(qint64)));
    connect(capture, SIGNAL(stateChanged(QMediaRecorder::State)), this, SLOT(stateChanged(QMediaRecorder::State)));

    layout->addWidget(deviceLabel,0,0,Qt::AlignHCenter);
    connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
    layout->addWidget(deviceBox,0,1,1,3,Qt::AlignLeft);

    layout->addWidget(codecLabel,1,0,Qt::AlignHCenter);
    connect(codecsBox,SIGNAL(activated(int)),SLOT(codecChanged(int)));
    layout->addWidget(codecsBox,1,1,Qt::AlignLeft);

    layout->addWidget(qualityLabel,1,2,Qt::AlignHCenter);
    connect(qualityBox,SIGNAL(activated(int)),SLOT(qualityChanged(int)));
    layout->addWidget(qualityBox,1,3,Qt::AlignLeft);

    fileButton = new QPushButton(this);
    fileButton->setText(tr("Output File"));
    connect(fileButton,SIGNAL(clicked()),SLOT(selectOutputFile()));
    layout->addWidget(fileButton,3,0,Qt::AlignHCenter);

    button = new QPushButton(this);
    button->setText(tr("Record"));
    connect(button,SIGNAL(clicked()),SLOT(toggleRecord()));
    layout->addWidget(button,3,3,Qt::AlignHCenter);

    recTime = new QLabel;
    recTime->setText("0 sec");
    layout->addWidget(recTime,4,0,Qt::AlignHCenter);

    window->setLayout(layout);
    setCentralWidget(window);
    window->show();

    active = false;
}
Example #10
0
MainWindow::MainWindow()
        : KXmlGuiWindow()
        , m_view(new MainView(this))
        , m_findBar(new FindBar(this))
        , m_zoomBar(new ZoomBar(this))
        , m_historyPanel(0)
        , m_bookmarksPanel(0)
        , m_webInspectorPanel(0)
        , m_analyzerPanel(0)
        , m_historyBackMenu(0)
        , m_encodingMenu(new KMenu(this))
        , m_bookmarksBar(0)
        , m_popup(new KPassivePopup(this))
        , m_hidePopup(new QTimer(this))
        , m_toolsMenu(0)
{
    // creating a centralWidget containing panel, m_view and the hidden findbar
    QWidget *centralWidget = new QWidget;
    centralWidget->setContentsMargins(0, 0, 0, 0);

    // setting layout
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(m_view);
    layout->addWidget(m_findBar);
    layout->addWidget(m_zoomBar);
    centralWidget->setLayout(layout);

    // central widget
    setCentralWidget(centralWidget);

    // setting size policies
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // then, setup our actions
    setupActions();

    // setting Panels
    setupPanels();

    // setting up rekonq tools
    setupTools();

    // setting up rekonq toolbar(s)
    setupToolbars();

    // a call to KXmlGuiWindow::setupGUI() populates the GUI
    // with actions, using KXMLGUI.
    // It also applies the saved mainwindow settings, if any, and ask the
    // mainwindow to automatically save settings if changed: window size,
    // toolbar position, icon size, etc.
    setupGUI();

    // no menu bar in rekonq: we have other plans..
    menuBar()->setVisible(false);

    // no more status bar..
    setStatusBar(0);

    // give me some time to do all the other stuffs...
    QTimer::singleShot(100, this, SLOT(postLaunch()));

    kDebug() << "MainWindow ctor...DONE";
}
Example #11
0
//! [0]
//------------------------------------------------------------------------------------//
//------------------------------------------------------------------------------------//
Window::Window()
  : mpSyncConnector(new qst::connector::SyncConnector(QUrl(tr("http://127.0.0.1:8384"))))
  , mpProcessMonitor(new qst::monitor::ProcessMonitor(mpSyncConnector))
  , mpStartupTab(new qst::settings::StartupTab(mpSyncConnector))
  , mSettings("sieren", "QSyncthingTray")
  , mpAnimatedIconMovie(new QMovie())
{
    loadSettings();
    createSettingsGroupBox();

    createActions();
    createTrayIcon();

    connect(mpTestConnectionButton, SIGNAL(clicked()), this, SLOT(testURL()));
    connect(mpTrayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
    connect(mpTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
      this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
    connect(mpAuthCheckBox, SIGNAL(stateChanged(int)), this,
      SLOT(authCheckBoxChanged(int)));
    connect(mpMonochromeIconBox, SIGNAL(stateChanged(int)), this,
      SLOT(monoChromeIconChanged(int)));
    connect(mpShouldAnimateIconBox, SIGNAL(stateChanged(int)), this,
      SLOT(animateIconBoxChanged(int)));
    connect(mpAnimatedIconMovie.get(), SIGNAL(frameChanged(int)),
      this, SLOT(onUpdateIcon()));
    connect(mpWebViewZoomFactor, SIGNAL(valueChanged(double)), this,
      SLOT(webViewZoomFactorChanged(double)));

    // Setup SyncthingConnector
    using namespace qst::connector;
    connect(mpSyncConnector.get(), &SyncConnector::onConnectionHealthChanged, this,
      &Window::updateConnectionHealth);
    connect(mpSyncConnector.get(), &SyncConnector::onNetworkActivityChanged, this,
          &Window::onNetworkActivity);


    mpSettingsTabsWidget = new QTabWidget;
    QVBoxLayout *settingsLayout = new QVBoxLayout;
    settingsLayout->setAlignment(Qt::AlignTop);
    QWidget *settingsPageWidget = new QWidget;
    settingsLayout->addWidget(mpSettingsGroupBox);
   // settingsLayout->addWidget(mpFilePathGroupBox);
    settingsLayout->addWidget(mpAppearanceGroupBox);
    settingsPageWidget->setLayout(settingsLayout);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mpSettingsTabsWidget->addTab(settingsPageWidget, "Main");
    mpSettingsTabsWidget->addTab(mpStartupTab.get(), "Launcher");
    mpSettingsTabsWidget->addTab(mpProcessMonitor.get(), "Auto-Pause");
    mainLayout->addWidget(mpSettingsTabsWidget);
    setLayout(mainLayout);
    testURL();

    mpStartupTab->spawnSyncthingApp();
    setIcon(0);
    mpTrayIcon->show();
    #ifdef Q_OS_MAC
      this->setWindowIcon(QIcon(":/images/syncthing.icns"));
    #endif
    this->setWindowFlags(Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
    setWindowTitle(tr("QSyncthingTray"));
    resize(maximumWidth / devicePixelRatio(), 400);
}
Example #12
0
static void* ui_companion_qt_init(void)
{
   ui_companion_qt_t *handle = (ui_companion_qt_t*)calloc(1, sizeof(*handle));
   MainWindow *mainwindow = NULL;
   QHBoxLayout *browserButtonsHBoxLayout = NULL;
   QVBoxLayout *layout = NULL;
   QVBoxLayout *launchWithWidgetLayout = NULL;
   QHBoxLayout *coreComboBoxLayout = NULL;
   QMenuBar *menu = NULL;
   QDesktopWidget *desktop = NULL;
   QMenu *fileMenu = NULL;
   QMenu *editMenu = NULL;
   QMenu *viewMenu = NULL;
   QMenu *viewClosedDocksMenu = NULL;
   QRect desktopRect;
   QDockWidget *thumbnailDock = NULL;
   QDockWidget *thumbnail2Dock = NULL;
   QDockWidget *thumbnail3Dock = NULL;
   QDockWidget *browserAndPlaylistTabDock = NULL;
   QDockWidget *coreSelectionDock = NULL;
   QTabWidget *browserAndPlaylistTabWidget = NULL;
   QWidget *widget = NULL;
   QWidget *browserWidget = NULL;
   QWidget *playlistWidget = NULL;
   QWidget *coreSelectionWidget = NULL;
   QWidget *launchWithWidget = NULL;
   ThumbnailWidget *thumbnailWidget = NULL;
   ThumbnailWidget *thumbnail2Widget = NULL;
   ThumbnailWidget *thumbnail3Widget = NULL;
   QPushButton *browserDownloadsButton = NULL;
   QPushButton *browserUpButton = NULL;
   QPushButton *browserStartButton = NULL;
   ThumbnailLabel *thumbnail = NULL;
   ThumbnailLabel *thumbnail2 = NULL;
   ThumbnailLabel *thumbnail3 = NULL;
   QAction *editSearchAction = NULL;
   QAction *loadCoreAction = NULL;
   QAction *unloadCoreAction = NULL;
   QAction *exitAction = NULL;
   QComboBox *launchWithComboBox = NULL;
   QSettings *qsettings = NULL;

   if (!handle)
      return NULL;

   handle->app = static_cast<ui_application_qt_t*>(ui_application_qt.initialize());
   handle->window = static_cast<ui_window_qt_t*>(ui_window_qt.init());

   desktop = qApp->desktop();
   desktopRect = desktop->availableGeometry();

   mainwindow = handle->window->qtWindow;

   qsettings = mainwindow->settings();

   mainwindow->resize(qMin(desktopRect.width(), INITIAL_WIDTH), qMin(desktopRect.height(), INITIAL_HEIGHT));
   mainwindow->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, mainwindow->size(), desktopRect));

   mainwindow->setWindowTitle("RetroArch");
   mainwindow->setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks | GROUPED_DRAGGING);

   widget = new QWidget(mainwindow);
   widget->setObjectName("tableWidget");

   layout = new QVBoxLayout();
   layout->addWidget(mainwindow->contentTableWidget());

   widget->setLayout(layout);

   mainwindow->setCentralWidget(widget);

   menu = mainwindow->menuBar();

   fileMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE));

   loadCoreAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_LOAD_CORE), mainwindow, SLOT(onLoadCoreClicked()));
   loadCoreAction->setShortcut(QKeySequence("Ctrl+L"));

   unloadCoreAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_UNLOAD_CORE), mainwindow, SLOT(onUnloadCoreMenuAction()));
   unloadCoreAction->setObjectName("unloadCoreAction");
   unloadCoreAction->setEnabled(false);
   unloadCoreAction->setShortcut(QKeySequence("Ctrl+U"));

   exitAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_EXIT), mainwindow, SLOT(close()));
   exitAction->setShortcut(QKeySequence::Quit);

   editMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT));
   editSearchAction = editMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT_SEARCH), mainwindow->searchLineEdit(), SLOT(setFocus()));
   editSearchAction->setShortcut(QKeySequence::Find);

   viewMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW));
   viewClosedDocksMenu = viewMenu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_CLOSED_DOCKS));
   viewClosedDocksMenu->setObjectName("viewClosedDocksMenu");

   QObject::connect(viewClosedDocksMenu, SIGNAL(aboutToShow()), mainwindow, SLOT(onViewClosedDocksAboutToShow()));

   viewMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS), mainwindow->viewOptionsDialog(), SLOT(showDialog()));

   playlistWidget = new QWidget();
   playlistWidget->setLayout(new QVBoxLayout());
   playlistWidget->setObjectName("playlistWidget");

   playlistWidget->layout()->addWidget(mainwindow->playlistListWidget());

   browserWidget = new QWidget();
   browserWidget->setLayout(new QVBoxLayout());
   browserWidget->setObjectName("browserWidget");

   browserDownloadsButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIRECTORY));
   browserUpButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER_UP));
   browserStartButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FAVORITES));

   QObject::connect(browserDownloadsButton, SIGNAL(clicked()), mainwindow, SLOT(onBrowserDownloadsClicked()));
   QObject::connect(browserUpButton, SIGNAL(clicked()), mainwindow, SLOT(onBrowserUpClicked()));
   QObject::connect(browserStartButton, SIGNAL(clicked()), mainwindow, SLOT(onBrowserStartClicked()));

   browserButtonsHBoxLayout = new QHBoxLayout();
   browserButtonsHBoxLayout->addWidget(browserUpButton);
   browserButtonsHBoxLayout->addWidget(browserStartButton);
   browserButtonsHBoxLayout->addWidget(browserDownloadsButton);

   qobject_cast<QVBoxLayout*>(browserWidget->layout())->addLayout(browserButtonsHBoxLayout);
   browserWidget->layout()->addWidget(mainwindow->dirTreeView());

   browserAndPlaylistTabWidget = mainwindow->browserAndPlaylistTabWidget();
   browserAndPlaylistTabWidget->setObjectName("browserAndPlaylistTabWidget");

   /* Several functions depend on the same tab title strings here, so if you change these, make sure to change those too
    * setCoreActions()
    * onTabWidgetIndexChanged()
    * onCurrentListItemChanged()
    */
   browserAndPlaylistTabWidget->addTab(playlistWidget, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_PLAYLISTS));
   browserAndPlaylistTabWidget->addTab(browserWidget, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER));

   browserAndPlaylistTabDock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER), mainwindow);
   browserAndPlaylistTabDock->setObjectName("browserAndPlaylistTabDock");
   browserAndPlaylistTabDock->setProperty("default_area", Qt::LeftDockWidgetArea);
   browserAndPlaylistTabDock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER));
   browserAndPlaylistTabDock->setWidget(browserAndPlaylistTabWidget);

   mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(browserAndPlaylistTabDock->property("default_area").toInt()), browserAndPlaylistTabDock);

   browserButtonsHBoxLayout->addItem(new QSpacerItem(browserAndPlaylistTabWidget->tabBar()->width(), 20, QSizePolicy::Expanding, QSizePolicy::Minimum));

   thumbnailWidget = new ThumbnailWidget();
   thumbnail2Widget = new ThumbnailWidget();
   thumbnail3Widget = new ThumbnailWidget();

   thumbnailWidget->setLayout(new QVBoxLayout());
   thumbnail2Widget->setLayout(new QVBoxLayout());
   thumbnail3Widget->setLayout(new QVBoxLayout());

   thumbnailWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
   thumbnail2Widget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
   thumbnail3Widget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));

   thumbnail = new ThumbnailLabel();
   thumbnail->setObjectName("thumbnail");

   thumbnail2 = new ThumbnailLabel();
   thumbnail2->setObjectName("thumbnail2");

   thumbnail3 = new ThumbnailLabel();
   thumbnail3->setObjectName("thumbnail3");

   thumbnail->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
   thumbnail2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
   thumbnail3->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));

   QObject::connect(mainwindow, SIGNAL(thumbnailChanged(const QPixmap&)), thumbnail, SLOT(setPixmap(const QPixmap&)));
   QObject::connect(mainwindow, SIGNAL(thumbnail2Changed(const QPixmap&)), thumbnail2, SLOT(setPixmap(const QPixmap&)));
   QObject::connect(mainwindow, SIGNAL(thumbnail3Changed(const QPixmap&)), thumbnail3, SLOT(setPixmap(const QPixmap&)));

   thumbnailWidget->layout()->addWidget(thumbnail);
   thumbnail2Widget->layout()->addWidget(thumbnail2);
   thumbnail3Widget->layout()->addWidget(thumbnail3);

   thumbnailDock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART), mainwindow);
   thumbnailDock->setObjectName("thumbnailDock");
   thumbnailDock->setProperty("default_area", Qt::RightDockWidgetArea);
   thumbnailDock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART));
   thumbnailDock->setWidget(thumbnailWidget);

   mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(thumbnailDock->property("default_area").toInt()), thumbnailDock);

   thumbnail2Dock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN), mainwindow);
   thumbnail2Dock->setObjectName("thumbnail2Dock");
   thumbnail2Dock->setProperty("default_area", Qt::RightDockWidgetArea);
   thumbnail2Dock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN));
   thumbnail2Dock->setWidget(thumbnail2Widget);

   mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(thumbnail2Dock->property("default_area").toInt()), thumbnail2Dock);

   thumbnail3Dock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT), mainwindow);
   thumbnail3Dock->setObjectName("thumbnail3Dock");
   thumbnail3Dock->setProperty("default_area", Qt::RightDockWidgetArea);
   thumbnail3Dock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT));
   thumbnail3Dock->setWidget(thumbnail3Widget);

   mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(thumbnail3Dock->property("default_area").toInt()), thumbnail3Dock);

   mainwindow->tabifyDockWidget(thumbnailDock, thumbnail2Dock);
   mainwindow->tabifyDockWidget(thumbnailDock, thumbnail3Dock);

   /* when tabifying the dock widgets, the last tab added is selected by default, so we need to re-select the first tab */
   thumbnailDock->raise();

   coreSelectionWidget = new QWidget();
   coreSelectionWidget->setLayout(new QVBoxLayout());

   launchWithComboBox = mainwindow->launchWithComboBox();

   launchWithWidgetLayout = new QVBoxLayout();

   launchWithWidget = new QWidget();
   launchWithWidget->setLayout(launchWithWidgetLayout);

   coreComboBoxLayout = new QHBoxLayout();

   mainwindow->runPushButton()->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
   mainwindow->stopPushButton()->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
   mainwindow->startCorePushButton()->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));

   coreComboBoxLayout->addWidget(launchWithComboBox);
   coreComboBoxLayout->addWidget(mainwindow->startCorePushButton());
   coreComboBoxLayout->addWidget(mainwindow->coreInfoPushButton());
   coreComboBoxLayout->addWidget(mainwindow->runPushButton());
   coreComboBoxLayout->addWidget(mainwindow->stopPushButton());

   mainwindow->stopPushButton()->hide();

   coreComboBoxLayout->setStretchFactor(launchWithComboBox, 1);

   launchWithWidgetLayout->addLayout(coreComboBoxLayout);

   coreSelectionWidget->layout()->addWidget(launchWithWidget);

   coreSelectionWidget->layout()->addItem(new QSpacerItem(20, browserAndPlaylistTabWidget->height(), QSizePolicy::Minimum, QSizePolicy::Expanding));

   coreSelectionDock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE), mainwindow);
   coreSelectionDock->setObjectName("coreSelectionDock");
   coreSelectionDock->setProperty("default_area", Qt::LeftDockWidgetArea);
   coreSelectionDock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE));
   coreSelectionDock->setWidget(coreSelectionWidget);

   mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(coreSelectionDock->property("default_area").toInt()), coreSelectionDock);

   mainwindow->splitDockWidget(browserAndPlaylistTabDock, coreSelectionDock, Qt::Vertical);

#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
   mainwindow->resizeDocks(QList<QDockWidget*>() << coreSelectionDock, QList<int>() << 1, Qt::Vertical);
#endif

   /* this should come last */
   mainwindow->resizeThumbnails(true, true, true);

   if (qsettings->contains("geometry"))
      if (qsettings->contains("save_geometry"))
         mainwindow->restoreGeometry(qsettings->value("geometry").toByteArray());

   if (qsettings->contains("save_dock_positions"))
      if (qsettings->contains("dock_positions"))
         mainwindow->restoreState(qsettings->value("dock_positions").toByteArray());

   if (qsettings->contains("save_last_tab"))
   {
      if (qsettings->contains("last_tab"))
      {
         int lastTabIndex = qsettings->value("last_tab", 0).toInt();

         if (lastTabIndex >= 0 && browserAndPlaylistTabWidget->count() > lastTabIndex)
            browserAndPlaylistTabWidget->setCurrentIndex(lastTabIndex);
      }
   }

   if (qsettings->contains("theme"))
   {
      QString themeStr = qsettings->value("theme").toString();
      MainWindow::Theme theme = mainwindow->getThemeFromString(themeStr);

      if (qsettings->contains("custom_theme") && theme == MainWindow::THEME_CUSTOM)
      {
         QString customThemeFilePath = qsettings->value("custom_theme").toString();

         mainwindow->setCustomThemeFile(customThemeFilePath);
      }

      mainwindow->setTheme(theme);
   }
   else
      mainwindow->setTheme();

   return handle;
}
GlobalViewFrame::GlobalViewFrame(QWidget *p_parent,Editor *p_editor) : QFrame (p_parent) {
	
	editor=p_editor;
	
	QGridLayout *l = new QGridLayout(this);
	
	cursor_op= new GlobalViewCursor(this);
	
	l->addWidget(cursor_op,0,0,1,3);
		
	
	QFrame *gb_frame = new QFrame( this );
	gb_frame->setLayout(new QHBoxLayout(gb_frame));
	gb_frame->setLineWidth(0);
	gb_frame->setFrameStyle(Panel+Sunken);
	gb_frame->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
	l->addWidget(gb_frame,1,0,1,2);
	marker_column = new MarkerColumn(gb_frame,editor);
	gb_frame->layout()->addWidget(marker_column);	
	loop_column = new LoopColumn(gb_frame,editor);
	gb_frame->layout()->addWidget(loop_column);
	beat_bar_column = new GlobalBeatBarColumn(gb_frame,editor);
	gb_frame->layout()->addWidget(beat_bar_column);
	
	
	CVBox *gv_vbox = new CVBox( gb_frame );
	
	global_view = new GlobalView( gv_vbox, p_editor);
	gb_frame->layout()->addWidget(gv_vbox);
	gb_frame->layout()->setMargin(0);
	gb_frame->layout()->setSpacing(0);
	
	
	marker_column->set_global_view( global_view );
	loop_column->set_global_view( global_view );
	beat_bar_column->set_global_view( global_view );


//	v_scroll = new QScrollBar(Qt::Vertical,this);
	v_scroll = new PixmapScrollBar(this,PixmapScrollBar::Skin(GET_SKIN(SKINBOX_THEME_SCROLLBAR_V_BG),GET_SKIN(SKINBOX_THEME_SCROLLBAR_GRABBER)),PixmapScrollBar::TYPE_VERTICAL);
	
	
	l->addWidget(v_scroll,1,2);
	
	
	
	QWidget *hw = new QWidget(this);
	QHBoxLayout *h = new QHBoxLayout(hw);
	hw->setLayout(h);
	
	l->addWidget(hw,2,1);
	//h_scroll = new QScrollBar(Qt::Horizontal,hw);
	h_scroll = new PixmapScrollBar(gv_vbox,PixmapScrollBar::Skin(GET_SKIN(SKINBOX_THEME_SCROLLBAR_H_BG),GET_SKIN(SKINBOX_THEME_SCROLLBAR_GRABBER)),PixmapScrollBar::TYPE_HORIZONTAL);
	h_scroll->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
	h_scroll->hide();
	//h->addWidget(h_scroll);
	//l->addWidget( new PixmapLabel(this,GET_QPIXMAP(THEME_GLOBAL_TOOLBAR__BOTTOM_RIGHT_PIXMAP)),2,2);
//	zoom = new QSlider(Qt::Horizontal,hw);
//	zoom->setRange(0,100);
//	zoom->setValue(0);
	
//	h->addWidget(zoom);
//	h->setStretchFactor(h_scroll,4);
//	h->setStretchFactor(zoom,1);
//	QLabel *z=new QLabel(this);
//	z->setPixmap(GET_QPIXMAP(ICON_ZOOM_SMALL));
//	l->addWidget(z,2,2);
	
	//some default
//	zoom_changed_slot( 35 );
//	zoom->setValue(35); 
	
	QObject::connect(global_view,SIGNAL(resized_signal()),this,SLOT(block_list_changed_slot()));
	QObject::connect(global_view,SIGNAL(resized_signal()),this,SIGNAL(global_view_changed_blocks_signal()));
	QObject::connect(h_scroll,SIGNAL(value_changed_signal( int )),this,SLOT(h_scollbar_changed_slot( int )));
	QObject::connect(v_scroll,SIGNAL(value_changed_signal(int)),this,SLOT(v_scollbar_changed_slot( int )));
	QObject::connect(cursor_op,SIGNAL(zoom_changed( float )),this,SLOT(zoom_changed_slot(float)));
	QObject::connect(cursor_op,SIGNAL(edit_mode_changed_signal( int )),global_view,SLOT(set_edit_mode( int )));
	QObject::connect(cursor_op,SIGNAL(delete_clicked_signal()),global_view,SLOT(delete_selected_blocks()));
	
	QObject::connect(cursor_op,SIGNAL(select_linked_signal()),global_view,SLOT(select_linked_slot()));
	QObject::connect(cursor_op,SIGNAL(unlink_selected_signal()),global_view,SLOT(unlink_selected_slot()));

	QObject::connect(cursor_op,SIGNAL(repeat_set_signal()),global_view,SLOT(block_repeat_set_signal()));
	QObject::connect(cursor_op,SIGNAL(repeat_unset_signal()),global_view,SLOT(block_repeat_unset_signal()));
	
	l->setMargin(0);
	l->setSpacing(0);
	h->setMargin(0);
	
	//setFrameStyle(Panel+Sunken);
	setLineWidth(0);
	
}
ToolsDockWidget::ToolsDockWidget(QWidget * parent) :
    QDockWidget(i18n("Tools"),parent),
//    m_has_selection(false),
    m_current_item(0),
    m_scene(0),
    d(new ToolsDockWidgetPrivate)
{
    this->setFeatures(QDockWidget::DockWidgetMovable);
    this->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

    QWidget * widget = new QWidget(this);
    QVBoxLayout * layout = new QVBoxLayout(widget);
    //layout->setSizeConstraint(QLayout::SetMinimumSize);

    // tools buttons layout
    d->formLayout = new QGridLayout();
    //formLayout->setSizeConstraint(QLayout::SetMinimumSize);
    layout->addLayout(d->formLayout);

    // stacked widget (with tools widgets)
    d->toolArea = new QScrollArea(widget);
    //sa->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
    d->toolArea->setFrameShape(QFrame::NoFrame);
    d->toolArea->setWidgetResizable(true);
    d->toolArea->setWidget(0);
    layout->addWidget(d->toolArea,1);

    QButtonGroup * group = new QButtonGroup(widget);

    // Selection tool

    m_tool_pointer = new KPushButton(KGuiItem("",":/pointer.png",
                                              i18n("Allows to select and move images on canvas"),
                                              i18n("Tool which allows one to select and move images on canvas. Any other operations are disabled.")), widget);
    m_tool_pointer->setIconSize(QSize(24,24));
    m_tool_pointer->setFixedSize(32,32);
    m_tool_pointer->setCheckable(true);
    m_tool_pointer->setFlat(true);
    group->addButton(m_tool_pointer);
    connect(m_tool_pointer,SIGNAL(toggled(bool)),this,SLOT(setPointerToolVisible(bool)));

    // View tool
    m_tool_hand = new KPushButton(KGuiItem("",":/hand.png",
                                           i18n("Viewing tool"),
                                           i18n("This tool allows one to view whole canvas in read-only mode. Only scrolling and zooming are available.")), widget);
    m_tool_hand->setIconSize(QSize(24,24));
    m_tool_hand->setFixedSize(32,32);
    m_tool_hand->setCheckable(true);
    m_tool_hand->setFlat(true);
    group->addButton(m_tool_hand);
    connect(m_tool_hand,SIGNAL(toggled(bool)),this,SLOT(setHandToolVisible(bool)));

    // Zoom tool
    m_tool_zoom = new KPushButton(KGuiItem("",":/zoom.png",
                                           i18n("Zooming tool"),
                                           i18n("This tool allows one to zoom canvas to fit it to the application window or users preferences.")), widget);
    m_tool_zoom->setIconSize(QSize(24,24));
    m_tool_zoom->setFixedSize(32,32);
    m_tool_zoom->setCheckable(true);
    m_tool_zoom->setFlat(true);
    group->addButton(m_tool_zoom);
    connect(m_tool_zoom,SIGNAL(toggled(bool)),this,SLOT(setZoomWidgetVisible(bool)));

    // Canvas edit tool
    m_canvas_button = new KPushButton(KGuiItem("", ":/tool_canvas.png",
                                               i18n("Canvas editor"),
                                               i18n("This tool allows you to edit canvas properties like size and background.")), widget);
    m_canvas_button->setIconSize(QSize(24,24));
    m_canvas_button->setFixedSize(32,32);
    m_canvas_button->setCheckable(true);
    m_canvas_button->setFlat(true);
    group->addButton(m_canvas_button);
    connect(m_canvas_button,SIGNAL(toggled(bool)),this,SLOT(setCanvasWidgetVisible(bool)));

    // Text tool
    m_text_button = new KPushButton(KGuiItem("", ":/tool_text.png",
                                              i18n("Text editor"),
                                              i18n("This tool allows you to write text on the canvas. It's simple - just click on the canvas where you want to add some text and write it!")), widget);

    m_text_button->setIconSize(QSize(24,24));
    m_text_button->setFixedSize(32,32);
    m_text_button->setCheckable(true);
    m_text_button->setFlat(true);
    group->addButton(m_text_button);
    connect(m_text_button,SIGNAL(toggled(bool)),this,SLOT(setTextWidgetVisible(bool)));

    // Rotate tool
    m_rotate_button = new KPushButton(KGuiItem("", ":/tool_rotate.png",
                                              i18n("Rotation tool"),
                                              i18n("This tool allows you to rotate items on your canvas.")), widget);
    m_rotate_button->setIconSize(QSize(24,24));
    m_rotate_button->setFixedSize(32,32);
    m_rotate_button->setCheckable(true);
    m_rotate_button->setFlat(true);
    group->addButton(m_rotate_button);
    connect(m_rotate_button,SIGNAL(toggled(bool)),this,SLOT(setRotateWidgetVisible(bool)));

    // Scale tool
    m_scale_button = new KPushButton(KGuiItem("", ":/tool_scale4.png",
                                              i18n("Scaling tool"),
                                              i18n("This tool allows you to scale items on your canvas.")), widget);
    m_scale_button->setIconSize(QSize(24,24));
    m_scale_button->setFixedSize(32,32);
    m_scale_button->setCheckable(true);
    m_scale_button->setFlat(true);
    group->addButton(m_scale_button);
    connect(m_scale_button,SIGNAL(toggled(bool)),this,SLOT(setScaleWidgetVisible(bool)));

    // Crop tool
    m_crop_button = new KPushButton(KGuiItem("", ":/tool_cropt.png",
                                              i18n("Crop tool"),
                                              i18n("This tool allows you to crop items.")), widget);
    m_crop_button->setIconSize(QSize(24,24));
    m_crop_button->setFixedSize(32,32);
    m_crop_button->setCheckable(true);
    m_crop_button->setFlat(true);
    group->addButton(m_crop_button);
    connect(m_crop_button,SIGNAL(toggled(bool)),this,SLOT(setCropWidgetVisible(bool)));

    // Photo effects tool
    m_effects_button = new KPushButton(KGuiItem("", ":/tool_effects.png",
                                              i18n("Image effects editor"),
                                              i18n("This tool allows you to edit existing effects of your photo layers and add some new one.")), widget);
    m_effects_button->setIconSize(QSize(24,24));
    m_effects_button->setFixedSize(32,32);
    m_effects_button->setCheckable(true);
    m_effects_button->setFlat(true);
    group->addButton(m_effects_button);
    connect(m_effects_button,SIGNAL(toggled(bool)),this,SLOT(setEffectsWidgetVisible(bool)));

    // Border edit tool
    m_tool_border = new KPushButton(QIcon::fromTheme(":/tool_border.png"), "", widget);
    m_tool_border->setIconSize(QSize(24,24));
    m_tool_border->setFixedSize(32,32);
    m_tool_border->setCheckable(true);
    m_tool_border->setFlat(true);
    group->addButton(m_tool_border);
    connect(m_tool_border,SIGNAL(toggled(bool)),this,SLOT(setBordersWidgetVisible(bool)));

    // Spacer
    d->formLayout->setSpacing(0);
    d->formLayout->setMargin(0);

    layout->setSpacing(0);
    layout->setMargin(0);
    widget->setLayout(layout);
    //widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
    this->setWidget(widget);
    this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
    this->setMinimumWidth(235);

    setDefaultTool();
}
ThreeAxisDataVisualizator::ThreeAxisDataVisualizator(int duree,int dataFreq,int min, int max, int _type, QWidget *parent):
    QWidget(parent),
    duree_de_visualisation(duree),
    frequency(dataFreq),
    type(_type),
    min(0),
    max(0)
{
    curves = QList<QString>();
    QString typeStr;
    if(type==DataType::acc){
        typeStr = "accelerometre";
    }else  if(type==DataType::gyro){
        typeStr = "gyroscope";
    }else  if(type==DataType::euler){
        typeStr = "euler";
    }else  if(type==DataType::qua){
        typeStr = "quaternion";
    }

    curves.append(typeStr+" x");
    curves.append(typeStr+" y");
    curves.append(typeStr+" z");

    QHBoxLayout * mainLayout = new QHBoxLayout;
    this->setLayout(mainLayout);

    plot = new QwtPlot();
    mainLayout->addWidget(plot,5);

    QWidget * checkBoxGroup = new QWidget(this);
    mainLayout->addWidget(checkBoxGroup,1);

    QVBoxLayout * checkBoxGroupLayout = new QVBoxLayout;
    checkBoxGroup->setLayout(checkBoxGroupLayout);

    QPushButton * resetScaleButton = new QPushButton;
    resetScaleButton->setText("reset y scale");
    setStyleSheet("QPushButton{"
                  "font-family: Futura;"
                  "color:#4C6BCF;"
                  "font-size: 14px;"
                  "border:2px solid ;"
                  "border-color: #4C6BCF;"
                  "border-radius:5px;"
                  "min-height:60;}");

    checkBoxGroupLayout->addWidget(resetScaleButton);

    checkBoxX = new QCheckBox(curves.at(0),checkBoxGroup);
    checkBoxGroupLayout->addWidget(checkBoxX);

    checkBoxY = new QCheckBox(curves.at(1),checkBoxGroup);
    checkBoxGroupLayout->addWidget(checkBoxY);

    checkBoxZ = new QCheckBox(curves.at(2),checkBoxGroup);
    checkBoxGroupLayout->addWidget(checkBoxZ);

    timeSlider = new QSlider(Qt::Horizontal,checkBoxGroup);
    checkBoxGroupLayout->addWidget(timeSlider);

    checkBoxX->setChecked(true);
    checkBoxY->setChecked(true);
    checkBoxZ->setChecked(true);

    QSignalMapper * mapper = new QSignalMapper;
    mapper->setMapping(checkBoxX,0);
    mapper->setMapping(checkBoxY,1);
    mapper->setMapping(checkBoxZ,2);

    connect(checkBoxX,SIGNAL(stateChanged(int)),mapper,SLOT(map()));
    connect(checkBoxY,SIGNAL(stateChanged(int)),mapper,SLOT(map()));
    connect(checkBoxZ,SIGNAL(stateChanged(int)),mapper,SLOT(map()));

    connect(mapper,SIGNAL(mapped(int)),SLOT(handleCheckBox(int)));

    // canvas
    QwtPlotCanvas *canvas = new QwtPlotCanvas();
    canvas->setLineWidth( 1 );
    canvas->setFrameStyle( QFrame::Box | QFrame::Plain );
    canvas->setBorderRadius( 15 );

    QPalette canvasPalette( Qt::white );
    canvasPalette.setColor( QPalette::Foreground, QColor( 133, 190, 232 ) );
    canvas->setPalette( canvasPalette );

    plot->setCanvas( canvas );

    QwtPlotScaleItem *it1 = new QwtPlotScaleItem(QwtScaleDraw::BottomScale ,0.0);
    it1->attach(plot);
    plot->enableAxis(QwtPlot::xBottom,false);
    plot->setAxisScale( QwtPlot::xBottom, 0.0, duree_de_visualisation );
    plot->setAxisScale( QwtPlot::yLeft, min, max );

    xCurve = new QwtPlotCurve( curves.at(0));
    xCurve->setRenderHint( QwtPlotItem::RenderAntialiased );
    xCurve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true );
    xCurve->setPen( Qt::red );
    xCurve->attach( plot );

    yCurve = new QwtPlotCurve(curves.at(1));
    yCurve->setRenderHint( QwtPlotItem::RenderAntialiased );
    yCurve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true );
    yCurve->setPen( Qt::blue );
    yCurve->attach( plot );

    zCurve = new QwtPlotCurve( curves.at(2));
    zCurve->setRenderHint( QwtPlotItem::RenderAntialiased );
    zCurve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true );
    zCurve->setPen( Qt::green );
    zCurve->attach( plot );


   timerReplot = new QTimer;
   timerReplot->setInterval(50);
   connect(timerReplot,SIGNAL(timeout()),plot,SLOT(replot()));
   connect(timeSlider,SIGNAL(sliderMoved(int)),SLOT(updateVizualizatorTimeWindow(int)));

   timerRescale = new QTimer;
   timerRescale->setInterval(1000);
   connect(timerRescale,SIGNAL(timeout()),SLOT(rescale()));

   connect(resetScaleButton,SIGNAL(clicked(bool)),SLOT(resetScale()));

    setEnabled(false);
}
Example #16
0
EFFEditorInspectorPanel::EFFEditorInspectorPanel(QWidget * parent) : QDockWidget(parent)
{
	/*m_pTitleBar = new EFFEditorUIDockWidgetTitleBar(this, tr("Inspector"));
	setWindowTitle(tr("Inspector"));
	setTitleBarWidget(m_pTitleBar);

	QObject::connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(titleBarAddOrDeleteTab(bool)));*/

	setWindowTitle(tr("Inspector"));
	setObjectName(tr("InspectorPanel"));
	setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);

	m_pContent = new QWidget(this);

	m_pMainLayout = new QVBoxLayout();
	m_pMainLayout->setContentsMargins(2, 1, 1, 1);
	m_pMainLayout->setSpacing(0);


	QWidget * inspectorHeadPanel = new QWidget();
	inspectorHeadPanel->setObjectName("inspectorHead");

	QVBoxLayout * inspectorHeadLayout = new QVBoxLayout();
	inspectorHeadLayout->setContentsMargins(3, 3, 3, 3);
	inspectorHeadLayout->setSpacing(3);

	QHBoxLayout * nameLayout = new QHBoxLayout();
	QCheckBox * nameCheckBox = new QCheckBox();
	nameLayout->addWidget(nameCheckBox);
	m_pNameEdit = new QLineEdit();
	nameLayout->addWidget(m_pNameEdit);
	QCheckBox * staticCheckBox = new QCheckBox();
	nameLayout->addWidget(staticCheckBox);
	QPushButton * staticButton = new QPushButton();
	nameLayout->addWidget(staticButton);
	QPushButton * staticTypeSelectButton = new QPushButton();
	nameLayout->addWidget(staticTypeSelectButton);

	inspectorHeadLayout->addLayout(nameLayout);


	QHBoxLayout * tagAndLayerLayout = new QHBoxLayout();
	QLabel * tagLabel = new QLabel();
	tagLabel->setText(tr("Tag"));
	tagAndLayerLayout->addWidget(tagLabel);
	QPushButton * tagButton = new QPushButton();
	tagAndLayerLayout->addWidget(tagButton, 1);

	QLabel * layerLabel = new QLabel();
	layerLabel->setText(tr("Layer"));
	tagAndLayerLayout->addWidget(layerLabel);
	QPushButton * layerButton = new QPushButton();
	tagAndLayerLayout->addWidget(layerButton, 1);

	inspectorHeadLayout->addLayout(tagAndLayerLayout);
	inspectorHeadPanel->setLayout(inspectorHeadLayout);

	m_pMainLayout->addWidget(inspectorHeadPanel);

	m_pTransformPanel = new EFFEditorTransformPanel();
	m_pMainLayout->addWidget(m_pTransformPanel);

	//Ìî³äÊ£ÓàÇøÓò
	QWidget * pWidget = new QWidget();
	m_pMainLayout->addWidget(pWidget, 1);


	m_pContent->setLayout(m_pMainLayout);
	setWidget(m_pContent);
}
Example #17
0
bool UiHelpers::createButtonFooter(QWidget& footer, QList<QWidget*> list, ButtonLayout f)
{
	Q_ASSERT(list.count() != 0);
	if(list.count() == 0)
	{
		qCritical() << __FUNCTION__ << "Invalid arguments";
		return false;
	}

	QHBoxLayout* hLayout = new QHBoxLayout;
	if(f == AllRight || f == CenterWidgets)
	{
		hLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding));
		for(int i = 0; i < list.count(); i++)
		{
			Q_ASSERT(list[i]);
			hLayout->addWidget(list[i]);
			list[i]->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
		}
		if(f == CenterWidgets)
		{
			hLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding));
		}
	}
	else if (f == LastRightAndRestCenter)
	{
		QWidget* w = new QWidget;
		w->setMinimumWidth(list.last()->width());
		hLayout->addWidget(w);
		hLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding));
		for(int i = 0; i < list.count() - 1; i++)
		{
			Q_ASSERT(list[i]);
			hLayout->addWidget(list[i]);
		}
		Q_ASSERT(list.last());
		hLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding));
		hLayout->addWidget(list.last());
	}
	else if(f == FirstLeftAndRestRight)
	{
		Q_ASSERT(list.first());
		hLayout->addWidget(list.first());
		hLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding));
		for(int i = 1; i < list.count(); i++)
		{
			Q_ASSERT(list[i]);
			hLayout->addWidget(list[i]);
			list[i]->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
		}
	}
	else
	{
		delete hLayout;
		return false;
	}

	QVBoxLayout* vLayout = new QVBoxLayout;
	vLayout->addStretch();
	vLayout->addLayout(hLayout);
	vLayout->addStretch();

	vLayout->setContentsMargins(8, 8, 8, 0);
	footer.setLayout(vLayout);
	footer.setProperty(FOOTER_PROPERTY, true);
	return true;
}
Example #18
0
QRibbonSection::QRibbonSection(QWidget *parent, const QString &_title, const QString &_name) : QWidget(parent)
{
    action = NULL;
    col = 0;
    row = 0;
    colBase = 0;
    _index = -1;

    if (&_name) { this->setObjectName(_name); }

    QHBoxLayout *slayout = new QHBoxLayout();
    slayout->setContentsMargins(2,0,2,0);
    slayout->setSpacing(2);
    this->setLayout(slayout);

    //QLabel *lab_line = new QLabel("X", this);
    QFrame *line = new QFrame(this);
    line->setFrameStyle(QFrame::VLine | QFrame::Plain);
    line->setFixedWidth(3);
    line->setContentsMargins(0,3,0,5);
    line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    QString sheet = line->styleSheet();
    sheet.append("QFrame { color: #c0c0c0; }");
    line->setStyleSheet(sheet);

    QWidget *wvbox = new QWidget(this);
    QVBoxLayout *layout = new QVBoxLayout();
    layout->setContentsMargins(0,0,0,0);
    layout->setSpacing(0);
    wvbox->setLayout(layout);

    buttons = new QWidget(wvbox);
    QGridLayout *blayout = new QGridLayout();
    blayout->setContentsMargins(0,0,0,0);
    blayout->setSpacing(2);
    buttons->setLayout(blayout);

    QHBoxLayout *lfooter = new QHBoxLayout();
    lfooter->setContentsMargins(0,0,0,0);
    QWidget *footer = new QWidget(wvbox);
    footer->setLayout(lfooter);

    if (&title == 0) {
        title = new QLabel("", footer);
    } else {
        title = new QLabel(_title, footer);
    }
    title->setAlignment(Qt::AlignCenter);
    QFont titleFont = title->font();
    titleFont.setPointSize(titleFont.pointSize()*0.98f);
    title->setFont(titleFont);

    {
        QIcon *dtl = new QIcon(":/icons/QRibbonDetails.svg");
        details = new QRibbonButton(*dtl, "", footer);
        delete dtl;
    }
    details->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    QFont f;
    QFontMetrics metrics(f);
    QSize is = QSize(metrics.boundingRect("^").width(), metrics.boundingRect("X").height());
    is = QSize(is.width()*2, is.height());
    details->setIconSize(is);
    details->setMaximumSize(is);
    details->setVisible(false);
    QObject::connect(details, SIGNAL(clicked()), this, SLOT(activateDetails()));


    lfooter->addWidget(title, 1);
    lfooter->addWidget(details);

    layout->addWidget(buttons, 1);
    layout->addWidget(footer);

    slayout->addWidget(wvbox, 1);
    slayout->addWidget(line, 1);
}
Example #19
0
ProofPage::ProofPage(ResizableStackedWidget *pageStack, Model *model, QWidget *parent)
    : QWidget(parent)
{
    this->model = model;
    this->pageStack = pageStack;



    proofEditForm = new ProofForm();
    proofEditDialog = new Dialog(this, proofEditForm, "Edit the proof...", "Change", "Cancel");

    proofDeleteDialog = new Dialog(this, nullptr, "Are you sure you want to delete this proof?", "Delete", "Cancel");



    QVBoxLayout *outerLayout = new QVBoxLayout(this);



    //  ##   ## #######   ###   #####   ####### #####
    //  ##   ## ##       ## ##  ##  ##  ##      ##  ##
    //  ##   ## ##      ##   ## ##   ## ##      ##   ##
    //  ####### #####   ##   ## ##   ## #####   ##  ##
    //  ##   ## ##      ####### ##   ## ##      #####
    //  ##   ## ##      ##   ## ##  ##  ##      ##  ##
    //  ##   ## ####### ##   ## #####   ####### ##   ##

    // The breadcrumbs show the current course and provide
    // a way to go back to the courses screen.
    // It is presented like a filepath.

    QHBoxLayout *crumbBorderLayout = new QHBoxLayout();

    breadCrumbs = new BreadCrumbs(3, model, pageStack);
    breadCrumbs->setFixedWidth(700);

    crumbBorderLayout->addStretch(1);
    crumbBorderLayout->addWidget(breadCrumbs);
    crumbBorderLayout->addStretch(1);

    outerLayout->addLayout(crumbBorderLayout);



    // Now show the name of the current proof and some buttons to
    // edit it, delete it or add a new dependency.

    QHBoxLayout *topBorderLayout = new QHBoxLayout();

    QWidget *topWidget = new QWidget();
    topWidget->setFixedWidth(700);
    QHBoxLayout *topLayout = new QHBoxLayout(topWidget);
    topLayout->setContentsMargins(0, 0, 0, 0);

    proofLabel = new QLabel();
    proofLabel->setWordWrap(true);
    proofLabel->setScaledContents(true);

    QFont proofFont = proofLabel->font();
    proofFont.setPointSize(24);
    proofLabel->setFont(proofFont);

    trafficLight = new TrafficLight(TrafficLight::AMBER);
    trafficLight->setFixedSize(QSize(32, 32));
    QVBoxLayout *trafficLightVLayout = new QVBoxLayout();
    trafficLightVLayout->addSpacing(16);
    trafficLightVLayout->addWidget(trafficLight);

    editProofButton = new ImageButton(QPixmap(":/images/pencil_black.png"), QSize(32, 32));
    QVBoxLayout *editProofVLayout = new QVBoxLayout();
    editProofVLayout->addSpacing(16);
    editProofVLayout->addWidget(editProofButton);

    deleteProofButton = new ImageButton(QPixmap(":/images/trash_black.png"), QSize(32, 32));
    QVBoxLayout *deleteProofVLayout = new QVBoxLayout();
    deleteProofVLayout->addSpacing(16);
    deleteProofVLayout->addWidget(deleteProofButton);

    topLayout->addWidget(proofLabel);
    topLayout->addLayout(trafficLightVLayout);
    topLayout->addSpacing(10);
    topLayout->addLayout(editProofVLayout);
    topLayout->addSpacing(10);
    topLayout->addLayout(deleteProofVLayout);

    topBorderLayout->addStretch(1);
    topBorderLayout->addWidget(topWidget);
    topBorderLayout->addStretch(1);
    outerLayout->addLayout(topBorderLayout);



    outerLayout->addSpacing(20);
    outerLayout->addWidget(new HorizontalSeperator(QColor(66, 139, 202), 2));
    outerLayout->addSpacing(20);



    //  ######   #####  #####   ##    ##
    //  ##   ## ##   ## ##  ###  ##  ##
    //  ##   ## ##   ## ##   ##   ####
    //  ######  ##   ## ##   ##    ##
    //  ##   ## ##   ## ##   ##    ##
    //  ##   ## ##   ## ##  ###    ##
    //  ######   #####  #####      ##

    // Use a vertical splitter to divide the areas.

    splitter = new Splitter(Qt::Vertical);
    outerLayout->addWidget(splitter);
    splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);



    // The first area is a large text editing widget, this is
    // used to edit the proof's body.
    // The QTextEdit does its own scrolling.

    bodyTextEdit = new QTextEdit();

    QFont font = bodyTextEdit->font();
    font.setFamily("Courier");
    font.setPointSize(12);
    bodyTextEdit->setFont(font);

    bodyHighlighter = new LatexHighlighter(bodyTextEdit->document());

    splitter->addWidget(bodyTextEdit);

    QTimer *bodySaveTimer = new QTimer(this);
    bodySaveTimer->setSingleShot(true);
    bodySaveTimer->setInterval(200);

    connect(bodyTextEdit, SIGNAL(textChanged()), bodySaveTimer, SLOT(start()));
    connect(bodySaveTimer, SIGNAL(timeout()), this, SLOT(saveBody()));



    // The second area contains the rendered body.

    QScrollArea *bodyScrollArea = new QScrollArea();
    bodyScrollArea->setWidgetResizable(true);
    bodyScrollArea->setFrameShape(QFrame::NoFrame);

    QWidget *bodyWidget = new QWidget();

    QPalette palette = bodyWidget->palette();
    palette.setColor(QPalette::Background, Qt::white);
    bodyWidget->setPalette(palette);
    bodyWidget->setAutoFillBackground(true);

    bodyImage = new ResizableImage("");

    QHBoxLayout *bodyHLayout = new QHBoxLayout();
    bodyHLayout->addStretch(1);
    bodyHLayout->addWidget(bodyImage);
    bodyHLayout->addStretch(1);

    QVBoxLayout *bodyVLayout = new QVBoxLayout();
    bodyVLayout->addLayout(bodyHLayout);
    bodyVLayout->addStretch(1);

    bodyWidget->setLayout(bodyVLayout);
    bodyScrollArea->setWidget(bodyWidget);
    splitter->addWidget(bodyScrollArea);



    //  #####  ####  #####  ##   ##   ###   ##       #####
    // ##   ##  ##  ##   ## ###  ##  ## ##  ##      ##   ##
    //  ##      ##  ##      ###  ## ##   ## ##       ##
    //   ###    ##  ##      ####### ##   ## ##        ###
    //     ##   ##  ##  ### ##  ### ####### ##          ##
    // ##   ##  ##  ##   ## ##  ### ##   ## ##      ##   ##
    //  #####  ####  #####  ##   ## ##   ## #######  #####

    connect(editProofButton, SIGNAL(clicked()), this, SLOT(proofEditButtonClicked()));

    connect(proofEditDialog, SIGNAL(accepted()), this, SLOT(proofEditDialogCompleted()));
    connect(proofEditDialog, SIGNAL(rejected()), proofEditDialog, SLOT(close()));

    connect(deleteProofButton, SIGNAL(clicked()), proofDeleteDialog, SLOT(show()));

    connect(proofDeleteDialog, SIGNAL(accepted()), this, SLOT(proofDeleteDialogAccepted()));
    connect(proofDeleteDialog, SIGNAL(rejected()), proofDeleteDialog, SLOT(close()));

    connect(model, SIGNAL(proofSelectedChanged(Proof)), this, SLOT(proofSelectedChangedSlot(Proof)));
    connect(model, SIGNAL(proofEdited(Proof)), this, SLOT(proofEditedSlot(Proof)));
    connect(model, SIGNAL(proofDeleted(int)), this, SLOT(proofDeletedSlot(int)));
}
Example #20
0
void MainWindow::createComponents()
{
    QGridLayout *mLayout = new QGridLayout();

    QLabel *fileLabel = new QLabel(tr("File:"));
    fileText = new QLineEdit();
    fileText->setReadOnly(true);

    mLayout->addWidget(fileLabel, 0, 0, 1, 1);
    mLayout->addWidget(fileText, 0, 1, 1, 4);

    QLabel *typeLabel = new QLabel(tr("Algorithm Type:"));
    typeLabel->setScaledContents(true);
    typeCombo = new QComboBox();
    QStringList algorithms;
    algorithms << "md5" << "sha1" << "sha224" << "sha256" << "sha384" << "sha512";
    typeCombo->addItems(algorithms);

    mLayout->addWidget(typeLabel, 1, 0, 1, 1);
    mLayout->addWidget(typeCombo, 1, 1, 1, 4);

    QLabel *resultLabel = new QLabel(tr("Result:"));
    resultLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
    resultText = new QTextEdit();
    resultText->setReadOnly(true);
    resultText->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);

    mLayout->addWidget(resultLabel, 2, 0, 1, 1);
    mLayout->addWidget(resultText, 2, 1, 1, 4);

    QLabel *compareWithLabel = new QLabel(tr("Compare with:"));
    compareLabel = new QLabel();
    compareText = new QLineEdit();
    compareText->setObjectName("compareText");
    comparePixmap.load("icons/warning.png"); //&icon("warning").pixmap(24, 24);
    compareLabel->setPixmap(comparePixmap);

    mLayout->addWidget(compareWithLabel, 3, 0);
    mLayout->addWidget(compareText, 3, 1);
    mLayout->addWidget(compareLabel, 3, 2, 1, 4);

    showDetails = new QPushButton(icon("down"), "");
    showDetails->hide();
    showDetails->setObjectName("showDetails");
    hideDetails = new QPushButton(icon("up"), "");
    hideDetails->setObjectName("hideDetails");
    hideDetails->hide();
    progressBar = new QProgressBar();
    progressBar->hide();

    QHBoxLayout *progressLayout = new QHBoxLayout();
    progressLayout->addWidget(showDetails);
    progressLayout->addWidget(hideDetails);
    progressLayout->addWidget(progressBar);

    mLayout->addLayout(progressLayout, 4, 0, 1, 4);

    centralSplitter = new QSplitter(Qt::Vertical);

    QWidget *componentWidget = new QWidget();
    componentWidget->setLayout(mLayout);
    detailsTable = new DetailsTable();
    centralSplitter->addWidget(componentWidget);
    centralSplitter->addWidget(detailsTable);
    detailsTable->hide();

    setCentralWidget(centralSplitter);
}
Example #21
0
void BehaviorConfig_Shorten::slotConfigureClicked()
{
    qCDebug(CHOQOK);
    KPluginInfo pluginInfo = availablePlugins.value(shortenPlugins->itemData(shortenPlugins->currentIndex()).toString());
    qCDebug(CHOQOK) << pluginInfo.name() << pluginInfo.kcmServices().count();

    QPointer<QDialog> configDialog = new QDialog(this);
    configDialog->setWindowTitle(pluginInfo.name());
    // The number of KCModuleProxies in use determines whether to use a tabwidget
    QTabWidget *newTabWidget = 0;
    // Widget to use for the setting dialog's main widget,
    // either a QTabWidget or a KCModuleProxy
    QWidget *mainWidget = 0;
    // Widget to use as the KCModuleProxy's parent.
    // The first proxy is owned by the dialog itself
    QWidget *moduleProxyParentWidget = configDialog;

    for (const KService::Ptr &servicePtr: pluginInfo.kcmServices()) {
        if (!servicePtr->noDisplay()) {
            KCModuleInfo moduleInfo(servicePtr);
            KCModuleProxy *currentModuleProxy = new KCModuleProxy(moduleInfo, moduleProxyParentWidget);
            if (currentModuleProxy->realModule()) {
                moduleProxyList << currentModuleProxy;
                if (mainWidget && !newTabWidget) {
                    // we already created one KCModuleProxy, so we need a tab widget.
                    // Move the first proxy into the tab widget and ensure this and subsequent
                    // proxies are in the tab widget
                    newTabWidget = new QTabWidget(configDialog);
                    moduleProxyParentWidget = newTabWidget;
                    mainWidget->setParent(newTabWidget);
                    KCModuleProxy *moduleProxy = qobject_cast<KCModuleProxy *>(mainWidget);
                    if (moduleProxy) {
                        newTabWidget->addTab(mainWidget, moduleProxy->moduleInfo().moduleName());
                        mainWidget = newTabWidget;
                    } else {
                        delete newTabWidget;
                        newTabWidget = 0;
                        moduleProxyParentWidget = configDialog;
                        mainWidget->setParent(0);
                    }
                }

                if (newTabWidget) {
                    newTabWidget->addTab(currentModuleProxy, servicePtr->name());
                } else {
                    mainWidget = currentModuleProxy;
                }
            } else {
                delete currentModuleProxy;
            }
        }
    }

    // it could happen that we had services to show, but none of them were real modules.
    if (moduleProxyList.count()) {
        QWidget *showWidget = new QWidget(configDialog);
        QVBoxLayout *layout = new QVBoxLayout;
        showWidget->setLayout(layout);
        layout->addWidget(mainWidget);
        layout->insertSpacing(-1, QApplication::style()->pixelMetric(QStyle::PM_DialogButtonsSeparator));

        QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
        QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
        okButton->setDefault(true);
        okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
        connect(buttonBox, &QDialogButtonBox::accepted, configDialog.data(), &QDialog::accept);
        connect(buttonBox, &QDialogButtonBox::rejected, configDialog.data(), &QDialog::reject);
        layout->addWidget(buttonBox);
        showWidget->adjustSize();

//         connect(&configDialog, SIGNAL(defaultClicked()), this, SLOT(slotDefaultClicked()));

        if (configDialog->exec() == QDialog::Accepted) {
            for (KCModuleProxy *moduleProxy: moduleProxyList) {
                QStringList parentComponents = moduleProxy->moduleInfo().service()->property(QLatin1String("X-KDE-ParentComponents")).toStringList();
                moduleProxy->save();
            }
        } else {
            for (KCModuleProxy *moduleProxy: moduleProxyList) {
                moduleProxy->load();
            }
        }

        qDeleteAll(moduleProxyList);
        moduleProxyList.clear();
    }
}
Example #22
0
//---------------------------------------------------------------------------
// setupControls
//---------------------------------------------------------------------------
void WndConfig::setupControls (void)
{
  AppSettings& settings = *App::instance()->settings();
  QHBoxLayout* pRootLayout = new QHBoxLayout;
  QVBoxLayout* pLeftLayout = new QVBoxLayout;

  // options
  {
    QVBoxLayout* pVBox;
    uint uiConfiguredLogStep   = settings.getLogStep();
    uint auiProposedLogSteps[] = { 1, 2, 3, 4, 5, 10, 20, 30, 60, 120, 180, 240, 300, 600, 1200, 1800, 3600, 7200, 10800 };
    int  iDefaultLogStepIdx    = 4; // 5 seconds

    pVBox = new QVBoxLayout;
    pVBox->setSpacing(1);

    m_pCboLogStep = new QMaemoComboBox(tr("Log step"), this);
    m_pCboLogStep->setValueLayout(QMaemo5ValueButton::ValueBesideText);
    m_pCboLogStep->setTextAlignment(Qt::AlignLeft);

    for (int i = 0; i < sizeof(auiProposedLogSteps)/sizeof(auiProposedLogSteps[0]); ++i)
    {
      if (auiProposedLogSteps[i] >= AppSettings::logStepBounds().first ||
          auiProposedLogSteps[i] <= AppSettings::logStepBounds().second)
      {
        QString strItem;
        uint    uiBestAllowedFixStep = Location::selectBestAllowedFixStep(auiProposedLogSteps[i]);

        if (auiProposedLogSteps[i] < 60)
        {
          strItem.sprintf(
            "%u second%s (refresh : %us)",
            auiProposedLogSteps[i],
            (auiProposedLogSteps[i] == 1) ? "" : "s",
            uiBestAllowedFixStep);
        }
        else if (auiProposedLogSteps[i] < 3600)
        {
          uint uiMinutes = auiProposedLogSteps[i] / 60;

          strItem.sprintf(
            "%u minute%s (refresh : %us)",
            uiMinutes,
            (uiMinutes == 1) ? "" : "s",
            uiBestAllowedFixStep);
        }
        else
        {
          uint uiHours = auiProposedLogSteps[i] / 3600;

          strItem.sprintf(
            "%u hour%s (refresh : %us)",
            uiHours,
            (uiHours == 1) ? "" : "s",
            uiBestAllowedFixStep);
        }

        m_pCboLogStep->addItem(strItem, QVariant(auiProposedLogSteps[i]));
        if (auiProposedLogSteps[i] == uiConfiguredLogStep)
          iDefaultLogStepIdx = i;
      }
    }
    m_pCboLogStep->setCurrentIndex(iDefaultLogStepIdx);

    m_pChkGpsAssisted = new QCheckBox(tr("Assisted GPS"));
    m_pChkGpsAssisted->setCheckState(settings.getGpsAssisted() ? Qt::Checked : Qt::Unchecked);

    m_pChkGpsAlwaysConnected = new QCheckBox(tr("GPS always connected"));
    m_pChkGpsAlwaysConnected->setCheckState(settings.getGpsAlwaysConnected() ? Qt::Checked : Qt::Unchecked);

    m_pChkAlwaysCreateNewFile = new QCheckBox(tr("Always create new file (old behavior)"));
    m_pChkAlwaysCreateNewFile->setCheckState(settings.getAlwaysCreateNewFile() ? Qt::Checked : Qt::Unchecked);

    m_pChkAskPointName = new QCheckBox(tr("Ask for point name before snap"));
    m_pChkAskPointName->setCheckState(settings.getAskPointName() ? Qt::Checked : Qt::Unchecked);

    m_pChkAskPauseName = new QCheckBox(tr("Ask for a name when pausing"));
    m_pChkAskPauseName->setCheckState(settings.getAskPauseName() ? Qt::Checked : Qt::Unchecked);

    m_pCboUnitSystem = new QMaemoComboBox(tr("Unit system"), this);
    m_pCboUnitSystem->setValueLayout(QMaemo5ValueButton::ValueBesideText);
    m_pCboUnitSystem->addItem(AppSettings::unitSystemToName(UNITSYSTEM_METRIC),    QVariant(UNITSYSTEM_METRIC));
    m_pCboUnitSystem->addItem(AppSettings::unitSystemToName(UNITSYSTEM_IMPERIAL),  QVariant(UNITSYSTEM_IMPERIAL));
    m_pCboUnitSystem->setCurrentIndex(settings.getUnitSystem());

    m_pCboHorizSpeedUnit = new QMaemoComboBox(tr("Horizontal speed unit"), this);
    m_pCboHorizSpeedUnit->setValueLayout(QMaemo5ValueButton::ValueBesideText);
    m_pCboHorizSpeedUnit->addItem(AppSettings::horizSpeedUnitToName(HORIZSPEEDUNIT_KMH),   QVariant(HORIZSPEEDUNIT_KMH));
    m_pCboHorizSpeedUnit->addItem(AppSettings::horizSpeedUnitToName(HORIZSPEEDUNIT_MPH),   QVariant(HORIZSPEEDUNIT_MPH));
    m_pCboHorizSpeedUnit->addItem(AppSettings::horizSpeedUnitToName(HORIZSPEEDUNIT_MS),    QVariant(HORIZSPEEDUNIT_MS));
    m_pCboHorizSpeedUnit->addItem(AppSettings::horizSpeedUnitToName(HORIZSPEEDUNIT_KNOTS), QVariant(HORIZSPEEDUNIT_KNOTS));
    m_pCboHorizSpeedUnit->setCurrentIndex(settings.getHorizSpeedUnit());

    m_pChkPreventBlankScreen = new QCheckBox(tr("Prevent screen blanking"));
    m_pChkPreventBlankScreen->setCheckState(settings.getPreventBlankScreen() ? Qt::Checked : Qt::Unchecked);

    pVBox->addWidget(m_pCboLogStep);
    pVBox->addWidget(m_pChkGpsAssisted);
    pVBox->addWidget(m_pChkGpsAlwaysConnected);
    pVBox->addWidget(m_pChkAlwaysCreateNewFile);
    pVBox->addWidget(m_pChkAskPointName);
    pVBox->addWidget(m_pChkAskPauseName);
    pVBox->addWidget(m_pCboUnitSystem);
    pVBox->addWidget(m_pCboHorizSpeedUnit);
    pVBox->addWidget(m_pChkPreventBlankScreen);
    pLeftLayout->addLayout(pVBox);
  }

  // main layout setup
  {
    QScrollArea* pScrollArea = new QScrollArea;
    QWidget*     pScrollWidget = new QWidget;
    QPushButton* pBtnDone = new QPushButton(tr("Done"));

    this->connect(pBtnDone, SIGNAL(clicked()), SLOT(onClickedDone()));

    pLeftLayout->setSpacing(0);
    pScrollWidget->setLayout(pLeftLayout);

    pScrollArea->setWidgetResizable(true);
    pScrollArea->setWidget(pScrollWidget);
    pScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    pScrollArea->setProperty("FingerScrollable", true);

    pRootLayout->setSpacing(1);
    pRootLayout->addWidget(pScrollArea);
    pRootLayout->addWidget(pBtnDone, 0, Qt::AlignBottom);
  }

  // apply layout
  this->setLayout(pRootLayout);
}
Example #23
0
MainWindow::MainWindow(QWidget *parent)
  : QMainWindow(parent), audio(NULL)
{
  /* Since the ninjam callbacks do not pass a void* opaque argument we rely on
   * a global variable.
   */
  if (MainWindow::instance) {
    fprintf(stderr, "MainWindow can only be instantiated once!\n");
    abort();
  }
  MainWindow::instance = this;

  JNL::open_socketlib();

  client.config_savelocalaudio = 0;
  client.LicenseAgreementCallback = LicenseCallbackTrampoline;
  client.ChatMessage_Callback = ChatMessageCallbackTrampoline;
  client.SetLocalChannelInfo(0, "channel0", true, 0, false, 0, true, true);
  client.SetLocalChannelMonitoring(0, false, 0.0f, false, 0.0f, false, false, false, false);

  connectAction = new QAction(tr("&Connect..."), this);
  connect(connectAction, SIGNAL(triggered()), this, SLOT(ShowConnectDialog()));

  disconnectAction = new QAction(tr("&Disconnect"), this);
  disconnectAction->setEnabled(false);
  connect(disconnectAction, SIGNAL(triggered()), this, SLOT(Disconnect()));

  audioConfigAction = new QAction(tr("Configure &audio..."), this);
  connect(audioConfigAction, SIGNAL(triggered()), this, SLOT(ShowAudioConfigDialog()));

  QAction *exitAction = new QAction(tr("E&xit"), this);
  exitAction->setShortcuts(QKeySequence::Quit);
  connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));

  QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
  fileMenu->addAction(connectAction);
  fileMenu->addAction(disconnectAction);
  fileMenu->addAction(audioConfigAction);
  fileMenu->addAction(exitAction);

  QAction *aboutAction = new QAction(tr("&About..."), this);
  connect(aboutAction, SIGNAL(triggered()), this, SLOT(ShowAboutDialog()));

  QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
  helpMenu->addAction(aboutAction);

  setupStatusBar();

  setWindowTitle(tr("Wahjam"));

  chatOutput = new QTextEdit(this);
  chatOutput->setReadOnly(true);

  chatInput = new QLineEdit(this);
  chatInput->connect(chatInput, SIGNAL(returnPressed()),
                     this, SLOT(ChatInputReturnPressed()));

  channelTree = new ChannelTreeWidget(this);
  setupChannelTree();
  connect(channelTree, SIGNAL(MetronomeMuteChanged(bool)),
          this, SLOT(MetronomeMuteChanged(bool)));
  connect(channelTree, SIGNAL(MetronomeBoostChanged(bool)),
          this, SLOT(MetronomeBoostChanged(bool)));
  connect(channelTree, SIGNAL(LocalChannelMuteChanged(int, bool)),
          this, SLOT(LocalChannelMuteChanged(int, bool)));
  connect(channelTree, SIGNAL(LocalChannelBoostChanged(int, bool)),
          this, SLOT(LocalChannelBoostChanged(int, bool)));
  connect(channelTree, SIGNAL(LocalChannelBroadcastChanged(int, bool)),
          this, SLOT(LocalChannelBroadcastChanged(int, bool)));
  connect(channelTree, SIGNAL(RemoteChannelMuteChanged(int, int, bool)),
          this, SLOT(RemoteChannelMuteChanged(int, int, bool)));

  metronomeBar = new MetronomeBar(this);
  connect(this, SIGNAL(Disconnected()),
          metronomeBar, SLOT(reset()));

  QSplitter *splitter = new QSplitter(this);
  QWidget *content = new QWidget;
  QVBoxLayout *layout = new QVBoxLayout;

  layout->addWidget(chatOutput);
  layout->addWidget(chatInput);
  layout->addWidget(metronomeBar);
  content->setLayout(layout);
  content->setTabOrder(chatInput, chatOutput);

  splitter->addWidget(channelTree);
  splitter->addWidget(content);
  splitter->setOrientation(Qt::Vertical);

  setCentralWidget(splitter);

  BeatsPerIntervalChanged(0);
  BeatsPerMinuteChanged(0);

  runThread = new ClientRunThread(&clientMutex, &client);

  /* Hook up an inter-thread signal for the license agreement dialog */
  connect(runThread, SIGNAL(licenseCallback(const char *, bool *)),
          this, SLOT(LicenseCallback(const char *, bool *)),
          Qt::BlockingQueuedConnection);

  /* Hook up an inter-thread signal for the chat message callback */
  connect(runThread, SIGNAL(chatMessageCallback(char **, int)),
          this, SLOT(ChatMessageCallback(char **, int)),
          Qt::BlockingQueuedConnection);

  /* No need to block for the remote user info callback */
  connect(runThread, SIGNAL(userInfoChanged()),
          this, SLOT(UserInfoChanged()));

  /* Hook up an inter-thread signal for client status changes */
  connect(runThread, SIGNAL(statusChanged(int)),
          this, SLOT(ClientStatusChanged(int)));

  /* Hook up inter-thread signals for bpm/bpi changes */
  connect(runThread, SIGNAL(beatsPerMinuteChanged(int)),
          this, SLOT(BeatsPerMinuteChanged(int)));
  connect(runThread, SIGNAL(beatsPerIntervalChanged(int)),
          this, SLOT(BeatsPerIntervalChanged(int)));

  /* Hook up inter-thread signals for beat and interval changes */
  connect(runThread, SIGNAL(beatsPerIntervalChanged(int)),
          metronomeBar, SLOT(setBeatsPerInterval(int)));
  connect(runThread, SIGNAL(currentBeatChanged(int)),
          metronomeBar, SLOT(setCurrentBeat(int)));

  runThread->start();
}
MLMakeBatchInspector::MLMakeBatchInspector(QWidget *parent)
  : AlgorithmInspector(parent)
{
  _type = AlgorithmManager::MLMakeBatch;

  // input
  QTabWidget *tabInput = new QTabWidget(this);
  _listImagery = new SourceList(
              ContentNode::LayerImagery, this);
  _listLabel = new SourceList(
              ContentNode::LayerLabelmap | ContentNode::LayerShape, this);
  _listROI = new SourceList(
              ContentNode::LayerShape, this);
  tabInput->addTab(_listImagery, "Imagery");
  tabInput->addTab(_listLabel, "Label");
  tabInput->addTab(_listROI, "ROI");
  GVBoxLayout *layInput = new GVBoxLayout;
  layInput->setContentsMargins(15, 0, 4, 4);
  layInput->addWidget(tabInput);
  ToggleGroup *groupInput = new ToggleGroup(this);
  groupInput->setTitle("Input");
  groupInput->addLayout(layInput);

  // params
  _valueBackground = new QSpinBox(this);
  _valueBackground->setMinimum(0);
  _valueBackground->setMaximum(255);
  _valueBackground->setValue(255);
  _valueBackground->setKeyboardTracking(false);
  _valueScale = new QSpinBox(this);
  _valueScale->setMinimum(1);
  _valueScale->setMaximum(4096);
  _valueScale->setValue(64);
  _valueScale->setKeyboardTracking(false);
  connect(_valueScale, SIGNAL(valueChanged(int)), this, SLOT(PreviewFrameScale(int)));
  GParamLayout *layParams2 = new GParamLayout;
  layParams2->setSpacing(_config_ui().INSPECTORVIEW_PARAM_SPACING);
  layParams2->setContentsMargins(
              _config_ui().INSPECTORVIEW_PARAM_MARGIN_LEFT,
              0,
              _config_ui().INSPECTORVIEW_PARAM_MARGIN_RIGHT,
              _config_ui().INSPECTORVIEW_PARAM_MARGIN_BOTTOM);
  layParams2->addParam(new TextLabel("Background Label"), _valueBackground, Qt::AlignRight);
  layParams2->addParam(new TextLabel("Scale"), _valueScale, Qt::AlignRight);
  ToggleGroup *groupParams = new ToggleGroup(this);
  groupParams->setTitle("Params");
  groupParams->addLayout(layParams2);

  // output
  _valueDBName = new FileEdit(this);
  connect(_valueDBName, SIGNAL(open()), this, SLOT(SetDBName()));
  GParamLayout *layOutput = new GParamLayout;
  layOutput->setSpacing(_config_ui().INSPECTORVIEW_PARAM_SPACING);
  layOutput->setContentsMargins(
              _config_ui().INSPECTORVIEW_PARAM_MARGIN_LEFT,
              _config_ui().INSPECTORVIEW_PARAM_MARGIN_TOP,
              _config_ui().INSPECTORVIEW_PARAM_MARGIN_RIGHT,
              _config_ui().INSPECTORVIEW_PARAM_MARGIN_BOTTOM);
  layOutput->addParam(new TextLabel("Output Dir"), _valueDBName);
  ToggleGroup *groupOutput = new ToggleGroup(this);
  groupOutput->setTitle("Output");
  groupOutput->addLayout(layOutput);

  // overall
  GVBoxLayout *layout = new GVBoxLayout;
  layout->addWidget(groupInput, 0);
  layout->addWidget(groupParams, 0);
  layout->addWidget(groupOutput, 0);
  layout->addStretch(1);
  layout->setSpacing(10);
  QWidget *cont = new QWidget(this);
  cont->setLayout(layout);

  // settings
  _area->setWidget(cont);
  _textAlgorithm->setText("Batch Making");
}
TrayNotificationWidget::TrayNotificationWidget(QPixmap pixmapIcon, QString headerText, QString messageText) : QWidget(0)
{
    setWindowFlags(
        #ifdef Q_WS_MAC
            Qt::SubWindow | // This type flag is the second point
        #else
            Qt::Tool |
        #endif
            Qt::FramelessWindowHint |
            Qt::WindowSystemMenuHint |
            Qt::WindowStaysOnTopHint
        );
    setAttribute(Qt::WA_NoSystemBackground, true);
    // set the parent widget's background to translucent
    setAttribute(Qt::WA_TranslucentBackground, true);

    //setAttribute(Qt::WA_ShowWithoutActivating, true);
    setFixedWidth(310);
    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
    // create a display widget for displaying child widgets
    QWidget* displayWidget = new QWidget;
    displayWidget->setStyleSheet(".QWidget { background-color: rgba(0, 0, 0, 75%); border-width: 1px; border-style: solid; border-radius: 10px; border-color: #555555; } .QWidget:hover { background-color: rgba(68, 68, 68, 75%); border-width: 2px; border-style: solid; border-radius: 10px; border-color: #ffffff; }");
    displayWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);

    QLabel* icon = new QLabel;
    icon->setPixmap(pixmapIcon);
    icon->setMaximumSize(32, 32);
    QLabel* header = new QLabel;
    header->setStyleSheet("QLabel { color: #ffffff; font-weight: bold; font-size: 12px; }");
    header->setText(headerText);
    header->setFixedWidth(200);
    header->setWordWrap(true);
    header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QTextEdit *message = new QTextEdit;
    message->setReadOnly(true);
    message->setFrameStyle(QFrame::NoFrame);
    message->setLineWrapMode(QTextEdit::WidgetWidth);
    message->setWordWrapMode(QTextOption::WrapAnywhere);
    QPalette pal = palette();
    pal.setColor(QPalette::Base, Qt::transparent);
    message->setPalette(pal);
    message->setStyleSheet("QTextEdit { color: #ffffff; font-size: 10px; }");
    message->setText(messageText);
    message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QVBoxLayout* vl = new QVBoxLayout;
    vl->addWidget(header);
    vl->addWidget(message);
    QHBoxLayout* displayMainLayout = new QHBoxLayout;
    displayMainLayout->addWidget(icon);
    displayMainLayout->addLayout(vl);

    displayWidget->setLayout(displayMainLayout);
    QHBoxLayout* containerLayout = new QHBoxLayout;
    containerLayout->addWidget(displayWidget);
    setLayout(containerLayout);
    show();
    resize(this->size().width(), (int)((message->document()->size().height() + header->height()) +70));

    timeout = new QTimer(this);
    connect(timeout, SIGNAL(timeout()), this, SLOT(fadeOut()));
    timeout->start(3000);
}
QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *editor, QgsVectorLayer *vl, int idx, const QVariant &value )
{
  if ( !vl )
    return 0;

  QWidget *myWidget = 0;
  QgsVectorLayer::EditType editType = vl->editType( idx );
  const QgsField &field = vl->pendingFields()[idx];
  QVariant::Type myFieldType = field.type();

  switch ( editType )
  {
    case QgsVectorLayer::UniqueValues:
    {
      QList<QVariant> values;
      vl->dataProvider()->uniqueValues( idx, values );

      QComboBox *cb = comboBox( editor, parent );
      if ( cb )
      {
        cb->setEditable( false );

        for ( QList<QVariant>::iterator it = values.begin(); it != values.end(); it++ )
          cb->addItem( it->toString(), it->toString() );

        myWidget = cb;
      }

    }
    break;

    case QgsVectorLayer::Enumeration:
    {
      QStringList enumValues;
      vl->dataProvider()->enumValues( idx, enumValues );

      QComboBox *cb = comboBox( editor, parent );
      if ( cb )
      {
        QStringList::const_iterator s_it = enumValues.constBegin();
        for ( ; s_it != enumValues.constEnd(); ++s_it )
        {
          cb->addItem( *s_it, *s_it );
        }

        myWidget = cb;
      }
    }
    break;

    case QgsVectorLayer::ValueMap:
    {
      const QMap<QString, QVariant> &map = vl->valueMap( idx );

      QComboBox *cb = comboBox( editor, parent );
      if ( cb )
      {
        for ( QMap<QString, QVariant>::const_iterator it = map.begin(); it != map.end(); it++ )
        {
          cb->addItem( it.key(), it.value() );
        }

        myWidget = cb;
      }
    }
    break;

    case QgsVectorLayer::ValueRelation:
    {
      QSettings settings;
      QString nullValue = settings.value( "qgis/nullValue", "NULL" ).toString();

      const QgsVectorLayer::ValueRelationData &data = vl->valueRelation( idx );

      QgsVectorLayer *layer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( data.mLayer ) );
      QMap< QString, QString > map;

      int fi = -1;
      if ( layer )
      {
        int ki = layer->fieldNameIndex( data.mOrderByValue ? data.mValue : data.mKey );
        int vi = layer->fieldNameIndex( data.mOrderByValue ? data.mKey : data.mValue );

        if ( !data.mFilterAttributeColumn.isNull() )
          fi = layer->fieldNameIndex( data.mFilterAttributeColumn );

        if ( data.mAllowNull )
          map.insert( nullValue, tr( "(no selection)" ) );

        if ( ki >= 0 && vi >= 0 )
        {
          QgsAttributeList attributes;
          attributes << ki;
          attributes << vi;
          if ( fi >= 0 )
            attributes << fi;
          layer->select( attributes, QgsRectangle(), false );
          QgsFeature f;
          while ( layer->nextFeature( f ) )
          {
            if ( fi >= 0 && f.attributeMap()[ fi ].toString() != data.mFilterAttributeValue )
              continue;

            map.insert( f.attributeMap()[ ki ].toString(), f.attributeMap()[ vi ].toString() );
          }
        }
      }

      if ( !data.mAllowMulti )
      {
        QComboBox *cb = comboBox( editor, parent );
        if ( cb )
        {
          for ( QMap< QString, QString >::const_iterator it = map.begin(); it != map.end(); it++ )
          {
            if ( data.mOrderByValue )
              cb->addItem( it.key(), it.value() );
            else
              cb->addItem( it.value(), it.key() );
          }

          myWidget = cb;
        }
      }
      else
      {
        QListWidget *lw = listWidget( editor, parent );
        if ( lw )
        {
          QStringList checkList = value.toString().remove( QChar( '{' ) ).remove( QChar( '}' ) ).split( "," );

          for ( QMap< QString, QString >::const_iterator it = map.begin(); it != map.end(); it++ )
          {
            QListWidgetItem *item;
            if ( data.mOrderByValue )
            {
              item = new QListWidgetItem( it.key() );
              item->setData( Qt::UserRole, it.value() );
              item->setCheckState( checkList.contains( it.value() ) ? Qt::Checked : Qt::Unchecked );
            }
            else
            {
              item = new QListWidgetItem( it.value() );
              item->setData( Qt::UserRole, it.key() );
              item->setCheckState( checkList.contains( it.key() ) ? Qt::Checked : Qt::Unchecked );
            }
            lw->addItem( item );
          }

          myWidget = lw;
        }
      }
    }
    break;

    case QgsVectorLayer::Classification:
    {
      QMap<QString, QString> classes;

      const QgsUniqueValueRenderer *uvr = dynamic_cast<const QgsUniqueValueRenderer *>( vl->renderer() );
      if ( uvr )
      {
        const QList<QgsSymbol *> symbols = uvr->symbols();

        for ( int i = 0; i < symbols.size(); i++ )
        {
          QString label = symbols[i]->label();
          QString name = symbols[i]->lowerValue();

          if ( label == "" )
            label = name;

          classes.insert( name, label );
        }
      }

      const QgsCategorizedSymbolRendererV2 *csr = dynamic_cast<const QgsCategorizedSymbolRendererV2 *>( vl->rendererV2() );
      if ( csr )
      {
        const QgsCategoryList &categories = (( QgsCategorizedSymbolRendererV2 * )csr )->categories(); // FIXME: QgsCategorizedSymbolRendererV2::categories() should be const
        for ( int i = 0; i < categories.size(); i++ )
        {
          QString label = categories[i].label();
          QString value = categories[i].value().toString();
          if ( label.isEmpty() )
            label = value;
          classes.insert( value, label );
        }
      }

      QComboBox *cb = comboBox( editor, parent );
      if ( cb )
      {
        for ( QMap<QString, QString>::const_iterator it = classes.begin(); it != classes.end(); it++ )
        {
          cb->addItem( it.value(), it.key() );
        }

        myWidget = cb;
      }
    }
    break;

    case QgsVectorLayer::DialRange:
    case QgsVectorLayer::SliderRange:
    case QgsVectorLayer::EditRange:
    {
      if ( myFieldType == QVariant::Int )
      {
        int min = vl->range( idx ).mMin.toInt();
        int max = vl->range( idx ).mMax.toInt();
        int step = vl->range( idx ).mStep.toInt();

        if ( editType == QgsVectorLayer::EditRange )
        {
          QSpinBox *sb = 0;

          if ( editor )
            sb = qobject_cast<QSpinBox *>( editor );
          else
            sb = new QSpinBox( parent );

          if ( sb )
          {
            sb->setRange( min, max );
            sb->setSingleStep( step );

            myWidget = sb;
          }
        }
        else
        {
          QAbstractSlider *sl = 0;

          if ( editor )
          {
            sl = qobject_cast<QAbstractSlider*>( editor );
          }
          else if ( editType == QgsVectorLayer::DialRange )
          {
            sl = new QDial( parent );
          }
          else
          {
            sl = new QSlider( Qt::Horizontal, parent );
          }

          if ( sl )
          {
            sl->setRange( min, max );
            sl->setSingleStep( step );

            myWidget = sl;
          }
        }
        break;
      }
      else if ( myFieldType == QVariant::Double )
      {
        QDoubleSpinBox *dsb = 0;
        if ( editor )
          dsb = qobject_cast<QDoubleSpinBox*>( editor );
        else
          dsb = new QDoubleSpinBox( parent );

        if ( dsb )
        {
          double min = vl->range( idx ).mMin.toDouble();
          double max = vl->range( idx ).mMax.toDouble();
          double step = vl->range( idx ).mStep.toDouble();

          dsb->setRange( min, max );
          dsb->setSingleStep( step );

          myWidget = dsb;
        }
        break;
      }
    }

    case QgsVectorLayer::CheckBox:
    {
      QCheckBox *cb = 0;
      if ( editor )
        cb = qobject_cast<QCheckBox*>( editor );
      else
        cb = new QCheckBox( parent );

      if ( cb )
      {
        myWidget = cb;
        break;
      }
    }

    // fall-through

    case QgsVectorLayer::LineEdit:
    case QgsVectorLayer::TextEdit:
    case QgsVectorLayer::UuidGenerator:
    case QgsVectorLayer::UniqueValuesEditable:
    case QgsVectorLayer::Immutable:
    {
      QLineEdit *le = 0;
      QTextEdit *te = 0;
      QPlainTextEdit *pte = 0;

      if ( editor )
      {
        le = qobject_cast<QLineEdit *>( editor );
        te = qobject_cast<QTextEdit *>( editor );
        pte = qobject_cast<QPlainTextEdit *>( editor );
      }
      else if ( editType == QgsVectorLayer::TextEdit )
      {
        pte = new QPlainTextEdit( parent );
      }
      else
      {
        le = new QLineEdit( parent );
      }

      if ( le )
      {

        if ( editType == QgsVectorLayer::UniqueValuesEditable )
        {
          QList<QVariant> values;
          vl->dataProvider()->uniqueValues( idx, values );

          QStringList svalues;
          for ( QList<QVariant>::const_iterator it = values.begin(); it != values.end(); it++ )
            svalues << it->toString();

          QCompleter *c = new QCompleter( svalues );
          c->setCompletionMode( QCompleter::PopupCompletion );
          le->setCompleter( c );
        }

        if ( editType == QgsVectorLayer::UuidGenerator )
        {
          le->setReadOnly( true );
        }

        le->setValidator( new QgsFieldValidator( le, field ) );
        myWidget = le;
      }

      if ( te )
      {
        te->setAcceptRichText( true );
        myWidget = te;
      }

      if ( pte )
      {
        myWidget = pte;
      }

      if ( myWidget )
      {
        myWidget->setDisabled( editType == QgsVectorLayer::Immutable );
      }
    }
    break;

    case QgsVectorLayer::Hidden:
      myWidget = 0;
      break;

    case QgsVectorLayer::FileName:
    case QgsVectorLayer::Calendar:
    {
      QPushButton *pb = 0;
      QLineEdit *le = qobject_cast<QLineEdit *>( editor );
      if ( le )
      {
        if ( le )
          myWidget = le;

        if ( editor->parent() )
        {
          pb = editor->parent()->findChild<QPushButton *>();
        }
      }
      else
      {
        le = new QLineEdit();

        pb = new QPushButton( tr( "..." ) );

        QHBoxLayout *hbl = new QHBoxLayout();
        hbl->addWidget( le );
        hbl->addWidget( pb );

        myWidget = new QWidget( parent );
        myWidget->setBackgroundRole( QPalette::Window );
        myWidget->setAutoFillBackground( true );
        myWidget->setLayout( hbl );
      }

      if ( pb )
      {
        if ( editType == QgsVectorLayer::FileName )
          connect( pb, SIGNAL( clicked() ), new QgsAttributeEditor( pb ), SLOT( selectFileName() ) );
        if ( editType == QgsVectorLayer::Calendar )
          connect( pb, SIGNAL( clicked() ), new QgsAttributeEditor( pb ), SLOT( selectDate() ) );
      }
    }
    break;
  }

  setValue( myWidget, vl, idx, value );

  return myWidget;
}
toBackup::toBackup(toTool* tool, QWidget *main, toConnection &connection)
        : toToolWidget(*tool, "backup.html", main, connection, "toBackup")
        , tool_(tool)
{
    QToolBar *toolbar = toAllocBar(this, tr("Backup Manager"));
    layout()->addWidget(toolbar);

    updateAct = new QAction(QPixmap(const_cast<const char**>(refresh_xpm)),
                            tr("Update"), this);
    updateAct->setShortcut(QKeySequence::Refresh);
    connect(updateAct, SIGNAL(triggered()), this, SLOT(refresh(void)));
    toolbar->addAction(updateAct);

    toolbar->addWidget(new toSpacer());

    new toChangeConnection(toolbar, TO_TOOLBAR_WIDGET_NAME);

    Tabs = new QTabWidget(this);
    layout()->addWidget(Tabs);

    QWidget *box = new QWidget(Tabs);
    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->setSpacing(0);
    vbox->setContentsMargins(0, 0, 0, 0);
    box->setLayout(vbox);

    vbox->addWidget(new QLabel(tr("Logswitches per day and hour"), box));
    LogSwitches = new toResultTableView(true, false, box);
    LogSwitches->setSQL(SQLLogSwitches);
    vbox->addWidget(LogSwitches);
    Tabs->addTab(box, tr("Redo Switches"));

    LogHistory = new toResultTableView(true, false, Tabs);
    LogHistory->setSQL(SQLLogHistory);
    Tabs->addTab(LogHistory, tr("Archived Logs"));

    box = new QWidget(Tabs);
    vbox = new QVBoxLayout;
    vbox->setSpacing(0);
    vbox->setContentsMargins(0, 0, 0, 0);
    box->setLayout(vbox);

    LastLabel = new QLabel(box);
    vbox->addWidget(LastLabel);
    LastBackup = new toResultTableView(true, false, box);
    vbox->addWidget(LastBackup);
    LastBackup->setSQL(SQLLastBackup);
    Tabs->addTab(box, tr("Last Backup"));

    CurrentBackup = new toResultTableView(true, false, Tabs);
    CurrentBackup->setSQL(SQLCurrentBackup);
    Tabs->addTab(CurrentBackup, tr("Backup Progress"));

    ToolMenu = NULL;
    connect(toMainWidget()->workspace(), SIGNAL(subWindowActivated(QMdiSubWindow *)),
            this, SLOT(windowActivated(QMdiSubWindow *)));

    refresh();

    setFocusProxy(Tabs);
}
MainWindow::MainWindow()
{
    if (QSound::isAvailable ())
        qDebug() << "Sound Facility is available.";
    else
        qDebug() << "Sound Facility is not available.";

    QTime time = QTime::currentTime();
    qsrand((uint)time.msec());

    operationChar = createRandomOperationChar();

    QFont fontMath("Arial", 60, QFont::Bold);
    QFont fontCheckButton("Arial", 30, QFont::Bold);

    leftTermLabel = new QLabel(QString::number(qrand() % MAX_OPERAND_VALUE));
    leftTermLabel->setFont(fontMath);
    operationLabel = new QLabel(operationChar);
    operationLabel->setFont(fontMath);
    rightTermLabel = new QLabel(QString::number(qrand() % MAX_OPERAND_VALUE));
    rightTermLabel->setFont(fontMath);
    equalsLabel = new QLabel("=");
    equalsLabel->setFont(fontMath);
    resultLineEdit = new QLineEdit;
    resultLineEdit->setFont(fontMath);
    connect(resultLineEdit, SIGNAL(returnPressed()), this, SLOT(handleCheckButtonPressed()));

    checkButton = new QPushButton(tr("Check my result!"));
    checkButton->setFont(fontCheckButton);
    connect(checkButton, SIGNAL(clicked()), this, SLOT(handleCheckButtonPressed()));

    resultLabel = new QLabel(tr("Press the check button to check your result..."));
    resultLabel->setFont(fontCheckButton);
    resultLabel->setAlignment(Qt::AlignCenter);

    QHBoxLayout *mathLayout = new QHBoxLayout;
    mathLayout->addWidget(leftTermLabel);
    mathLayout->addWidget(operationLabel);
    mathLayout->addWidget(rightTermLabel);
    mathLayout->addWidget(equalsLabel);
    mathLayout->addWidget(resultLineEdit);

    QVBoxLayout *totalLayout = new QVBoxLayout;
    totalLayout->addLayout(mathLayout);
    totalLayout->addWidget(checkButton);
    totalLayout->addWidget(resultLabel);

    QWidget* mainWidget = new QWidget();
    mainWidget->setLayout(totalLayout);

    setCentralWidget(mainWidget);
    setWindowTitle(tr("QSchoolIsCool: your personal school stuff trainer!"));

    createActions();
    createMenus();
    //createContextMenu();
    //createToolBars();
    //createStatusBar();

    //readSettings();

    //findDialog = 0;

    //setWindowIcon(QIcon(":/images/icon.png"));
    //setCurrentFile("");
}
Example #29
0
GameWindow::GameWindow(int sizeX, int sizeY, int minesNumber) :
    QMainWindow(),
    ui(new Ui::GameWindow)
{
    ui->setupUi(this);

    QPixmap background(":/resources/images/options_background.jpg");
        QPalette qPalette;
        qPalette.setBrush(this->backgroundRole(),QBrush(background));
        this->setPalette(qPalette);

    sizeOfFieldX = sizeX;
    sizeOfFieldY = sizeY;
    minesInTheField = minesNumber;

    core = new Field(sizeOfFieldX, sizeOfFieldY, minesInTheField);
    fieldLayout = new QGridLayout;

    backButton = new QPushButton("Back to menu");
    backButton->setStyleSheet(QPushButtonStyle);
    backButton->setFixedSize(175,50);

    refreshButton = new QPushButton("Refresh game");
    refreshButton->setStyleSheet(QPushButtonStyle);
    refreshButton->setFixedSize(175,50);

    QObject::connect(backButton, SIGNAL(clicked(bool)), this, SLOT(backToMenu()));
    QObject::connect(refreshButton, SIGNAL(clicked(bool)), this, SLOT(refreshGame()));

    mainFieldLayout = new QVBoxLayout;
    panelLayout = new QVBoxLayout;
    mainLayout = new QHBoxLayout;

    vector<QMyPushButton*> tmpVect;
    for (int i = 0; i < core->getSizeX(); i++)
    {
        for (int j = 0; j < core->getSizeY(); j++)
        {
            QMyPushButton* newButton;
            tmpVect.push_back(newButton);
        }
        buttons.push_back(tmpVect);
    }

    QLabel *fieldHeight = new QLabel("Height of field:   ");
    fieldHeight->setStyleSheet(QLabelStyle);
    QLabel *fieldLength = new QLabel("Length of field:   ");
    fieldLength->setStyleSheet(QLabelStyle);
    QLabel *allCells = new QLabel("Cells in the field:");
    allCells->setStyleSheet(QLabelStyle);
    QLabel *cellsLeft = new QLabel("Cells left:           ");
    cellsLeft->setStyleSheet(QLabelStyle);
    QLabel *minesLeft = new QLabel("Mines left:         ");
    minesLeft->setStyleSheet(QLabelStyle);
    QLabel *flagsLeft = new QLabel("You have flags:  ");
    flagsLeft->setStyleSheet(QLabelStyle);


    fieldHeightNumber = new QLabel(QString::number(core->getSizeX()));
        fieldHeightNumber->setStyleSheet(QLabelStyle);
    fieldLengthNumber = new QLabel(QString::number(core->getSizeY()));
        fieldLengthNumber->setStyleSheet(QLabelStyle);
    allCellsNumber = new QLabel(QString::number(core->getSizeX() * core->getSizeY()));
        allCellsNumber->setStyleSheet(QLabelStyle);
    cellsLeftNumber = new QLabel(QString::number(core->cellsLeft));
        cellsLeftNumber->setStyleSheet(QLabelStyle);
    minesLeftNumber = new QLabel(QString::number(core->minesLeft));
        minesLeftNumber->setStyleSheet(QLabelStyle);
    flagsLeftNumber = new QLabel(QString::number(core->flagsLeft));
        flagsLeftNumber->setStyleSheet(QLabelStyle);

    QHBoxLayout *panelHorizontal1 = new QHBoxLayout;
    panelHorizontal1->addWidget(fieldHeight);
    panelHorizontal1->addWidget(fieldHeightNumber);
    QHBoxLayout *panelHorizontal2 = new QHBoxLayout;
    panelHorizontal2->addWidget(fieldLength);
    panelHorizontal2->addWidget(fieldLengthNumber);
    QHBoxLayout *panelHorizontal3 = new QHBoxLayout;
    panelHorizontal3->addWidget(allCells);
    panelHorizontal3->addWidget(allCellsNumber);
    QHBoxLayout *panelHorizontal4 = new QHBoxLayout;
    panelHorizontal4->addWidget(cellsLeft);
    panelHorizontal4->addWidget(cellsLeftNumber);
    QHBoxLayout *panelHorizontal5 = new QHBoxLayout;
    panelHorizontal5->addWidget(minesLeft);
    panelHorizontal5->addWidget(minesLeftNumber);
    QHBoxLayout *panelHorizontal6 = new QHBoxLayout;
    panelHorizontal6->addWidget(flagsLeft);
    panelHorizontal6->addWidget(flagsLeftNumber);

    //timer = new QTimer;
    //timer->start(10000);

    panelLayout = new QVBoxLayout;
    mainPanelLayout = new QVBoxLayout;
    panelBox = new QGroupBox;

    panelLayout->addSpacing(5);
    panelLayout->addLayout(panelHorizontal1);
    panelLayout->addLayout(panelHorizontal2);
    panelLayout->addLayout(panelHorizontal3);
    panelLayout->addLayout(panelHorizontal4);
    panelLayout->addLayout(panelHorizontal5);
    panelLayout->addLayout(panelHorizontal6);
    panelBox->setLayout(panelLayout);

    mainPanelLayout->addWidget(panelBox);
    //mainPanelLayout->addWidget(timer);
    mainPanelLayout->addStretch(1);
    mainPanelLayout->addWidget(refreshButton);
    mainPanelLayout->addWidget(backButton);
    mainPanelLayout->setSpacing(20);




    for (int i = 0; i < core->getSizeX(); i++)
        for (int j = 0; j < core->getSizeY(); j++)
        {
            buttons[i][j] = new QMyPushButton;
            fieldButtonSize = new QSize(32,32);
            buttons[i][j]->setStyleSheet(QFieldButtonStyle);
            buttons[i][j]->setFixedSize(*fieldButtonSize);
            //buttons[i][j]->setText("Do it!");
            fieldLayout->addWidget(buttons[i][j], i, j, 1, 1);
            buttons[i][j]->setProperty("coordinates", i * 1000 + j);
            connect(buttons[i][j], SIGNAL(pressed()), this, SLOT(clickedLeft()));
            connect(buttons[i][j], SIGNAL(rClicked()), this, SLOT(setFlag()));
            //QMyPushButton *but = new QMyPushButton;
            //connect(but, SIGNAL())

        }
    //mainFieldLayout->addSpacing(15);
    fieldLayout->setSpacing(0);
    mainFieldLayout->addLayout(fieldLayout);

    //mainLayout->addSpacing(15);
    mainLayout->addLayout(mainFieldLayout);
    mainLayout->addSpacing(25);
    mainLayout->addLayout(mainPanelLayout);
    //mainLayout->addSpacing(15);

    QWidget *centralWidget = new QWidget;
    centralWidget->setLayout(mainLayout);
    this->setCentralWidget(centralWidget);
    this->setWindowTitle("Minesweeper TOP Game");
    this->setWindowIcon(QIcon(":/resources/images/icon.png"));

    connect(this, SIGNAL(allCellsOpen()), this, SLOT(winGame()));
    connect(this, SIGNAL(allah_BABAH()), this, SLOT(loseGame()));


}
Example #30
0
QWidget* NewDisplayManager::show(IPlugin::OutputConnectorList &outputConnectorList, QSharedPointer<QTime>& pT, QList< QAction* >& qListActions)
{
    QWidget* newDisp = new QWidget;
    QVBoxLayout* vboxLayout = new QVBoxLayout;
    QHBoxLayout* hboxLayout = new QHBoxLayout;

    qListActions.clear();

    foreach (QSharedPointer< PluginOutputConnector > pPluginOutputConnector, outputConnectorList)
    {
        if(pPluginOutputConnector.dynamicCast< PluginOutputData<NewRealTimeSampleArray> >())
        {
            QSharedPointer<NewRealTimeSampleArray>* pNewRealTimeSampleArray = &pPluginOutputConnector.dynamicCast< PluginOutputData<NewRealTimeSampleArray> >()->data();
            NewRealTimeSampleArrayWidget* rtsaWidget = new NewRealTimeSampleArrayWidget(*pNewRealTimeSampleArray, pT, newDisp);

            qListActions.append(rtsaWidget->getDisplayActions());

            connect(pPluginOutputConnector.data(), &PluginOutputConnector::notify,
                    rtsaWidget, &NewRealTimeSampleArrayWidget::update, Qt::BlockingQueuedConnection);

            vboxLayout->addWidget(rtsaWidget);
            rtsaWidget->init();
        }
        else if(pPluginOutputConnector.dynamicCast< PluginOutputData<NewRealTimeMultiSampleArray> >())
        {
            QSharedPointer<NewRealTimeMultiSampleArray>* pNewRealTimeMultiSampleArray = &pPluginOutputConnector.dynamicCast< PluginOutputData<NewRealTimeMultiSampleArray> >()->data();
            NewRealTimeMultiSampleArrayWidget* rtmsaWidget = new NewRealTimeMultiSampleArrayWidget(*pNewRealTimeMultiSampleArray, pT, newDisp);

            qListActions.append(rtmsaWidget->getDisplayActions());

            connect(pPluginOutputConnector.data(), &PluginOutputConnector::notify,
                    rtmsaWidget, &NewRealTimeMultiSampleArrayWidget::update, Qt::BlockingQueuedConnection);

            vboxLayout->addWidget(rtmsaWidget);
            rtmsaWidget->init();
        }
    #if defined(QT3D_LIBRARY_AVAILABLE)
        else if(pPluginOutputConnector.dynamicCast< PluginOutputData<RealTimeSourceEstimate> >())
        {
            QSharedPointer<RealTimeSourceEstimate>* pRealTimeSourceEstimate = &pPluginOutputConnector.dynamicCast< PluginOutputData<RealTimeSourceEstimate> >()->data();
            RealTimeSourceEstimateWidget* rtseWidget = new RealTimeSourceEstimateWidget(*pRealTimeSourceEstimate, newDisp);//new RealTimeSourceEstimateWidget(*pRealTimeSourceEstimate, pT, newDisp);

            qListActions.append(rtseWidget->getDisplayActions());

            connect(pPluginOutputConnector.data(), &PluginOutputConnector::notify,
                    rtseWidget, &RealTimeSourceEstimateWidget::update, Qt::BlockingQueuedConnection);

            vboxLayout->addWidget(rtseWidget);
            rtseWidget->init();
        }
    #endif
    }

//    // Add all widgets but NumericWidgets to layout and display them
//    foreach(MeasurementWidget* pMSRW, s_hashMeasurementWidgets.values())
//    {
//        if(dynamic_cast<NumericWidget*>(pMSRW))
//            continue;
//        vboxLayout->addWidget(pMSRW);
//        pMSRW->show();
//    }

//    foreach(NumericWidget* pNUMW, s_hashNumericWidgets.values())
//    {
//        hboxLayout->addWidget(pNUMW);
//        pNUMW->show();
//    }

    vboxLayout->addLayout(hboxLayout);
    newDisp->setLayout(vboxLayout);

    return newDisp;
}