Ejemplo n.º 1
0
ImageExportDialog::ImageExportDialog(QWidget* parent, const char*name):
		QFileDialog(parent, name)
{
setCaption( tr( "QtiPlot - Choose a filename to save under" ) );

QStringList list=QImage::outputFormatList ();
list<<"EPS";
list<<"SVG";
list.sort();
		
QString filter, selectedFilter,aux;			
for (int i=0;i<(int)list.count();i++)
	{
	aux="*."+(list[i]).lower()+";;";
	filter+=aux;
	}
setFilters( filter );
setMode( QFileDialog::AnyFile );
	
boxOptions = new QCheckBox(this, "boxOptions" );
boxOptions->setText( tr("Show export &options") );
#ifdef Q_OS_WIN // Windows systems
	boxOptions->setChecked( true );			
#else
	boxOptions->setChecked( false );
#endif

addWidgets( 0, boxOptions, 0 );

connect(this, SIGNAL(filterSelected ( const QString & )), 
		this, SLOT(showOptionsBox ( const QString & )));
}
Ejemplo n.º 2
0
beaglemain::beaglemain(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::beaglemain)
{
    ui->setupUi(this);
    addWidgets();
    conSignals();
}
Ejemplo n.º 3
0
QWidget *QAcesSettingsDialog::createLayout(QWidget *parent, QSettings &settings)
{
    QVBoxLayout * acesLayout = new QVBoxLayout;

    acesChannelCheckBox->setText( CHANNEL_TEXT );
    acesChannelCheckBox->setChecked( settings.value( ACES_CHANNEL_ENABLE_SETTING_PATH, DEFAULT_CHANNEL_ENABLE ).toBool() );

    acesChannelEdit->setText( settings.value( ACES_CHANNEL_SETTING_PATH, DEFAULT_ACES_CHANNEL_NAME ).toString() );
    acesChannelEdit->setEnabled( acesChannelCheckBox->isChecked() );

    QObject::connect( acesChannelCheckBox, SIGNAL( clicked( bool ) ), acesChannelEdit, SLOT( setEnabled( bool ) ) );

    addWidgets( acesLayout, { acesChannelCheckBox, acesChannelEdit } );

    //acesOriginalColorsCheckBox->setText( tr( "Original Colors" ) );
    //acesOriginalColorsCheckBox->setChecked( settings.value( ACES_ORIGINAL_COLORS_SETTING_PATH, false ).toBool() );

    //acesLayout->addWidget( acesOriginalColorsCheckBox );

    acesAliasesEdit->setText( settings.value( ACES_ALIASES_SETTING_PATH, BLANK_STRING ).toString() );

    addWidgets( acesLayout, { new QLabel( ALIASES_TEXT, this ), acesAliasesEdit } );

    acesSupportersListEdit->setText( settings.value( ACES_SUPPORTERS_LIST_SETTING_PATH, BLANK_STRING ).toString() );

    addWidgets( acesLayout, { new QLabel( SUPPORTERS_TEXT, this ), acesSupportersListEdit } );

    acesBlackListEdit->setText( settings.value( ACES_BLACK_LIST_SETTING_PATH, BLANK_STRING ).toString() );

    addWidgets( acesLayout, { new QLabel( BLACKLIST_TEXT, this ), acesBlackListEdit } );

    acesRemoveBlackListUsersCheckBox->setText( REMOVE_BLACKLIST_USERS_MESSAGES );
    acesRemoveBlackListUsersCheckBox->setChecked( settings.value( ACES_REMOVE_BLACK_LIST_USERS_SETTING_PATH, false ).toBool() );

    acesLayout->addWidget( acesRemoveBlackListUsersCheckBox );

    acesLayout->addStretch( 1 );

    QGroupBox * acesGroup = new QGroupBox( this );
    acesGroup->setLayout( acesLayout );

    return acesGroup;
}
Ejemplo n.º 4
0
MainWindow::MainWindow(mbp::PatcherConfig *pc, QWidget *parent)
    : QWidget(parent), d_ptr(new MainWindowPrivate())
{
    Q_D(MainWindow);

    setWindowIcon(QIcon(QStringLiteral(":/icons/icon.png")));
    setWindowTitle(qApp->applicationName());

    // If we're passed an argument, switch to automatic mode
    if (qApp->arguments().size() > 2) {
        d->autoMode = true;
        d->fileName = qApp->arguments().at(1);
    } else {
        d->autoMode = false;
        d->fileName.clear();
    }

    d->pc = pc;

    addWidgets();
    setWidgetActions();
    populateDevices();
    populateInstallationLocations();
    updateWidgetsVisibility();

    QString lastDeviceId = d->settings.value(
            QStringLiteral("last_device"), QString()).toString();
    for (size_t i = 0; i < d->devices.size(); ++i) {
        if (strcmp(mb_device_id(d->devices[i].get()),
                   lastDeviceId.toUtf8().data()) == 0) {
            d->deviceSel->setCurrentIndex(i);
            break;
        }
    }

    // Create thread
    d->thread = new QThread(this);
    d->task = new PatcherTask();
    d->task->moveToThread(d->thread);

    connect(d->thread, &QThread::finished,
            d->task, &QObject::deleteLater);
    connect(this, &MainWindow::runThread,
            d->task, &PatcherTask::patch);
    connect(d->task, &PatcherTask::finished,
            this, &MainWindow::onPatchingFinished);
    connect(d->task, &PatcherTask::progressUpdated,
            this, &MainWindow::onProgressUpdated);
    connect(d->task, &PatcherTask::filesUpdated,
            this, &MainWindow::onFilesUpdated);
    connect(d->task, &PatcherTask::detailsUpdated,
            this, &MainWindow::onDetailsUpdated);

    d->thread->start();
}
Ejemplo n.º 5
0
Dialog::Dialog(QWidget *parent): QDialog(parent),
	myTicks1(0), myTicks2(0),
	myTimer1(0), myTimer2(0) {

	setWindowTitle("Timers tricking");
	myMutex1 = new QMutex();
	myMutex2 = new QMutex();

	createWidgets();
	addWidgets();
	setConnections();

	myTimer_id = startTimer(10);
}
Ejemplo n.º 6
0
    void DlgOptions::addWidget(core::Module* module)
    {
        QVector<QPair<QString, QWidget*> > modOpt;
        QVector<QPair<QString, core::OptionsBase*> > optWidgets;
        module->getModuleWidgets(core::Module::WT_OPTIONS, this, modOpt);

        for (int i = 0; i < modOpt.size(); i++) {
            core::OptionsBase* options = (core::OptionsBase*)modOpt[i].second;
            connect(options, &core::OptionsBase::destroyed, this, &DlgOptions::removeWidget);
            optWidgets.push_back(QPair<QString, core::OptionsBase*>(modOpt[i].first, options));
        }

        addWidgets(optWidgets);
    }
Ejemplo n.º 7
0
MainWindow::MainWindow(mbp::PatcherConfig *pc, QWidget *parent)
    : QWidget(parent), d_ptr(new MainWindowPrivate())
{
    Q_D(MainWindow);

    setWindowIcon(QIcon(QStringLiteral(":/icons/icon.png")));
    setWindowTitle(qApp->applicationName());

    // If we're passed an argument, switch to automatic mode
    if (qApp->arguments().size() > 2) {
        d->autoMode = true;
        d->fileName = qApp->arguments().at(1);
    } else {
        d->autoMode = false;
        d->fileName.clear();
    }

    d->pc = pc;

    d->patcher = pc->createPatcher("MultiBootPatcher");

    addWidgets();
    setWidgetActions();
    populateWidgets();
    setWidgetDefaults();
    refreshInstallationLocations();
    updateWidgetsVisibility();

    // Create thread
    d->thread = new QThread(this);
    d->task = new PatcherTask();
    d->task->moveToThread(d->thread);

    connect(d->thread, &QThread::finished,
            d->task, &QObject::deleteLater);
    connect(this, &MainWindow::runThread,
            d->task, &PatcherTask::patch);
    connect(d->task, &PatcherTask::finished,
            this, &MainWindow::onPatchingFinished);
    connect(d->task, &PatcherTask::progressUpdated,
            this, &MainWindow::onProgressUpdated);
    connect(d->task, &PatcherTask::filesUpdated,
            this, &MainWindow::onFilesUpdated);
    connect(d->task, &PatcherTask::detailsUpdated,
            this, &MainWindow::onDetailsUpdated);

    d->thread->start();
}
Ejemplo n.º 8
0
QListViewItemExt::QListViewItemExt(QTableWidget * parent,QString label1,
                             QString label2,QString label3,
                             QString label4,QString label5,
                             QString label6,QString label7,
                             QString label8)
{
    mParent = parent;
  mIndex = -1;
  mHiddenText = QString::null;
  mRow = parent->rowCount();

  parent->insertRow(mRow);
  parent->setColumnCount(8);
  addWidgets(parent, label1, label2, label3, label4, label5, label6,
             label7, label8);
}
Ejemplo n.º 9
0
DbgMainWindow::DbgMainWindow(IGui *igui, event_def *init_done) {
    igui_ = igui;
    initDone_ = init_done;

    setWindowTitle(tr("RISC-V platform debugger"));
    resize(QDesktopWidget().availableGeometry(this).size() * 0.7);

    listConsoleListeners_.make_list(0);
    /** Console commands used by main window: */
    cmdIsRunning_.make_string("isrunning");
    cmdRun_.make_string("c");
    cmdHalt_.make_string("halt");
    cmdStep_.make_string("c 1");
 
    createActions();
    createMenus();
    createStatusBar();
    createMdiWindow();

    /** QT documeneted behaviour:
     *
     * If you add a child widget to an already visible widget 
     * you must explicitly show the child to make it visible.
     *
     * @todo Fix exception with PNP when initially opened 
     */
    addWidgets();
    
    setUnifiedTitleAndToolBarOnMac(true);

    /** 
     * To use the following type in SIGNAL -> SLOT definitions 
     * we have to register them using qRegisterMetaType template
     */
    qRegisterMetaType<uint64_t>("uint64_t");
    qRegisterMetaType<uint32_t>("uint32_t");

    connect(this, SIGNAL(signalPostInit(AttributeType *)),
            this, SLOT(slotPostInit(AttributeType *)));
    connect(this, SIGNAL(signalExit()), this, SLOT(slotExit()));

    tmrGlobal_ = new QTimer(this);
    connect(tmrGlobal_, SIGNAL(timeout()), this, SLOT(slotConfigDone()));
    tmrGlobal_->setSingleShot(true);
    tmrGlobal_->setInterval(1);
    tmrGlobal_->start();
}
Ejemplo n.º 10
0
ImportFilesDialog::ImportFilesDialog(bool importTypeEnabled, QWidget* parent, const char*name):
		QFileDialog(parent, name)
{
setCaption(tr("QtiPlot - Import Multiple ASCII Files"));

QString filter=tr("All files") + " *;;" + tr("Text") + " (*.TXT *.txt);;" +
			   tr("Data")+" (*DAT *.dat);;" + tr("Comma Separated Values") + " (*.CSV *.csv);;";
setFilters( filter );
setMode( QFileDialog::ExistingFiles );

if (importTypeEnabled)
	{
	QLabel* label = new QLabel( tr("Import each file as") + ": ", this );
        
	importType = new QComboBox( this );
	importType->insertItem(tr("New Table"));
	importType->insertItem(tr("New Columns"));
	importType->insertItem(tr("New Rows"));

	addWidgets( label, importType, 0 );
	}
}
MagpieFileImportPopup::MagpieFileImportPopup()
	: Dialog(TApp::instance()->getMainWindow(), true, true, "MagPieFileImport"), m_levelField(0), m_fromField(0), m_toField(0), m_flipbook(0), m_levelPath()
{
	setWindowTitle(tr("Import Magpie File"));

	beginVLayout();

	setLabelWidth(45);

	addSeparator(tr("Frame Range"));

	QWidget *fromToWidget = new QWidget(this);
	fromToWidget->setFixedHeight(DVGui::WidgetHeight);
	fromToWidget->setFixedSize(210, DVGui::WidgetHeight);
	QHBoxLayout *fromToLayout = new QHBoxLayout(fromToWidget);
	fromToLayout->setMargin(0);
	fromToLayout->setSpacing(0);
	m_fromField = new DVGui::IntLineEdit(fromToWidget, 1, 1, 1);
	fromToLayout->addWidget(m_fromField, 0, Qt::AlignLeft);
	m_toField = new DVGui::IntLineEdit(fromToWidget, 1, 1, 1);
	QLabel *toLabel = new QLabel(tr("To:"));
	toLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	toLabel->setFixedSize(20, m_toField->height());
	fromToLayout->addWidget(toLabel, 0, Qt::AlignRight);
	fromToLayout->addWidget(m_toField, 0, Qt::AlignLeft);
	fromToWidget->setLayout(fromToLayout);
	addWidget(tr("From:"), fromToWidget);

	addSeparator(tr("Animation Level"));

	m_levelField = new DVGui::FileField(this);
	m_levelField->setFileMode(QFileDialog::AnyFile);
	m_levelField->setFixedWidth(200);
	bool ret = connect(m_levelField, SIGNAL(pathChanged()), SLOT(onLevelPathChanged()));

	addWidget(tr("Level:"), m_levelField);

	QLabel *frameLabel = new QLabel(" Frame", this);
	frameLabel->setFixedHeight(DVGui::WidgetHeight);
	addWidget(tr("Phoneme"), frameLabel);
	int i;
	for (i = 0; i < 9; i++) {
		IntLineEdit *field = new IntLineEdit(this, 1, 1);
		QLabel *label = new QLabel("", this);
		label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
		label->setFixedSize(getLabelWidth(), field->height());
		m_actFields.append(QPair<QLabel *, IntLineEdit *>(label, field));
		addWidgets(label, field);
	}

	endVLayout();

	QFrame *frame = new QFrame(this);
	frame->setFrameStyle(QFrame::StyledPanel);
	frame->setObjectName("LipSynkViewer");
	frame->setStyleSheet("#LipSynkViewer { border: 1px solid rgb(150,150,150); }");
	QVBoxLayout *frameLayout = new QVBoxLayout(frame);
	frameLayout->setMargin(0);
	frameLayout->setSpacing(0);
	UINT buttonMask = FlipConsole::cFullConsole & (~(FlipConsole::eRate | FlipConsole::eSound | FlipConsole::eSaveImg | FlipConsole::eHisto | FlipConsole::eCompare | FlipConsole::eCustomize | FlipConsole::eSave | FlipConsole::eBegin | FlipConsole::eEnd | FlipConsole::eFirst | FlipConsole::eNext | FlipConsole::ePause | FlipConsole::ePlay | FlipConsole::ePrev | FlipConsole::eRate | FlipConsole::eWhiteBg | FlipConsole::eCheckBg | FlipConsole::eBlackBg | FlipConsole::eNext | FlipConsole::eLast | FlipConsole::eLoop | FlipConsole::eGRed | FlipConsole::eGGreen | FlipConsole::eGBlue | FlipConsole::eRed | FlipConsole::eGreen | FlipConsole::eBlue | FlipConsole::eMatte | FlipConsole::eDefineSubCamera | FlipConsole::eDefineLoadBox | FlipConsole::eUseLoadBox | FlipConsole::eFilledRaster));
	m_flipbook = new FlipBook(this, tr("Import Magpie File"), buttonMask);
	m_flipbook->setFixedHeight(250);
	frameLayout->addWidget(m_flipbook);
	frame->setLayout(frameLayout);
	addWidget(frame);

	QPushButton *okBtn = new QPushButton(tr("Import"), this);
	okBtn->setDefault(true);
	QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this);
	ret = ret && connect(okBtn, SIGNAL(clicked()), this, SLOT(onOkPressed()));
	ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
	assert(ret);

	addButtonBarWidget(okBtn, cancelBtn);
}
Ejemplo n.º 12
0
 void DlgOptions::init(QVector<QPair<QString, core::OptionsBase*> >& widgets)
 {
     optModules->clear();
     addWidgets(widgets);
     optModules->setCurrentRow(0);
 }
Ejemplo n.º 13
0
Scripting::Scripting() : _ctx{[](){
        PythonQtInit();
        return PythonQt::self()->getMainModule();
    }()} {
    state->scripting = this;

    PythonQt::self()->registerClass(&EmitOnCtorDtor::staticMetaObject);

    evalScript("import sys");
    evalScript("sys.argv = ['']");  // <- this is needed to import the ipython module from the site-package
#ifdef Q_OS_OSX
    // as ipython does not export it's sys paths after the installation we refer to that site-package
    evalScript("sys.path.append('/Library/Python/2.7/site-packages')");
#endif
    PythonQt::self()->createModuleFromScript(SCRIPTING_KNOSSOS_MODULE);
    evalScript(QString("import %1").arg(SCRIPTING_KNOSSOS_MODULE));

    evalScript(QString("%1.%2 = {}").arg(SCRIPTING_KNOSSOS_MODULE).arg(SCRIPTING_PLUGIN_CONTAINER));

    addObject("signalRelay", state->signalRelay);
    addObject("knossos", &pythonProxy);
    addObject("scripting", this);
    addObject("segmentation", &segmentationProxy);
    addObject("skeleton", &skeletonProxy);
    addObject("knossos_global_viewer", state->viewer);
    addObject("knossos_global_mainwindow", state->viewer->window);
    addObject("knossos_global_skeletonizer", &Skeletonizer::singleton());
    addObject("knossos_global_segmentation", &Segmentation::singleton());
    addObject("knossos_global_loader", &Loader::Controller::singleton());
    addVariable("GL_POINTS", GL_POINTS);
    addVariable("GL_LINES", GL_LINES);
    addVariable("GL_LINE_STRIP", GL_LINE_STRIP);
    addVariable("GL_LINE_LOOP", GL_LINE_LOOP);
    addVariable("GL_TRIANGLES", GL_TRIANGLES);
    addVariable("GL_TRIANGLES_STRIP", GL_TRIANGLE_STRIP);
    addVariable("GL_TRIANGLE_FAN", GL_TRIANGLE_FAN);
    addVariable("GL_QUADS", GL_QUADS);
    addVariable("GL_QUAD_STRIP", GL_QUAD_STRIP);
    addVariable("GL_POLYGON", GL_POLYGON);
    addWidgets();

    auto makeDecorator = [](QObject * decorator, const char * typeName){
        // PythonQt tries to reparent the decorators, we do their missing work of pushing it into their thread first
        // due to the QObject handling they also get deleted by PythonQt then
        decorator->moveToThread(PythonQt::self()->thread());
        PythonQt::self()->addDecorators(decorator);
        PythonQt::self()->registerCPPClass(typeName, "", "internal");
    };
    makeDecorator(new CoordinateDecorator, "Coordinate");
    makeDecorator(new FloatCoordinateDecorator, "floatCoordinate");
    makeDecorator(new NodeListDecorator, "Node");
    makeDecorator(new SegmentListDecorator, "Segment");
    makeDecorator(new TreeListDecorator, "Tree");

    createDefaultPluginDir();
    addPythonPath(getPluginDir());
    addPresetCustomPythonPaths();

#ifdef Q_OS_LINUX //in linux there’s an explicit symlink to a python 2 binary
    _ctx.evalFile(QString("sys.path.append('%1')").arg("./python2"));
#else
    _ctx.evalFile(QString("sys.path.append('%1')").arg("./python"));
#endif

    changeWorkingDirectory();
    executeResourceStartup();
    executeFromUserDirectory();

    QObject::connect(&state->scripting->pythonProxy, &PythonProxy::viewport_snapshot, &state->viewer->window->widgetContainer.snapshotWidget, &SnapshotWidget::snapshotRequest);
    state->viewer->window->widgetContainer.pythonInterpreterWidget.startConsole();
}