QConfigMenu::QConfigMenu()
{
    m_groupBox = new QGroupBox(tr("网元参数配置"), this);

    QRegExp regExp("[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}");

    m_hostIPlabel = new QLabel(tr("本端主控ip地址"));
    m_hostIPEdit = new QLineEdit(tr("192.192.192.198"));
    m_hostIPEdit->setValidator(new QRegExpValidator(regExp,this));

    m_loopbacklabel = new QLabel(tr("本端环回ip地址"));
    m_loopbackEdit = new QLineEdit(tr("1.1.1.1"));
    m_loopbackEdit->setValidator(new QRegExpValidator(regExp,this));

    m_peerloopbacklabel = new QLabel(tr("对端环回ip地址"));
    m_peerloopbackEdit = new QLineEdit(tr("2.2.2.2"));
    m_peerloopbackEdit->setValidator(new QRegExpValidator(regExp,this));


    m_vlanlabel = new QLabel(tr("本端VLAN绑定ip地址"));
    m_vlanEdit = new QLineEdit(tr("100.0.0.1"));
    m_vlanEdit->setValidator(new QRegExpValidator(regExp,this));

    m_peervlanlabel = new QLabel(tr("对端VLAN绑定ip地址"));
    m_peervlanEdit = new QLineEdit(tr("100.0.0.2"));
    m_peervlanEdit->setValidator(new QRegExpValidator(regExp,this));



    m_peerMacLabel = new QLabel(tr("对端设备MAC地址"));
    QRegExp peerMacRegExp("[0-9a-f]{4}\\.[0-9a-f]{4}\\.[0-9a-f]{4}");
    m_peerMacEdit = new QLineEdit(tr("00d0.d0c0.0081"));
    m_peerMacEdit->setValidator(new QRegExpValidator(peerMacRegExp,this));
    m_peerMacEdit->setToolTip(tr("MAC地址填写可以在对端设备上输入show lacp sys-id得到,需要在最低位加1"));




    m_cepSlotNoLabel = new QLabel(tr("CEP线卡所在槽位号"));
    m_cepSlotNoBox = new QSpinBox;
    m_cepSlotNoBox->setRange(1,12);
    m_cepSlotNoBox->setValue(7);



    m_cepPortNoLabel = new QLabel(tr("CEP业务绑定端口号"));
    m_cepPortNoBox = new QComboBox;
    m_cepPortNoBox->addItem(tr("1"));
    m_cepPortNoBox->addItem(tr("2"));
    m_cepPortNoBox->addItem(tr("3"));
    m_cepPortNoBox->addItem(tr("4"));


    m_geSlotNoLabel = new QLabel(tr("GE线卡所在槽位号"));
    m_geSlotNoBox = new QSpinBox;
    m_geSlotNoBox->setRange(1,12);
    m_geSlotNoBox->setValue(3);
    m_gePortNoLabel = new QLabel(tr("GE线卡转发端口号"));
    m_gePortNoBox = new QComboBox;
    m_gePortNoBox->addItem(tr("1"));
    m_gePortNoBox->addItem(tr("2"));
    m_gePortNoBox->addItem(tr("3"));
    m_gePortNoBox->addItem(tr("4"));
    m_gePortNoBox->addItem(tr("5"));
    m_gePortNoBox->addItem(tr("6"));
    m_gePortNoBox->addItem(tr("7"));
    m_gePortNoBox->addItem(tr("8"));

    m_configBox = new QGroupBox(tr("网元配置步骤"), this);
    m_configBox->setFixedSize(450,60);
    m_configBox->setToolTip("按照从左到右的顺序依次操作,先生成配置脚本,然后检测配置脚本,最后再执行配置脚本!");
    mkConfigBtn = new QPushButton(tr("生成配置文件"));
    mkConfigBtn->setFixedWidth(100);
    m_showConfigBtn = new QPushButton(tr("检查配置脚本"));
    m_showConfigBtn->setFixedWidth(100);

    m_runBtn = new QPushButton(tr("配置业务实例"));
    m_runBtn->setFixedWidth(100);
    client = new QClient;//添加Telnet自动配置界面


    m_runConfigEdit = new QTextEdit;//配置信息输出文本框
    m_runConfigEdit->setReadOnly(true);
    m_runConfigEdit->setFixedSize(480,320);
    m_runConfigEdit->setWindowTitle(tr("CEP配置脚本"));
    m_runConfigEdit->setWindowFlags(windowFlags() &~ Qt::WindowMinMaxButtonsHint);

    QGridLayout *glayout = new QGridLayout;

    glayout->addWidget(m_hostIPlabel,1,0);
    glayout->addWidget(m_hostIPEdit,1,1);
    glayout->addWidget(m_loopbacklabel,2,0);
    glayout->addWidget(m_loopbackEdit,2,1);
    glayout->addWidget(m_peerloopbacklabel,3,0);
    glayout->addWidget(m_peerloopbackEdit,3,1);
    glayout->addWidget(m_vlanlabel,4,0);
    glayout->addWidget(m_vlanEdit,4,1);
    glayout->addWidget(m_peervlanlabel,5,0);
    glayout->addWidget(m_peervlanEdit,5,1);
    glayout->addWidget(m_peerMacLabel,6,0);
    glayout->addWidget(m_peerMacEdit,6,1);
    glayout->addWidget(m_cepSlotNoLabel,7,0);
    glayout->addWidget(m_cepSlotNoBox,7,1);
    glayout->addWidget(m_cepPortNoLabel,8,0);
    glayout->addWidget(m_cepPortNoBox,8,1);
    glayout->addWidget(m_geSlotNoLabel,9,0);
    glayout->addWidget(m_geSlotNoBox,9,1);
    glayout->addWidget(m_gePortNoLabel,10,0);
    glayout->addWidget(m_gePortNoBox,10,1);
    m_groupBox->setLayout(glayout);



    QHBoxLayout *hlayout = new QHBoxLayout;
    hlayout->addWidget(mkConfigBtn);
    hlayout->addWidget(m_showConfigBtn);
    hlayout->addWidget(m_runBtn);
    m_configBox->setLayout(hlayout);

    QVBoxLayout *vlayout = new QVBoxLayout;
    vlayout->addWidget(m_groupBox);
    vlayout->addWidget(m_configBox);
    setLayout(vlayout);



    setFixedSize(480,480);
    setWindowTitle(tr("网元CEP业务配置工具"));
    setWindowFlags(windowFlags() &~ Qt::WindowMaximizeButtonHint);

    connect(m_showConfigBtn, SIGNAL(clicked()), this,SLOT(on_showConfigBtn()));
    connect(m_runBtn, SIGNAL(clicked()), this, SLOT(on_runBtn()));
    connect(mkConfigBtn, SIGNAL(clicked()), this, SLOT(on_mkConfigBtn()));
//    connect(m_loopbackEdit,SIGNAL(textChanged(QString)), this, SLOT(on_mkConfigBtn()));
//    connect(m_peerloopbackEdit, SIGNAL(textChanged(QString)), this, SLOT(on_mkConfigBtn()));
//    connect(m_vlanEdit, SIGNAL(textChanged(QString)), this, SLOT(on_mkConfigBtn()));
//    connect(m_peervlanEdit, SIGNAL(textChanged(QString)), this, SLOT(on_mkConfigBtn()));
//    connect(m_peerMacEdit, SIGNAL(textChanged(QString)), this, SLOT(on_mkConfigBtn()));
    connect(m_cepSlotNoBox, SIGNAL(valueChanged(QString)), this, SLOT(on_mkConfigBtn()));
    connect(m_cepPortNoBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_mkConfigBtn()));
    connect(m_geSlotNoBox, SIGNAL(valueChanged(QString)), this, SLOT(on_mkConfigBtn()));
    connect(m_gePortNoBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_mkConfigBtn()));





}
Ejemplo n.º 2
0
InfoScreen::InfoScreen(Buzzer* buzzer, QWidget *parent, Qt::WFlags f)
    :QMainWindow(parent, f)
{
	setWindowFlags(windowFlags()|Qt::FramelessWindowHint);
        mBuzzer = buzzer;
	
	setupUi(this);
	backLabel->setText(QString(trUtf8("Wyjście")));
	//QTextDocument infoText();

        QSettings settings(UserConfigFileName, QSettings::IniFormat);
        QSettings system(SysConfigFileName, QSettings::IniFormat);

	QString language = settings.value("language", "pl").toString();

	if (language == "en") {
		textBrowser->setSource(QUrl("../resources/publicinfo_en.html"));
		titleBrowser->setSource(QUrl("../resources/kriosystem_en.html"));
	};
	if (language == "de") {
		textBrowser->setSource(QUrl("../resources/publicinfo_de.html"));
		titleBrowser->setSource(QUrl("../resources/kriosystem_de.html"));
	};
	if (language == "cz") {
		textBrowser->setSource(QUrl("../resources/publicinfo_cz.html"));
		titleBrowser->setSource(QUrl("../resources/kriosystem_cz.html"));
	};
	if (language == "sk") {
		textBrowser->setSource(QUrl("../resources/publicinfo_sk.html"));
		titleBrowser->setSource(QUrl("../resources/kriosystem_sk.html"));
	};
	if (language == "pl") {
		textBrowser->setSource(QUrl("../resources/publicinfo_pl.html"));
		titleBrowser->setSource(QUrl("../resources/kriosystem_pl.html"));
	};

	//Replacing teksts
	if(textBrowser->find("$DATE$")||
           textBrowser->find("$DATE$",QTextDocument::FindBackward)){
		textBrowser->cut();
		QDate date = QDate::currentDate();
		textBrowser->insertPlainText(date.toString());
	}
	if(textBrowser->find("$TIME$")||
	   textBrowser->find("$TIME$",QTextDocument::FindBackward)){
		textBrowser->cut();
		QTime time = QTime::currentTime();
		textBrowser->insertPlainText(time.toString());
	}
	if(textBrowser->find("$SOFTWARE_VERSION$")||
	   textBrowser->find("$SOFTWARE_VERSION$",QTextDocument::FindBackward)){
		textBrowser->cut();
		QString software_version = system.value("Version", "v1.0.4").toString();
		textBrowser->insertPlainText(software_version);
	}
	if(textBrowser->find("$INSPECTION_DATE$")||
	   textBrowser->find("$INSPECTION_DATE$",QTextDocument::FindBackward)){
		textBrowser->cut();
		QDate date = system.value("inspection",QDate(2000,1,1)).toDate();
		textBrowser->insertPlainText(date.toString());
	}
	textBrowser->moveCursor(QTextCursor::Start);
}
Ejemplo n.º 3
0
TreeWidgetEditorDialog::TreeWidgetEditorDialog(QDesignerFormWindowInterface *form, QWidget *parent) :
    QDialog(parent), m_editor(form, this)
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
Ejemplo n.º 4
0
MainWindow::MainWindow( QWidget *parent )
:	QWidget( parent )
,	cardsGroup( new QActionGroup( this ) )
,	m_loaded( false )
,	quitOnClose( false )
{
	qRegisterMetaType<QSslCertificate>("QSslCertificate");

	setupUi( this );

	cards->hide();
	cards->hack();
	languages->hack();

	setWindowFlags( Qt::Window | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowTitleHint );
#if QT_VERSION >= 0x040500
	setWindowFlags( windowFlags() | Qt::WindowCloseButtonHint );
#else
	setWindowFlags( windowFlags() | Qt::WindowSystemMenuHint );
#endif

	QApplication::instance()->installEventFilter( this );

	Common *common = new Common( this );
	QDesktopServices::setUrlHandler( "browse", common, "browse" );
	QDesktopServices::setUrlHandler( "mailto", common, "mailTo" );

	Settings s;
	// Mobile
	infoMobileCode->setValidator( new IKValidator( infoMobileCode ) );
	infoMobileCode->setText( s.value( "Client/MobileCode" ).toString() );
	infoMobileCell->setText( s.value( "Client/MobileNumber", "+372" ).toString() );
	connect( infoMobileCode, SIGNAL(textEdited(QString)), SLOT(enableSign()) );
	connect( infoMobileCell, SIGNAL(textEdited(QString)), SLOT(enableSign()) );
	connect( infoSignMobile, SIGNAL(toggled(bool)), SLOT(showCardStatus()) );

	// Buttons
	QButtonGroup *buttonGroup = new QButtonGroup( this );

	buttonGroup->addButton( settings, HeadSettings );
	buttonGroup->addButton( help, HeadHelp );

	buttonGroup->addButton( homeSign, HomeSign );
	buttonGroup->addButton( homeView, HomeView );
	buttonGroup->addButton( homeCrypt, HomeCrypt );

	introNext = introButtons->addButton( tr( "Next" ), QDialogButtonBox::ActionRole );
	buttonGroup->addButton( introNext, IntroNext );
	buttonGroup->addButton( introButtons->button( QDialogButtonBox::Cancel ), IntroBack );

	signButton = signButtons->addButton( tr("Sign"), QDialogButtonBox::AcceptRole );
	buttonGroup->addButton( signButton, SignSign );
	buttonGroup->addButton( signButtons->button( QDialogButtonBox::Cancel ), SignCancel );

	viewAddSignature = viewButtons->addButton( tr("Add signature"), QDialogButtonBox::ActionRole );
	buttonGroup->addButton( viewAddSignature, ViewAddSignature );
	buttonGroup->addButton( viewButtons->button( QDialogButtonBox::Close ), ViewClose );
	connect( buttonGroup, SIGNAL(buttonClicked(int)),
		SLOT(buttonClicked(int)) );

	connect( infoCard, SIGNAL(linkActivated(QString)), SLOT(parseLink(QString)) );

	// Digidoc
	doc = new DigiDoc( this );
	connect( cards, SIGNAL(activated(QString)), doc, SLOT(selectCard(QString)) );
	connect( doc, SIGNAL(error(QString)), SLOT(showWarning(QString)) );
	connect( doc, SIGNAL(dataChanged()), SLOT(showCardStatus()) );
	m_loaded = doc->init();

	// Translations
	appTranslator = new QTranslator( this );
	commonTranslator = new QTranslator( this );
	qtTranslator = new QTranslator( this );
	QApplication::instance()->installTranslator( appTranslator );
	QApplication::instance()->installTranslator( commonTranslator );
	QApplication::instance()->installTranslator( qtTranslator );
	lang << "et" << "en" << "ru";
	QString deflang;
	switch( QLocale().language() )
	{
	case QLocale::English: deflang = "en"; break;
	case QLocale::Russian: deflang = "ru"; break;
	case QLocale::Estonian:
	default: deflang = "et"; break;
	}
	on_languages_activated( lang.indexOf(
		s.value( "Main/Language", deflang ).toString() ) );
	QActionGroup *langGroup = new QActionGroup( this );
	QAction *etAction = langGroup->addAction( new QAction( langGroup ) );
	QAction *enAction = langGroup->addAction( new QAction( langGroup ) );
	QAction *ruAction = langGroup->addAction( new QAction( langGroup ) );
	etAction->setData( 0 );
	enAction->setData( 1 );
	ruAction->setData( 2 );
	etAction->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_1 );
	enAction->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_2 );
	ruAction->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_3 );
	addAction( etAction );
	addAction( enAction );
	addAction( ruAction );
	connect( langGroup, SIGNAL(triggered(QAction*)), SLOT(changeLang(QAction*)) );
	connect( cardsGroup, SIGNAL(triggered(QAction*)), SLOT(changeCard(QAction*)) );

	// Views
	signContentView->setColumnHidden( 2, true );
	viewContentView->setColumnHidden( 3, true );
	connect( signContentView, SIGNAL(remove(unsigned int)),
		SLOT(removeDocument(unsigned int)) );
	connect( viewContentView, SIGNAL(remove(unsigned int)),
		SLOT(removeDocument(unsigned int)) );

	// Actions
	closeAction = new QAction( tr("Close"), this );
	closeAction->setShortcut( Qt::CTRL + Qt::Key_W );
	connect( closeAction, SIGNAL(triggered()), this, SLOT(closeDoc()) );
	addAction( closeAction );
#if defined(Q_OS_MAC)
	QMenuBar *bar = new QMenuBar;
	QMenu *menu = bar->addMenu( tr("&File") );
	QAction *pref = menu->addAction( tr("Settings"), this, SLOT(showSettings()) );
	pref->setMenuRole( QAction::PreferencesRole );
	menu->addAction( closeAction );
#endif

	// Arguments
	QStringList args = qApp->arguments();
	if( args.size() > 1 )
	{
		quitOnClose = true;
		args.removeAt( 0 );
		params = args;
		buttonClicked( HomeSign );
	}
}
Ejemplo n.º 5
0
    PreferencesDialog::PreferencesDialog(QWidget *parent)
        : BaseClass(parent)
    {
        setWindowIcon(GuiRegistry::instance().mainWindowIcon());

        setWindowTitle("Preferences " PROJECT_NAME_TITLE);
        setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
        setFixedSize(height,width);

        QVBoxLayout *layout = new QVBoxLayout(this);

        QHBoxLayout *defLayout = new QHBoxLayout(this);
        QLabel *defDisplayModeLabel = new QLabel("Default display mode:");
        defLayout->addWidget(defDisplayModeLabel);
        _defDisplayModeComboBox = new QComboBox();
        QStringList modes;
        for (int i = Text;i<=Custom;++i)
        {
            modes.append(convertViewModeToString(static_cast<ViewMode>(i)));
        }
        _defDisplayModeComboBox->addItems(modes);
        defLayout->addWidget(_defDisplayModeComboBox);
        layout->addLayout(defLayout);

        QHBoxLayout *timeZoneLayout = new QHBoxLayout(this);
        QLabel *timeZoneLabel = new QLabel("Display Dates in:");
        timeZoneLayout->addWidget(timeZoneLabel);
        _timeZoneComboBox = new QComboBox();
        QStringList times;
        for (int i = Utc;i<=LocalTime;++i)
        {
            times.append(convertTimesToString(static_cast<SupportedTimes>(i)));
        }
        _timeZoneComboBox->addItems(times);
        timeZoneLayout->addWidget(_timeZoneComboBox);
        layout->addLayout(timeZoneLayout);

        QHBoxLayout *uuidEncodingLayout = new QHBoxLayout(this);
        QLabel *uuidEncodingLabel = new QLabel("Legacy UUID Encoding:");
        uuidEncodingLayout->addWidget(uuidEncodingLabel);
        _uuidEncodingComboBox = new QComboBox();
        QStringList uuids;
        for (int i = DefaultEncoding;i<=PythonLegacy;++i)
        {
            uuids.append(convertUUIDEncodingToString(static_cast<UUIDEncoding>(i)));
        }
        _uuidEncodingComboBox->addItems(uuids);
        uuidEncodingLayout->addWidget(_uuidEncodingComboBox);
        layout->addLayout(uuidEncodingLayout);        

        _loadMongoRcJsCheckBox = new QCheckBox("Load .mongorc.js");
        layout->addWidget(_loadMongoRcJsCheckBox);

        _disabelConnectionShortcutsCheckBox = new QCheckBox("Disable connection shortcuts");
        layout->addWidget(_disabelConnectionShortcutsCheckBox);

        QHBoxLayout *stylesLayout = new QHBoxLayout(this);
        QLabel *stylesLabel = new QLabel("Styles:");
        stylesLayout->addWidget(stylesLabel);
        _stylesComboBox = new QComboBox();
        _stylesComboBox->addItems(detail::getSupportedStyles());
        stylesLayout->addWidget(_stylesComboBox);
        layout->addLayout(stylesLayout);   

        QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
        buttonBox->setOrientation(Qt::Horizontal);
        buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save);
        VERIFY(connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())));
        VERIFY(connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())));
        layout->addWidget(buttonBox);
        setLayout(layout);

        syncWithSettings();
    }
Ejemplo n.º 6
0
SnapshotWidget::SnapshotWidget(QWidget *parent) : DialogVisibilityNotify(SNAPSHOT_WIDGET, parent), saveDir(QDir::homePath()) {
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    setWindowIcon(QIcon(":/resources/icons/snapshot.png"));
    setWindowTitle("Snapshot Tool");
    sizeCombo.addItem("8192 x 8192");
    sizeCombo.addItem("4096 x 4096");
    sizeCombo.addItem("2048 x 2048");
    sizeCombo.addItem("1024 x 1024");
    sizeCombo.setCurrentIndex(2); // 2048x2048 default


    vpArbRadio.setHidden(true);
    auto viewportChoiceLayout = new QVBoxLayout();
    vpGroup.addButton(&vpXYRadio, VIEWPORT_XY);
    vpGroup.addButton(&vpXZRadio, VIEWPORT_XZ);
    vpGroup.addButton(&vpZYRadio, VIEWPORT_ZY);
    vpGroup.addButton(&vpArbRadio, VIEWPORT_ARBITRARY);
    vpGroup.addButton(&vp3dRadio, VIEWPORT_SKELETON);
    viewportChoiceLayout->addWidget(&vpXYRadio);
    viewportChoiceLayout->addWidget(&vpXZRadio);
    viewportChoiceLayout->addWidget(&vpZYRadio);
    viewportChoiceLayout->addWidget(&vpArbRadio);
    viewportChoiceLayout->addWidget(&vp3dRadio);
    QObject::connect(&vpGroup, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](const int) { updateOptionVisibility(); });

    auto imageOptionsLayout = new QVBoxLayout();
    imageOptionsLayout->addWidget(&withAxesCheck);
    imageOptionsLayout->addWidget(&withBoxCheck);
    imageOptionsLayout->addWidget(&withOverlayCheck);
    imageOptionsLayout->addWidget(&withSkeletonCheck);
    imageOptionsLayout->addWidget(&withScaleCheck);
    imageOptionsLayout->addWidget(&withVpPlanes);

    auto settingsLayout = new QHBoxLayout();
    settingsLayout->addLayout(viewportChoiceLayout);
    auto line = new QFrame();
    line->setFrameShape(QFrame::VLine);
    line->setFrameStyle(QFrame::Sunken);
    settingsLayout->addWidget(line);
    settingsLayout->addLayout(imageOptionsLayout);

    mainLayout.addWidget(&sizeCombo);
    mainLayout.addLayout(settingsLayout);
    mainLayout.addWidget(&snapshotButton);

    QObject::connect(&snapshotButton, &QPushButton::clicked, [this]() {
        state->viewerState->renderInterval = SLOW;
        const auto path = QFileDialog::getSaveFileName(this, tr("Save path"), saveDir + defaultFilename(), tr("Images (*.png *.xpm *.xbm *.jpg *.bmp)"));
        state->viewerState->renderInterval = FAST;
        if(path.isEmpty() == false) {
            QFileInfo info(path);
            saveDir = info.absolutePath() + "/";
            emit snapshotRequest(path, static_cast<ViewportType>(vpGroup.checkedId()), 8192/pow(2, sizeCombo.currentIndex()), withAxesCheck.isChecked(), withBoxCheck.isChecked(), withOverlayCheck.isChecked(), withSkeletonCheck.isChecked(), withScaleCheck.isChecked(), withVpPlanes.isChecked());
        }
    });

    QObject::connect(state->viewer, &Viewer::enabledArbVP, [this](const bool on) {
        vpArbRadio.setVisible(on);
        if (vpArbRadio.isChecked() && vpArbRadio.isHidden()) {
            for (auto * button : vpGroup.buttons()) {
                if (button->isVisible()) {
                    button->setChecked(true);
                }
            }
        }
    });
    QObject::connect(state->viewer, &Viewer::changedDefaultVPSizeAndPos, [this]() {
        const auto xy = state->viewer->window->viewportXY.get()->isVisibleTo(state->viewer->window);
        const auto xz = state->viewer->window->viewportXZ.get()->isVisibleTo(state->viewer->window);
        const auto zy = state->viewer->window->viewportZY.get()->isVisibleTo(state->viewer->window);
        const auto arb = state->viewer->window->viewportArb.get()->isVisibleTo(state->viewer->window);
        const auto skel = state->viewer->window->viewport3D.get()->isVisibleTo(state->viewer->window);
        vpXYRadio.setVisible(xy);
        vpXZRadio.setVisible(xz);
        vpZYRadio.setVisible(zy);
        vpArbRadio.setVisible(arb);
        vp3dRadio.setVisible(skel);
        if (vpGroup.checkedButton() && vpGroup.checkedButton()->isHidden()) {
            for (auto * button : vpGroup.buttons()) {
                if (button->isVisible()) {
                    button->setChecked(true);
                }
            }
        }
        snapshotButton.setEnabled(xy || xz || zy || arb || skel);
    });
    setLayout(&mainLayout);
}
Ejemplo n.º 7
0
LabelDialog::LabelDialog(QWidget *parent)
  : Dialog(parent, Qt::MSWindowsFixedSizeDialogHint)
{
  setWindowFlags (windowFlags() & ~Qt::WindowContextHelpButtonHint);
  setWindowTitle(tr("New Label"));

  nameEdit_ = new LineEdit(this);

  QMenu *iconMenu = new QMenu();
  for (int i = 0; i < 6; i++) {
    iconMenu->addAction(QIcon(QString(":/images/label_%1").arg(i+1)),
                        MainWindow::trNameLabels().at(i));
  }
  iconMenu->addSeparator();
  QAction *newIcon = new QAction(tr("Load icon..."), this);
  iconMenu->addAction(newIcon);

  iconButton_ = new QToolButton(this);
  iconButton_->setIconSize(QSize(16, 16));
  iconButton_->setPopupMode(QToolButton::MenuButtonPopup);
  iconButton_->setMenu(iconMenu);

  QMenu *colorTextMenu = new QMenu();
  colorTextMenu->addAction(tr("Default"));
  colorTextMenu->addSeparator();
  colorTextMenu->addAction(tr("Select color..."));

  colorTextButton_ = new QToolButton(this);
  colorTextButton_->setIconSize(QSize(16, 16));
  colorTextButton_->setPopupMode(QToolButton::MenuButtonPopup);
  colorTextButton_->setMenu(colorTextMenu);

  QMenu *colorBgMenu = new QMenu();
  colorBgMenu->addAction(tr("Default"));
  colorBgMenu->addSeparator();
  colorBgMenu->addAction(tr("Select color..."));

  colorBgButton_ = new QToolButton(this);
  colorBgButton_->setIconSize(QSize(16, 16));
  colorBgButton_->setPopupMode(QToolButton::MenuButtonPopup);
  colorBgButton_->setMenu(colorBgMenu);

  QHBoxLayout *layoutH1 = new QHBoxLayout();
  layoutH1->addWidget(new QLabel(tr("Name:")));
  layoutH1->addWidget(nameEdit_, 1);

  QHBoxLayout *layoutH2 = new QHBoxLayout();
  layoutH2->addWidget(new QLabel(tr("Icon:")));
  layoutH2->addWidget(iconButton_);
  layoutH2->addSpacing(10);
  layoutH2->addWidget(new QLabel(tr("Color text:")));
  layoutH2->addWidget(colorTextButton_);
  layoutH2->addSpacing(10);
  layoutH2->addWidget(new QLabel(tr("Color background:")));
  layoutH2->addWidget(colorBgButton_);
  layoutH2->addStretch(1);

  pageLayout->addLayout(layoutH1);
  pageLayout->addLayout(layoutH2);

  buttonBox->addButton(QDialogButtonBox::Ok);
  buttonBox->addButton(QDialogButtonBox::Cancel);
  buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
  connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));

  connect(nameEdit_, SIGNAL(textChanged(const QString&)),
          this, SLOT(nameEditChanged(const QString&)));
  connect(iconButton_, SIGNAL(clicked()),
          iconButton_, SLOT(showMenu()));
  connect(iconMenu, SIGNAL(triggered(QAction*)),
          this, SLOT(selectIcon(QAction*)));
  connect(newIcon, SIGNAL(triggered()),
          this, SLOT(loadIcon()));
  connect(colorTextButton_, SIGNAL(clicked()),
          colorTextButton_, SLOT(showMenu()));
  connect(colorTextMenu->actions().at(0), SIGNAL(triggered()),
          this, SLOT(defaultColorText()));
  connect(colorTextMenu->actions().at(2), SIGNAL(triggered()),
          this, SLOT(selectColorText()));
  connect(colorBgButton_, SIGNAL(clicked()),
          colorBgButton_, SLOT(showMenu()));
  connect(colorBgMenu->actions().at(0), SIGNAL(triggered()),
          this, SLOT(defaultColorBg()));
  connect(colorBgMenu->actions().at(2), SIGNAL(triggered()),
          this, SLOT(selectColorBg()));
}
FileBrowserDialog::FileBrowserDialog(const Account &account, const ServerRepo& repo, const QString &path, QWidget *parent)
    : QDialog(parent),
      account_(account),
      repo_(repo),
      current_path_(path)
{
    current_lpath_ = current_path_.split('/');

    data_mgr_ = new DataManager(account_);

    setWindowTitle(tr("Cloud File Browser"));
    setWindowIcon(QIcon(":/images/seafile.png"));
    setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint & ~Qt::Dialog)
#if !defined(Q_OS_MAC)
                   | Qt::FramelessWindowHint
#endif
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
                   | Qt::WindowMinimizeButtonHint
#endif
                   | Qt::Window);

    resizer_ = new QSizeGrip(this);
    resizer_->resize(resizer_->sizeHint());
    setAttribute(Qt::WA_TranslucentBackground, true);

    createTitleBar();
    createToolBar();
    createStatusBar();
    createLoadingFailedView();
    createFileTable();

    QWidget* widget = new QWidget;
    widget->setObjectName("mainWidget");
    QVBoxLayout* layout = new QVBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    setLayout(layout);
    layout->addWidget(widget);

    QVBoxLayout *vlayout = new QVBoxLayout;
    vlayout->setContentsMargins(1, 0, 1, 0);
    vlayout->setSpacing(0);
    widget->setLayout(vlayout);

    stack_ = new QStackedWidget;
    stack_->insertWidget(INDEX_LOADING_VIEW, loading_view_);
    stack_->insertWidget(INDEX_TABLE_VIEW, table_view_);
    stack_->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_);
    stack_->setContentsMargins(0, 0, 0, 0);

    vlayout->addWidget(header_);
    vlayout->addWidget(toolbar_);
    vlayout->addWidget(stack_);
    vlayout->addWidget(status_bar_);

#ifdef Q_OS_MAC
    header_->setVisible(false);
#endif

    // this <--> table_view_
    connect(table_view_, SIGNAL(direntClicked(const SeafDirent&)),
            this, SLOT(onDirentClicked(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntSaveAs(const SeafDirent&)),
            this, SLOT(onDirentSaveAs(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntRename(const SeafDirent&)),
            this, SLOT(onGetDirentRename(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntRemove(const SeafDirent&)),
            this, SLOT(onGetDirentRemove(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntRemove(const QList<const SeafDirent*> &)),
            this, SLOT(onGetDirentRemove(const QList<const SeafDirent*> &)));
    connect(table_view_, SIGNAL(direntShare(const SeafDirent&)),
            this, SLOT(onGetDirentShare(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntUpdate(const SeafDirent&)),
            this, SLOT(onGetDirentUpdate(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntPaste()),
            this, SLOT(onGetDirentsPaste()));
    connect(table_view_, SIGNAL(cancelDownload(const SeafDirent&)),
            this, SLOT(onCancelDownload(const SeafDirent&)));
    connect(table_view_, SIGNAL(syncSubdirectory(const QString&)),
            this, SLOT(onGetSyncSubdirectory(const QString &)));

    //dirents <--> data_mgr_
    connect(data_mgr_, SIGNAL(getDirentsSuccess(const QList<SeafDirent>&)),
            this, SLOT(onGetDirentsSuccess(const QList<SeafDirent>&)));
    connect(data_mgr_, SIGNAL(getDirentsFailed(const ApiError&)),
            this, SLOT(onGetDirentsFailed(const ApiError&)));

    //create <--> data_mgr_
    connect(data_mgr_, SIGNAL(createDirectorySuccess(const QString&)),
            this, SLOT(onDirectoryCreateSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(createDirectoryFailed(const ApiError&)),
            this, SLOT(onDirectoryCreateFailed(const ApiError&)));

    //rename <--> data_mgr_
    connect(data_mgr_, SIGNAL(renameDirentSuccess(const QString&, const QString&)),
            this, SLOT(onDirentRenameSuccess(const QString&, const QString&)));
    connect(data_mgr_, SIGNAL(renameDirentFailed(const ApiError&)),
            this, SLOT(onDirentRenameFailed(const ApiError&)));

    //remove <--> data_mgr_
    connect(data_mgr_, SIGNAL(removeDirentSuccess(const QString&)),
            this, SLOT(onDirentRemoveSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(removeDirentFailed(const ApiError&)),
            this, SLOT(onDirentRemoveFailed(const ApiError&)));

    //share <--> data_mgr_
    connect(data_mgr_, SIGNAL(shareDirentSuccess(const QString&)),
            this, SLOT(onDirentShareSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(shareDirentFailed(const ApiError&)),
            this, SLOT(onDirentShareFailed(const ApiError&)));

    //copy <--> data_mgr_
    connect(data_mgr_, SIGNAL(copyDirentsSuccess()),
            this, SLOT(onDirentsCopySuccess()));
    connect(data_mgr_, SIGNAL(copyDirentsFailed(const ApiError&)),
            this, SLOT(onDirentsCopyFailed(const ApiError&)));

    //move <--> data_mgr_
    connect(data_mgr_, SIGNAL(moveDirentsSuccess()),
            this, SLOT(onDirentsMoveSuccess()));
    connect(data_mgr_, SIGNAL(moveDirentsFailed(const ApiError&)),
            this, SLOT(onDirentsMoveFailed(const ApiError&)));

    //subrepo <-->data_mgr_
    connect(data_mgr_, SIGNAL(createSubrepoSuccess(const ServerRepo &)),
            this, SLOT(onCreateSubrepoSuccess(const ServerRepo &)));
    connect(data_mgr_, SIGNAL(createSubrepoFailed(const ApiError&)),
            this, SLOT(onCreateSubrepoFailed(const ApiError&)));

    connect(AutoUpdateManager::instance(), SIGNAL(fileUpdated(const QString&, const QString&)),
            this, SLOT(onFileAutoUpdated(const QString&, const QString&)));

    QTimer::singleShot(0, this, SLOT(fetchDirents()));
}
Ejemplo n.º 9
0
AboutDialog::AboutDialog(QWidget *parent): QDialog(parent)
{
    setupUi(this);
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
Ejemplo n.º 10
0
FileErrorDialog::FileErrorDialog(QWidget *parent, QFileInfo fileInfo, QString errorString, const ErrorType &errorType) :
    QDialog(parent),
    ui(new Ui::fileErrorDialog)
{
    Qt::WindowFlags flags = windowFlags();
    #ifdef Q_OS_LINUX
    flags=flags & ~Qt::X11BypassWindowManagerHint;
    #endif
    flags=flags | Qt::WindowStaysOnTopHint;
    setWindowFlags(flags);

    ui->setupUi(this);
    action=FileError_Cancel;
    ui->label_error->setText(errorString);
    if(fileInfo.exists())
    {
        ui->label_content_file_name->setText(TransferThread::resolvedName(fileInfo));
        if(ui->label_content_file_name->text().isEmpty())
        {
            ui->label_content_file_name->setText(fileInfo.absoluteFilePath());
            ui->label_folder->setVisible(false);
            ui->label_content_folder->setVisible(false);
        }
        else
        {
            QString folder=fileInfo.absolutePath();
            if(folder.size()>80)
                folder=folder.mid(0,38)+"..."+folder.mid(folder.size()-38);
            ui->label_content_folder->setText(fileInfo.absolutePath());
        }
        ui->label_content_size->setText(QString::number(fileInfo.size()));
        QDateTime maxTime(QDate(ULTRACOPIER_PLUGIN_MINIMALYEAR,1,1));
        if(maxTime<fileInfo.lastModified())
        {
            ui->label_modified->setVisible(true);
            ui->label_content_modified->setVisible(true);
            ui->label_content_modified->setText(fileInfo.lastModified().toString());
        }
        else
        {
            ui->label_modified->setVisible(false);
            ui->label_content_modified->setVisible(false);
        }
        if(fileInfo.isDir())
        {
            this->setWindowTitle(tr("Error on folder"));
            ui->label_size->hide();
            ui->label_content_size->hide();
            ui->label_file_name->setText(tr("Folder name"));
        }
        ui->label_file_destination->setVisible(fileInfo.isSymLink());
        ui->label_content_file_destination->setVisible(fileInfo.isSymLink());
        if(fileInfo.isSymLink())
            ui->label_content_file_destination->setText(fileInfo.symLinkTarget());
    }
    else
    {
        ui->label_content_file_name->setText(TransferThread::resolvedName(fileInfo));
        if(ui->label_content_file_name->text().isEmpty())
        {
            ui->label_content_file_name->setText(fileInfo.absoluteFilePath());
            ui->label_folder->setVisible(false);
            ui->label_content_folder->setVisible(false);
        }
        else
            ui->label_content_folder->setText(fileInfo.absolutePath());

        ui->label_file_destination->hide();
        ui->label_content_file_destination->hide();
        ui->label_size->hide();
        ui->label_content_size->hide();
        ui->label_modified->hide();
        ui->label_content_modified->hide();
    }
    if(errorType==ErrorType_Folder || errorType==ErrorType_FolderWithRety)
        ui->PutToBottom->hide();
    if(errorType==ErrorType_Folder)
        ui->Retry->hide();

    ui->Rights->hide();
    #ifdef ULTRACOPIER_PLUGIN_RIGHTS
        if(isInAdmin)
            ui->Rights->hide();
        #ifdef Q_OS_WIN32
        if(errorType!=ErrorType_Rights)
            ui->Rights->hide();
        #else
        ui->Rights->hide();
        #endif
    #else
        ui->Rights->hide();
    #endif
}
Ejemplo n.º 11
0
void acEXRTool::Init(const QString & title, const QString & productName)
{
    Q_UNUSED(productName)

    // Set the dialog title:
    setWindowTitle(title);
    resize(300,150);

    // Set window flags (minimize / maximize / close buttons):
    Qt::WindowFlags flags = windowFlags();
    flags &= ~Qt::WindowContextHelpButtonHint;
    flags |= Qt::WindowStaysOnTopHint;
    setWindowFlags(flags);
 

    // layout components:
    QHBoxLayout* pMainLayout = new QHBoxLayout;
  
    QVBoxLayout* pVerticalLayout = new QVBoxLayout;
    
    //Add exposure, defog, kneelow, kneehigh slider widget
    QHBoxLayout* exposureLayout = new QHBoxLayout;
    QLabel *exposureLabel = new QLabel(this);
    exposureLabel->setText("Exposure:");
    exrExposureBox = new QDoubleSpinBox;
    exrExposureBox->setValue(DEFAULT_EXPOSURE);
    exrExposureBox->setDecimals(3);
    exrExposureBox->setRange(-10, 10);
    exrExposureBox->setSingleStep(0.125);
    
    exposureLayout->addWidget(exposureLabel);
    exposureLayout->addWidget(exrExposureBox);

    QHBoxLayout* defogLayout = new QHBoxLayout;
    QLabel *defogLabel = new QLabel(this);
    defogLabel->setText("Defog:");
    exrDefogBox = new QDoubleSpinBox;
    exrDefogBox->setDecimals(3);
    exrDefogBox->setRange(0, 0.01);
    exrDefogBox->setValue(DEFAULT_DEFOG);
    exrDefogBox->setSingleStep(0.001);

    defogLayout->addWidget(defogLabel);
    defogLayout->addWidget(exrDefogBox);

    QHBoxLayout* klLayout = new QHBoxLayout;
    QLabel *klLabel = new QLabel(this);
    klLabel->setText("Knee Low:");
    exrKneeLowBox = new QDoubleSpinBox;
    exrKneeLowBox->setDecimals(3);
    exrKneeLowBox->setRange(-3, 3);
    exrKneeLowBox->setValue(DEFAULT_KNEELOW);
    exrKneeLowBox->setSingleStep(0.125);

    klLayout->addWidget(klLabel);
    klLayout->addWidget(exrKneeLowBox);

    QHBoxLayout* khLayout = new QHBoxLayout;
    QLabel *khLabel = new QLabel(this);
    khLabel->setText("Knee High:");
    exrKneeHighBox = new QDoubleSpinBox;
    exrKneeHighBox->setDecimals(3);
    exrKneeHighBox->setRange(3.5, 7.5);
    exrKneeHighBox->setValue(DEFAULT_KNEEHIGH);
    exrKneeHighBox->setSingleStep(0.125);

    khLayout->addWidget(khLabel);

    khLayout->addWidget(exrKneeHighBox);

    QHBoxLayout* gammaLayout = new QHBoxLayout;
    QLabel *gammaLabel = new QLabel(this);
    gammaLabel->setText("Gamma:");
    exrGammaBox = new QDoubleSpinBox;
    exrGammaBox->setDecimals(1);
    exrGammaBox->setRange(1.0, 2.6);
    exrGammaBox->setValue(DEFAULT_GAMMA);
    exrGammaBox->setSingleStep(0.2);

    gammaLayout->addWidget(gammaLabel);

    gammaLayout->addWidget(exrGammaBox);

    // Buttons
    m_PBClose = new QPushButton("Close");


    connect(m_PBClose, SIGNAL(pressed()), this, SLOT(onClose()));
    
    // Left Vertical Layout:
    pVerticalLayout->addLayout(exposureLayout);
    pVerticalLayout->addLayout(defogLayout);
    pVerticalLayout->addLayout(klLayout);
    pVerticalLayout->addLayout(khLayout);
    pVerticalLayout->addLayout(gammaLayout);
    pVerticalLayout->addWidget(m_PBClose, 0, Qt::AlignCenter | Qt::AlignBottom);
    pVerticalLayout->setMargin(10);

    // Main Horizontal Layout:
    pMainLayout->addLayout(pVerticalLayout);
    pMainLayout->setMargin(0);

    // Activate:
    setLayout(pMainLayout);
}
Ejemplo n.º 12
0
Server::Server(QWidget *parent)
    : QDialog(parent)
    , statusLabel(new QLabel)
    , tcpServer(Q_NULLPTR)
    , networkSession(0)
    , blockSize(0)
    , linkCombo(new QComboBox)
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    statusLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);

    QNetworkConfigurationManager manager;
    if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
        // Get saved network configuration
        QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
        settings.beginGroup(QLatin1String("QtNetwork"));
        const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
        settings.endGroup();

        // If the saved network configuration is not currently discovered use the system default
        QNetworkConfiguration config = manager.configurationFromIdentifier(id);
        if ((config.state() & QNetworkConfiguration::Discovered) !=
            QNetworkConfiguration::Discovered) {
            config = manager.defaultConfiguration();
        }

        networkSession = new QNetworkSession(config, this);
        connect(networkSession, &QNetworkSession::opened, this, &Server::sessionOpened);

        statusLabel->setText(tr("Opening network session."));
        networkSession->open();
    } else {
        sessionOpened();
    }
//----------------------------------------------------------------------------------------------------------------
    QLabel *youTubeLinksLabel = new QLabel(tr("youTubeLinksLabel:"));
    youTubeLinksLabel->setBuddy(linkCombo);

    QPushButton *quitButton = new QPushButton(tr("Quit"));
    quitButton->setAutoDefault(false);

    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->addStretch(1);
    buttonLayout->addWidget(quitButton);
    buttonLayout->addStretch(1);
//----------------------------------------------------------------------------------------------------------------
    connect(quitButton, &QAbstractButton::clicked, this, &QWidget::close);
    connect(tcpServer, &QTcpServer::newConnection, this, &Server::storeLink);
//----------------------------------------------------------------------------------------------------------------

    QVBoxLayout *mainLayout = Q_NULLPTR;
    if (QGuiApplication::styleHints()->showIsFullScreen() || QGuiApplication::styleHints()->showIsMaximized()) {
        QVBoxLayout *outerVerticalLayout = new QVBoxLayout(this);
        outerVerticalLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
        QHBoxLayout *outerHorizontalLayout = new QHBoxLayout;
        outerHorizontalLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored));
        QGroupBox *groupBox = new QGroupBox(QGuiApplication::applicationDisplayName());
        mainLayout = new QVBoxLayout(groupBox);
        outerHorizontalLayout->addWidget(groupBox);
        outerHorizontalLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored));
        outerVerticalLayout->addLayout(outerHorizontalLayout);
        outerVerticalLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
    } else {
        mainLayout = new QVBoxLayout(this);
    }

    mainLayout->addWidget(statusLabel);
    mainLayout->addLayout(buttonLayout);

    mainLayout->addWidget(youTubeLinksLabel);
    mainLayout->addWidget(linkCombo);

    setWindowTitle(QGuiApplication::applicationDisplayName());
}
Ejemplo n.º 13
0
void DisplayOptionsDlg::CreateLayout()
{
    mGLDisabled = new QRadioButton( "Disabled" );
    mGLEnabled = new QRadioButton( "Enabled (uses OpenGL)" );
    mGLFull = new QRadioButton( "Full (uses OpenGL and video memory)" );

    QObject::connect( mGLDisabled, SIGNAL( clicked() ), this, SLOT( OnRendererSelected() ) );
    QObject::connect( mGLEnabled, SIGNAL( clicked() ), this, SLOT( OnRendererSelected() ) );
    QObject::connect( mGLFull, SIGNAL( clicked() ), this, SLOT( OnRendererSelected() ) );

    mRenderer = new QLabel( "" );
    mRendererVersion = new QLabel( "" );
    mVSyncCheck = new QCheckBox( "Vertical synchronization" );

    QVBoxLayout *lOpenGLLayout = new QVBoxLayout;
    lOpenGLLayout->addWidget( mGLDisabled );
    lOpenGLLayout->addWidget( mGLEnabled );
    lOpenGLLayout->addWidget( mGLFull );
    lOpenGLLayout->addSpacing( 5 );
    lOpenGLLayout->addWidget( mRenderer );
    lOpenGLLayout->addWidget( mRendererVersion );
    lOpenGLLayout->addSpacing( 5 );
    lOpenGLLayout->addWidget( mVSyncCheck );
    QGroupBox *lOpenGL = new QGroupBox( "Hardware acceleration" );
    lOpenGL->setLayout( lOpenGLLayout );

    mFPSDisabled = new QRadioButton( "Display disabled" );
    mFPS10 = new QRadioButton( "10 frames per second" );
    mFPS30 = new QRadioButton( "30 frames per second" );
    mFPS60 = new QRadioButton( "60 frames per second" );

    QVBoxLayout *lFPSLayout = new QVBoxLayout;
    lFPSLayout->addWidget( mFPSDisabled );
    lFPSLayout->addWidget( mFPS10 );
    lFPSLayout->addWidget( mFPS30 );
    lFPSLayout->addWidget( mFPS60 );
    QGroupBox *lFPS = new QGroupBox( "Maximum display frame rate" );
    lFPS->setLayout( lFPSLayout );

    QVBoxLayout *lAdditionalOptionsLayout = new QVBoxLayout;
    QGroupBox *lAdditionalOptionsGroup = new QGroupBox( "Additional options" );
    mKeepPartialImages = new QCheckBox( "Keep partial images" );
    lAdditionalOptionsLayout->addWidget( mKeepPartialImages );
    mDisplayChunkData = new QCheckBox( "Display chunk data" );
    lAdditionalOptionsLayout->addWidget( mDisplayChunkData );
    lAdditionalOptionsGroup->setLayout( lAdditionalOptionsLayout );

    QHBoxLayout *lButtons = new QHBoxLayout;
    mOKButton = new QPushButton( tr( "OK" ) );
    mCancelButton = new QPushButton( tr( "Cancel" ) );
    lButtons->addStretch();
    lButtons->addWidget( mOKButton );
    lButtons->addWidget( mCancelButton );

    QObject::connect( mOKButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
    QObject::connect( mCancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );

    QVBoxLayout *lMain = new QVBoxLayout;
    lMain->addWidget( lOpenGL );
    lMain->addWidget( lFPS );
    lMain->addWidget( lAdditionalOptionsGroup );
    lMain->addStretch();
    lMain->addLayout( lButtons );

    setLayout( lMain );
    setFixedSize( 400, 480 );

    Qt::WindowFlags lFlags = windowFlags();
    lFlags |= Qt::CustomizeWindowHint;
    lFlags &= ~Qt::WindowContextHelpButtonHint;
    lFlags &= ~Qt::WindowSystemMenuHint;

    lFlags |= Qt::WindowStaysOnTopHint;
    setWindowFlags( lFlags );

    setWindowTitle( tr( "Display Options" ) );

    // Set the defaults appropriately
    mFPS30->setChecked( true );

    PvRendererMode lSupported = PvDisplayWnd::GetHighestRendererMode();

    // Hardware acceleration
    mGLDisabled->setEnabled( lSupported >= PvRendererModeDefault );
    mGLEnabled->setEnabled( lSupported >= PvRendererModeAccelerated );
    mGLFull->setEnabled( lSupported >= PvRendererModeHardwareAccelerated );
    mRenderer->setText( QString( "Renderer: " ) + PvDisplayWnd::GetRenderer().GetAscii() );
    mRendererVersion->setText( QString( "Version: " ) + PvDisplayWnd::GetRendererVersion().GetAscii() );

    mGLDisabled->setChecked( true );
    mVSyncCheck->setChecked( false ); // VSync not supported for Non-OpenGL
    mVSyncCheck->setDisabled( true );
}
Ejemplo n.º 14
0
FileBrowserDialog::FileBrowserDialog(const ServerRepo& repo, QWidget *parent)
    : QDialog(parent),
      repo_(repo)
{
    current_path_ = "/";
    // since root is special, the next step is unnecessary
    // current_lpath_.push_back("");

    const Account& account = seafApplet->accountManager()->currentAccount();
    data_mgr_ = new DataManager(account);

    setWindowTitle(tr("Cloud File Browser"));
    setWindowIcon(QIcon(":/images/seafile.png"));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint & ~Qt::Dialog
                   | Qt::WindowMinimizeButtonHint | Qt::Window);

    createToolBar();
    createStatusBar();
    createLoadingFailedView();
    createFileTable();

    QVBoxLayout *vlayout = new QVBoxLayout;
    vlayout->setContentsMargins(0, 6, 0, 0);
    vlayout->setSpacing(0);
    setLayout(vlayout);

    stack_ = new QStackedWidget;
    stack_->insertWidget(INDEX_LOADING_VIEW, loading_view_);
    stack_->insertWidget(INDEX_TABLE_VIEW, table_view_);
    stack_->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_);

    vlayout->addWidget(toolbar_);
    vlayout->addWidget(stack_);
    vlayout->addWidget(status_bar_);

    // this <--> table_view_
    connect(table_view_, SIGNAL(direntClicked(const SeafDirent&)),
            this, SLOT(onDirentClicked(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntRename(const SeafDirent&)),
            this, SLOT(onGetDirentRename(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntRemove(const SeafDirent&)),
            this, SLOT(onGetDirentRemove(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntRemove(const QList<const SeafDirent*> &)),
            this, SLOT(onGetDirentRemove(const QList<const SeafDirent*> &)));
    connect(table_view_, SIGNAL(direntShare(const SeafDirent&)),
            this, SLOT(onGetDirentShare(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntUpdate(const SeafDirent&)),
            this, SLOT(onGetDirentUpdate(const SeafDirent&)));
    connect(table_view_, SIGNAL(cancelDownload(const SeafDirent&)),
            this, SLOT(onCancelDownload(const SeafDirent&)));

    //dirents <--> data_mgr_
    connect(data_mgr_, SIGNAL(getDirentsSuccess(const QList<SeafDirent>&)),
            this, SLOT(onGetDirentsSuccess(const QList<SeafDirent>&)));
    connect(data_mgr_, SIGNAL(getDirentsFailed(const ApiError&)),
            this, SLOT(onGetDirentsFailed(const ApiError&)));

    //create <--> data_mgr_
    connect(data_mgr_, SIGNAL(createDirectorySuccess(const QString&)),
            this, SLOT(onDirectoryCreateSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(createDirectoryFailed(const ApiError&)),
            this, SLOT(onDirectoryCreateFailed(const ApiError&)));

    //rename <--> data_mgr_
    connect(data_mgr_, SIGNAL(renameDirentSuccess(const QString&, const QString&)),
            this, SLOT(onDirentRenameSuccess(const QString&, const QString&)));
    connect(data_mgr_, SIGNAL(renameDirentFailed(const ApiError&)),
            this, SLOT(onDirentRenameFailed(const ApiError&)));

    //remove <--> data_mgr_
    connect(data_mgr_, SIGNAL(removeDirentSuccess(const QString&)),
            this, SLOT(onDirentRemoveSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(removeDirentFailed(const ApiError&)),
            this, SLOT(onDirentRemoveFailed(const ApiError&)));

    //share <--> data_mgr_
    connect(data_mgr_, SIGNAL(shareDirentSuccess(const QString&)),
            this, SLOT(onDirentShareSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(shareDirentFailed(const ApiError&)),
            this, SLOT(onDirentShareFailed(const ApiError&)));

    connect(AutoUpdateManager::instance(), SIGNAL(fileUpdated(const QString&, const QString&)),
            this, SLOT(onFileAutoUpdated(const QString&, const QString&)));

    QTimer::singleShot(0, this, SLOT(fetchDirents()));
}
Ejemplo n.º 15
0
ZoomWidget::ZoomWidget(QWidget *parent, DatasetLoadWidget * datasetLoadWidget)
        : DialogVisibilityNotify(ZOOM_WIDGET, parent), lastZoomSkel(0), userZoomSkel(true) {
    setWindowIcon(QIcon(":/resources/icons/zoom.png"));
    setWindowTitle("Zoom");

    // zoom section
    skeletonViewportSpinBox.setRange(SKELZOOMMIN * 100, SKELZOOMMAX * 100);
    skeletonViewportSpinBox.setSuffix(" %");
    zoomDefaultsButton.setAutoDefault(false);

    orthoZoomSpinBox.setSuffix("%");
    orthoZoomSpinBox.setKeyboardTracking(false);
    orthoZoomSpinBox.setMinimum(1.);
    orthoZoomSpinBox.setSingleStep(100.);
    orthoZoomSlider.setOrientation(Qt::Horizontal);
    orthoZoomSlider.setSingleStep(1.);

    int row = 0;
    zoomLayout.addWidget(&orthogonalDataViewportLabel, row, 0);
    zoomLayout.addWidget(&orthoZoomSpinBox, row++, 1);
    zoomLayout.addWidget(&orthoZoomSlider, row++, 0, 1, 2);
    zoomLayout.addWidget(&skeletonViewportLabel, row, 0);
    zoomLayout.addWidget(&skeletonViewportSpinBox, row++, 1);
    zoomLayout.addWidget(&zoomDefaultsButton, row, 0, 1, 1, Qt::AlignLeft);

    currentActiveMagDatasetLabel.setText(tr("Currently active mag dataset: %1").arg(state->magnification));
    highestActiveMagDatasetLabel.setText(tr("Highest available mag dataset: %1").arg(state->highestAvailableMag));
    lowestActiveMagDatasetLabel.setText(tr("Lowest available mag dataset: %1").arg(state->lowestAvailableMag));

    separator.setFrameShape(QFrame::HLine);
    separator.setFrameShadow(QFrame::Sunken);
    mainLayout.addLayout(&zoomLayout);
    mainLayout.addWidget(&multiresSectionLabel);
    mainLayout.addWidget(&separator);
    mainLayout.addWidget(&lockDatasetCheckBox);
    mainLayout.addWidget(&currentActiveMagDatasetLabel);
    mainLayout.addWidget(&highestActiveMagDatasetLabel);
    mainLayout.addWidget(&lowestActiveMagDatasetLabel);
    setLayout(&mainLayout);

    connect(&orthoZoomSlider, &QSlider::valueChanged, [this](const int value) {
        const float newScreenPxXPerDataPx = state->viewer->lowestScreenPxXPerDataPx() * std::pow(zoomStep, value);
        const float prevFOV = state->viewer->viewportXY->texture.FOV;
        float newFOV = state->viewer->viewportXY->screenPxXPerDataPxForZoomFactor(1.f) / newScreenPxXPerDataPx;

        if (state->viewerState->datasetMagLock == false) {
            if (prevFOV == VPZOOMMIN && static_cast<uint>(state->magnification) < state->viewer->highestMag() && prevFOV < newFOV) {
               state->viewer->updateDatasetMag(state->magnification * 2);
               newFOV = 0.5;
            }
            else if(prevFOV == 0.5 && static_cast<uint>(state->magnification) > state->viewer->lowestMag() && prevFOV > newFOV) {
                state->viewer->updateDatasetMag(state->magnification / 2);
                newFOV = VPZOOMMIN;
            } else {
                const float zoomMax = static_cast<float>(state->magnification) == state->lowestAvailableMag ? VPZOOMMAX : 0.5;
                newFOV = std::max(std::min(newFOV, static_cast<float>(VPZOOMMIN)), zoomMax);
            }
        }
        state->viewer->window->forEachOrthoVPDo([&newFOV](ViewportOrtho & orthoVP) {
            orthoVP.texture.FOV = newFOV;
        });
        state->viewer->recalcTextureOffsets();
        updateOrthogonalZoomSpinBox();
        updateOrthogonalZoomSlider();
    });

    connect(&orthoZoomSpinBox, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [this](const double value) {
        const float newScreenPxXPerDataPx = (value / 100.) * state->viewer->lowestScreenPxXPerDataPx(false);
        if (!state->viewerState->datasetMagLock) {
            const uint newMag = state->viewer->calcMag(newScreenPxXPerDataPx);
            if (newMag != static_cast<uint>(state->magnification)) {
                state->viewer->updateDatasetMag(newMag);
            }
        }

        float newFOV = state->viewer->viewportXY->screenPxXPerDataPxForZoomFactor(1.f) / newScreenPxXPerDataPx;

        state->viewer->window->forEachOrthoVPDo([&newFOV](ViewportOrtho & orthoVP) {
            orthoVP.texture.FOV = newFOV;
        });
        state->viewer->recalcTextureOffsets();
        orthoZoomSpinBox.blockSignals(true);
        orthoZoomSpinBox.setValue(100 * (newScreenPxXPerDataPx / state->viewer->lowestScreenPxXPerDataPx(false)));
        orthoZoomSpinBox.blockSignals(false);
        updateOrthogonalZoomSlider();
    });

    connect(&orthoZoomSlider, &QSlider::actionTriggered, [this](const int) {
        const int currSliderPos = orthoZoomSlider.sliderPosition();

        if (state->viewerState->datasetMagLock) {
            return;
        }

        int tickDistance = currSliderPos % orthoZoomSlider.tickInterval();
        const int snapDistance = 5;
        if (0 < tickDistance && tickDistance <= snapDistance) { // close over the next tick
            int newPos = currSliderPos - tickDistance;
            if (newPos <= (orthoZoomSlider.numTicks - 1) * orthoZoomSlider.tickInterval()) {
                orthoZoomSlider.setSliderPosition(newPos);
            }
        }
        else { // possibly close below the next tick
            int tickDistance = (orthoZoomSlider.sliderPosition() + snapDistance) % orthoZoomSlider.tickInterval();
            int newPos = (0 < tickDistance && tickDistance <= snapDistance) ? currSliderPos + snapDistance - tickDistance : currSliderPos;
            if (newPos <= (orthoZoomSlider.numTicks - 1) * orthoZoomSlider.tickInterval()) {
                orthoZoomSlider.setSliderPosition(newPos);
            }
        }
    });

    connect(&skeletonViewportSpinBox, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [this](const double value) {
        if(userZoomSkel) {
            userZoomSkel = false;
            if ( ((value > lastZoomSkel && value < lastZoomSkel + 2)
                    || (value < lastZoomSkel && value > lastZoomSkel - 2)) == false) {
                // difference at least greater than two,
                // so user entered a number instead of clicking the up and down buttons
                state->mainWindow->viewport3D->zoomFactor = value/100;
            }
            else { // up or down button pressed, find out which.
                if(value > lastZoomSkel && value < lastZoomSkel + 2) { // user wants to zoom in
                    state->viewer->window->viewport3D->zoomIn();
                }
                else if(value < lastZoomSkel && value > lastZoomSkel - 2) { // user wants to zoom out
                    state->viewer->window->viewport3D->zoomOut();
                }
                // the following line will lead to signal emission and another call to this slot,
                // but since userZoomSkel was set to false above, no further recursion takes place.
                skeletonViewportSpinBox.setValue(100 * state->mainWindow->viewport3D->zoomFactor);
            }
            lastZoomSkel = skeletonViewportSpinBox.value();
            userZoomSkel = true;
        }
    });

    connect(&zoomDefaultsButton, &QPushButton::clicked, this, &ZoomWidget::zoomDefaultsClicked);

    connect(&lockDatasetCheckBox, &QCheckBox::toggled, [this] (const bool on) {
        state->viewer->setMagnificationLock(on);
    });
    connect(state->viewer, &Viewer::magnificationLockChanged, [this](const bool locked){
        const auto signalsBlocked = lockDatasetCheckBox.blockSignals(true);
        lockDatasetCheckBox.setChecked(locked);
        lockDatasetCheckBox.blockSignals(signalsBlocked);
        reinitializeOrthoZoomWidgets();
    });
    connect(datasetLoadWidget, &DatasetLoadWidget::datasetChanged, this, &ZoomWidget::reinitializeOrthoZoomWidgets);

    setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
}
Ejemplo n.º 16
0
CamlDevWindow::CamlDevWindow(QString wd, QWidget *parent) :
QMainWindow(parent)
{
   
   this->camlProcess = new QProcess(this);
   this->camlStarted = false;
   this->currentFile = "";
   this->cwd = wd;
   this->unsavedChanges = false;
   this->programTitle = "LemonCaml";
   /* The window title and icon */
   this->setWindowTitle(this->programTitle + " - " + "untitled");
   this->setWindowIcon(QIcon(":/progicon.png"));
   
   this->settings = new QSettings("Cocodidou", "LemonCaml");
   this->globalSettings = new QSettings(QSettings::SystemScope, "Cocodidou", "LemonCaml");
   
   /* The main window elements : two text-areas and a splitter */
   this->centralBox = new QVBoxLayout();
   this->split = new QSplitter(Qt::Horizontal,this);
   
   this->inputZone = new InputZone();
   this->inputZone->setTabStopWidth(20);
   this->inputZone->setAcceptRichText(false);
   
   this->resize(settings->value("Size/y",800).toInt(), settings->value("Size/x",600).toInt());
   this->move(settings->value("Pos/x",0).toInt(), settings->value("Pos/y",0).toInt());
   this->setWindowFlags( (windowFlags() | Qt::CustomizeWindowHint));
   
#ifndef WIN32
   QString defaultFont = "Andale Mono,10,-1,5,50,0,0,0,0,0";
#else
   QString defaultFont = "Courier New,10,-1,5,50,0,0,0,0,0";
#endif
   
   QString iFont = settings->value("Input/Font", defaultFont).toString();
   QFont inputFont;
   inputFont.fromString(iFont);
   this->inputZone->setFont(inputFont);
   
   this->outputZone = new QTextEdit(this);
   this->outputZone->setReadOnly(true);
   this->outputZone->setTabStopWidth(20);
   
   QString kwfileloc = settings->value("General/keywordspath", (globalSettings->value("General/keywordspath", "./keywords").toString())).toString();
   
   QFile kwfile(kwfileloc);
   QStringList kwds;
   
   if(kwfile.open(QIODevice::ReadOnly | QIODevice::Text))
   {
      QTextStream kstream(&kwfile);
      QString st = kstream.readLine(256);
      while(st != "")
      {
         kwds << st;
         st = kstream.readLine(256);
      }
      kwfile.close();
   }
   else
   {
      QMessageBox::warning(this, tr("Warning"), tr("Unable to open the keywords file. There will likely be no syntax highlighting."));
   }
   this->hilit = new highlighter(inputZone->document(), &kwds, this->settings);
   bool isHighlighting = (settings->value("Input/syntaxHighlight",1).toInt() == 1);
   
   if(!isHighlighting)
   {
      this->hilit->setDocument(NULL);
   }


   
   QString oFont = settings->value("Output/Font", defaultFont).toString();
   QFont outputFont;
   outputFont.fromString(oFont);
   this->outputZone->setFont(outputFont);
   

   
   /* Find/Replace */
   
   this->find = new findReplace(inputZone, hilit);
   split->addWidget(this->inputZone);
   split->addWidget(this->outputZone);
   split->showMaximized();
   
   centralBox->addWidget(split);
   centralBox->addWidget(find);
   if(!centralBox->setStretchFactor(split, 100))
      qDebug() << "There will be a problem with Find/replace!";

   centralBox->setContentsMargins(0,0,0,0);
   
   /* a wrapper widget */
   QWidget *window = new QWidget();
   window->setLayout(centralBox);
   window->setContentsMargins(0,0,0,0);

   
   this->setCentralWidget(window);
   
   find->setVisible(false);
   
   if(settings->value("Input/indentOnFly",0).toInt() == 1)
      inputZone->setHandleEnter(true);
   
   /* the printer*/
   this->printer = new QPrinter(QPrinter::HighResolution);
   
   /* The actions */
   this->actionNew = new QAction(tr("New"),this);
   this->actionNew->setIcon(QIcon(":/new.png"));
   this->actionNew->setShortcut(QKeySequence(QKeySequence::New));
   this->actionOpen = new QAction(tr("Open"),this);
   this->actionOpen->setIcon(QIcon(":/open.png"));
   this->actionOpen->setShortcut(QKeySequence(QKeySequence::Open));
   this->actionSaveAs = new QAction(tr("Save As"),this);
   this->actionSaveAs->setIcon(QIcon(":/saveas.png"));
   this->actionSaveAs->setShortcut(QKeySequence(QKeySequence::SaveAs));
   this->actionSave = new QAction(tr("Save"),this);
   this->actionSave->setIcon(QIcon(":/save.png"));
   this->actionSave->setShortcut(QKeySequence(QKeySequence::Save));
   this->actionAutoIndent = new QAction(tr("Indent code"),this);
   this->actionAutoIndent->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W));
   this->actionFollowCursor = new QAction(tr("Indent code while typing"),this);
   this->actionFollowCursor->setCheckable(true);
   this->actionFollowCursor->setChecked(inputZone->getHandleEnter());
   this->actionFollowCursor->setIcon(QIcon(":/autoindent.png"));
   this->actionPrint = new QAction(tr("Print"),this);
   this->actionPrint->setIcon(QIcon(":/print.png"));
   this->actionPrint->setShortcut(QKeySequence(QKeySequence::Print));
   this->actionClearOutput = new QAction(tr("Clear output"),this);
   this->actionQuit = new QAction(tr("Quit"),this);
   this->actionQuit->setIcon(QIcon(":/exit.png"));
   this->actionQuit->setShortcut(QKeySequence(QKeySequence::Quit));
   
   this->actionUndo = new QAction(tr("Undo"),this);
   this->actionUndo->setIcon(QIcon(":/undo.png"));
   this->actionUndo->setShortcut(QKeySequence(QKeySequence::Undo));
   this->actionRedo = new QAction(tr("Redo"),this);
   this->actionRedo->setIcon(QIcon(":/redo.png"));
   this->actionRedo->setShortcut(QKeySequence(QKeySequence::Redo));
   this->actionDelete = new QAction(tr("Delete"),this);
   this->actionChangeInputFont = new QAction(tr("Change Input Font"),this);
   this->actionChangeOutputFont = new QAction(tr("Change Output Font"),this);
   
   this->actionSendCaml = new QAction(tr("Send Code to Caml"),this);
   this->actionSendCaml->setIcon(QIcon(":/sendcaml.png"));
   this->actionSendCaml->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return));
   this->actionInterruptCaml = new QAction(tr("Interrupt Caml"),this);
   this->actionInterruptCaml->setIcon(QIcon(":/interrupt.png"));
   this->actionStopCaml = new QAction(tr("Stop Caml"),this);
   this->actionStopCaml->setIcon(QIcon(":/stopcaml.png"));
   this->actionShowSettings = new QAction(tr("Settings"),this);
   this->actionShowSettings->setShortcut(QKeySequence(QKeySequence::Preferences));
   
   this->actionAbout = new QAction(tr("About LemonCaml..."),this);
   this->actionAboutQt = new QAction(tr("About Qt..."),this);
   
   this->actionHighlightEnable = new QAction(tr("Enable syntax highlighting"), this);
   this->actionHighlightEnable->setIcon(QIcon(":/highlight.png"));
   this->actionHighlightEnable->setCheckable(true);
   this->actionHighlightEnable->setChecked(isHighlighting);
   
   this->actionZoomIn = new QAction(tr("Zoom in"), this);
   this->actionZoomIn->setShortcut(QKeySequence(QKeySequence::ZoomIn));
   this->actionZoomOut = new QAction(tr("Zoom out"), this);
   this->actionZoomOut->setShortcut(QKeySequence(QKeySequence::ZoomOut));
   this->actionFind = new QAction(tr("Find/Replace..."), this);
   this->actionFind->setShortcut(QKeySequence(QKeySequence::Find));
   this->actionFind->setIcon(QIcon(":/find.png"));
   this->actionFind->setCheckable(true);
   this->actionFind->setChecked(false);
   
   /* The toolbar */
   this->toolbar = new QToolBar(tr("Tools"),this);
   this->toolbar->addAction(actionNew);
   this->toolbar->addAction(actionOpen);
   this->toolbar->addAction(actionSave);
   this->toolbar->addAction(actionSaveAs);
   this->toolbar->addAction(actionPrint);
   this->toolbar->addSeparator();
   this->toolbar->addAction(actionUndo);
   this->toolbar->addAction(actionRedo);
   this->toolbar->addSeparator();
   this->toolbar->addAction(actionSendCaml);
   this->toolbar->addAction(actionInterruptCaml);
   this->toolbar->addAction(actionStopCaml);
   this->toolbar->addAction(actionHighlightEnable);
   this->toolbar->addAction(actionFollowCursor);
   this->addToolBar(this->toolbar);
   
   /* The menubar */
   this->menuFile = this->menuBar()->addMenu(tr("File"));
   this->menuFile->addAction(actionNew);
   this->menuFile->addAction(actionOpen);
   this->menuRecent = this->menuFile->addMenu(tr("Recent files"));
   this->menuFile->addAction(actionSave);
   this->menuFile->addAction(actionSaveAs);
   this->menuFile->addAction(actionPrint);
   this->menuFile->addAction(actionQuit);
   
   this->menuEdit = this->menuBar()->addMenu(tr("Edit"));
   this->menuEdit->addAction(actionUndo);
   this->menuEdit->addAction(actionRedo);
   this->menuEdit->addAction(actionDelete);
   this->menuEdit->addSeparator();
   this->menuEdit->addAction(actionAutoIndent);
   this->menuEdit->addAction(actionFollowCursor);
   this->menuEdit->addSeparator();
   this->menuEdit->addAction(actionFind);
   this->menuEdit->addAction(actionClearOutput);
   this->menuEdit->addAction(actionHighlightEnable);
   this->menuEdit->addAction(actionChangeInputFont);
   this->menuEdit->addAction(actionChangeOutputFont);
   this->menuEdit->addAction(actionZoomIn);
   this->menuEdit->addAction(actionZoomOut);
   
   this->menuCaml = this->menuBar()->addMenu(tr("Caml"));
   this->menuCaml->addAction(actionSendCaml);
   this->menuCaml->addAction(actionInterruptCaml);
   this->menuCaml->addAction(actionStopCaml);
   this->menuCaml->addAction(actionShowSettings);
   
   this->menuHelp = this->menuBar()->addMenu(tr("Help"));
   this->menuHelp->addAction(actionAbout);
   this->menuHelp->addAction(actionAboutQt);
   

   
   /* Connections */
   connect(inputZone,SIGNAL(returnPressed()),this,SLOT(handleLineBreak()));
   
   connect(actionSendCaml,SIGNAL(triggered()),this,SLOT(sendCaml()));
   connect(camlProcess,SIGNAL(readyReadStandardOutput()),this,SLOT(readCaml()));
   connect(camlProcess,SIGNAL(readyReadStandardError()),this,SLOT(readCamlErrors()));
   connect(camlProcess,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(updateCamlStatus(QProcess::ProcessState)));
   connect(actionStopCaml,SIGNAL(triggered()),this,SLOT(stopCaml()));
   connect(camlProcess,SIGNAL(started()),this,SLOT(camlOK()));
   connect(actionInterruptCaml,SIGNAL(triggered()),this,SLOT(interruptCaml()));
   
   
   connect(actionSave,SIGNAL(triggered()),this,SLOT(save()));
   connect(actionSaveAs,SIGNAL(triggered()),this,SLOT(saveAs()));
   connect(actionOpen,SIGNAL(triggered()),this,SLOT(open()));
   connect(inputZone,SIGNAL(textChanged()),this,SLOT(textChanged()));
   connect(actionNew,SIGNAL(triggered()),this,SLOT(newFile()));
   connect(actionClearOutput,SIGNAL(triggered()),this->outputZone,SLOT(clear()));
   connect(actionChangeInputFont,SIGNAL(triggered()),this,SLOT(changeInputFont()));
   connect(actionChangeOutputFont,SIGNAL(triggered()),this,SLOT(changeOutputFont()));
   connect(actionQuit,SIGNAL(triggered()),this,SLOT(close()));
   connect(actionPrint,SIGNAL(triggered()),this,SLOT(print()));
   connect(actionUndo,SIGNAL(triggered()),this->inputZone,SLOT(undo()));
   connect(actionRedo,SIGNAL(triggered()),this->inputZone,SLOT(redo()));
   connect(actionDelete,SIGNAL(triggered()),this->inputZone,SLOT(paste()));
   connect(actionShowSettings,SIGNAL(triggered()),this,SLOT(showSettings()));
   connect(actionHighlightEnable,SIGNAL(toggled(bool)),this,SLOT(toggleHighlightOn(bool)));
   connect(actionAutoIndent,SIGNAL(triggered()),this,SLOT(autoIndentCode()));
   connect(actionFollowCursor,SIGNAL(triggered(bool)),this,SLOT(toggleAutoIndentOn(bool)));
   
   connect(actionZoomIn,SIGNAL(triggered()),this,SLOT(zoomIn()));
   connect(actionZoomOut,SIGNAL(triggered()),this,SLOT(zoomOut()));
   connect(actionFind,SIGNAL(triggered(bool)),this,SLOT(triggerFindReplace(bool)));
   connect(find,SIGNAL(hideRequest(bool)),this,SLOT(triggerFindReplace(bool)));
   
   connect(inputZone, SIGNAL(unindentKeyStrokePressed()), this, SLOT(unindent()));
   
   connect(actionAbout,SIGNAL(triggered()),this,SLOT(about()));
   connect(actionAboutQt,SIGNAL(triggered()),this,SLOT(aboutQt()));
   
   this->generateRecentMenu();
   this->populateRecent();
   
   this->highlightTriggered = false;
   fillIndentWords(&indentWords);
   
   //Draw trees?
   this->drawTrees = (settings->value("General/drawTrees",0).toInt() == 1)?true:false;
   this->graphCount = 0;
   
   this->startCamlProcess();
}
Ejemplo n.º 17
0
LogBrowser::LogBrowser(QWidget *parent) :
    QDialog(parent),
    _logWidget( new LogWidget(parent) )
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    setObjectName("LogBrowser"); // for save/restoreGeometry()
    setWindowTitle(tr("Log Output"));
    setMinimumWidth(600);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    // mainLayout->setMargin(0);

    mainLayout->addWidget( _logWidget );

    QHBoxLayout *toolLayout = new QHBoxLayout;
    mainLayout->addLayout( toolLayout );

    // Search input field
    QLabel *lab = new QLabel(tr("&Search: "));
    _findTermEdit = new QLineEdit;
    lab->setBuddy( _findTermEdit );
    toolLayout->addWidget(lab);
    toolLayout->addWidget( _findTermEdit );

    // find button
    QPushButton *findBtn = new QPushButton;
    findBtn->setText( tr("&Find") );
    connect( findBtn, SIGNAL(clicked()), this, SLOT(slotFind()));
    toolLayout->addWidget( findBtn );

    // stretch
    toolLayout->addStretch(1);
    _statusLabel = new QLabel;
    toolLayout->addWidget( _statusLabel );
    toolLayout->addStretch(5);

    QDialogButtonBox *btnbox = new QDialogButtonBox;
    QPushButton *closeBtn = btnbox->addButton( QDialogButtonBox::Close );
    connect(closeBtn,SIGNAL(clicked()),this,SLOT(close()));

    mainLayout->addWidget( btnbox );

    // clear button
    _clearBtn = new QPushButton;
    _clearBtn->setText( tr("Clear") );
    _clearBtn->setToolTip( tr("Clear the log display.") );
    btnbox->addButton(_clearBtn, QDialogButtonBox::ActionRole);
    connect( _clearBtn, SIGNAL(clicked()), this, SLOT(slotClearLog()));

    // save Button
    _saveBtn = new QPushButton;
    _saveBtn->setText( tr("S&ave") );
    _saveBtn->setToolTip(tr("Save the log file to a file on disk for debugging."));
    btnbox->addButton(_saveBtn, QDialogButtonBox::ActionRole);
    connect( _saveBtn, SIGNAL(clicked()),this, SLOT(slotSave()));

    setLayout( mainLayout );

    setModal(false);

    // Direct connection for log comming from this thread, and queued for the one in a different thread
    connect(Logger::instance(), SIGNAL(newLog(QString)),this,SLOT(slotNewLog(QString)), Qt::AutoConnection);

    QAction *showLogWindow = new QAction(this);
    showLogWindow->setShortcut(QKeySequence("F12"));
    connect(showLogWindow, SIGNAL(triggered()), SLOT(close()));
    addAction(showLogWindow);

    MirallConfigFile cfg;
    cfg.restoreGeometry(this);
    int lines = cfg.maxLogLines();
    // qDebug() << "#        ##  Have " << lines << " Loglines!";
    _logWidget->document()->setMaximumBlockCount( lines );

}
AutoConfig::AutoConfig(QWidget *parent)
	: QWizard(parent)
{
	EnableThreadedMessageBoxes(true);

	calldata_t cd = {0};
	calldata_set_int(&cd, "seconds", 5);

	proc_handler_t *ph = obs_get_proc_handler();
	proc_handler_call(ph, "twitch_ingests_refresh", &cd);
	calldata_free(&cd);

	OBSBasic *main = reinterpret_cast<OBSBasic*>(parent);
	main->EnableOutputs(false);

	installEventFilter(CreateShortcutFilter());

	std::string serviceType;
	GetServiceInfo(serviceType, serviceName, server, key);
#ifdef _WIN32
	setWizardStyle(QWizard::ModernStyle);
#endif
	streamPage = new AutoConfigStreamPage();

	setPage(StartPage, new AutoConfigStartPage());
	setPage(VideoPage, new AutoConfigVideoPage());
	setPage(StreamPage, streamPage);
	setPage(TestPage, new AutoConfigTestPage());
	setWindowTitle(QTStr("Basic.AutoConfig"));
	setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

	obs_video_info ovi;
	obs_get_video_info(&ovi);

	baseResolutionCX = ovi.base_width;
	baseResolutionCY = ovi.base_height;

	/* ----------------------------------------- */
	/* check to see if Twitch's "auto" available */

	OBSData twitchSettings = obs_data_create();
	obs_data_release(twitchSettings);

	obs_data_set_string(twitchSettings, "service", "Twitch");

	obs_properties_t *props = obs_get_service_properties("rtmp_common");
	obs_properties_apply_settings(props, twitchSettings);

	obs_property_t *p = obs_properties_get(props, "server");
	const char *first = obs_property_list_item_string(p, 0);
	twitchAuto = strcmp(first, "auto") == 0;

	obs_properties_destroy(props);

	/* ----------------------------------------- */
	/* load service/servers                      */

	customServer = serviceType == "rtmp_custom";

	QComboBox *serviceList = streamPage->ui->service;

	if (!serviceName.empty()) {
		serviceList->blockSignals(true);

		int count = serviceList->count();
		bool found = false;

		for (int i = 0; i < count; i++) {
			QString name = serviceList->itemText(i);

			if (name == serviceName.c_str()) {
				serviceList->setCurrentIndex(i);
				found = true;
				break;
			}
		}

		if (!found) {
			serviceList->insertItem(0, serviceName.c_str());
			serviceList->setCurrentIndex(0);
		}

		serviceList->blockSignals(false);
	}

	streamPage->UpdateServerList();
	streamPage->UpdateKeyLink();
	streamPage->lastService.clear();

	if (!customServer) {
		QComboBox *serverList = streamPage->ui->server;
		int idx = serverList->findData(QString(server.c_str()));
		if (idx == -1)
			idx = 0;

		serverList->setCurrentIndex(idx);
	} else {
		streamPage->ui->customServer->setText(server.c_str());
		int idx = streamPage->ui->service->findData(
				QVariant((int)ListOpt::Custom));
		streamPage->ui->service->setCurrentIndex(idx);
	}

	if (!key.empty())
		streamPage->ui->key->setText(key.c_str());

	int bitrate = config_get_int(main->Config(), "SimpleOutput", "VBitrate");
	streamPage->ui->bitrate->setValue(bitrate);
	streamPage->ServiceChanged();

	TestHardwareEncoding();
	if (!hardwareEncodingAvailable) {
		delete streamPage->ui->preferHardware;
		streamPage->ui->preferHardware = nullptr;
	} else {
		/* Newer generations of NVENC have a high enough quality to
		 * bitrate ratio that if NVENC is available, it makes sense to
		 * just always prefer hardware encoding by default */
		bool preferHardware = nvencAvailable ||
		                      os_get_physical_cores() <= 4;
		streamPage->ui->preferHardware->setChecked(preferHardware);
	}

	setOptions(0);
	setButtonText(QWizard::FinishButton,
			QTStr("Basic.AutoConfig.ApplySettings"));
	setButtonText(QWizard::BackButton, QTStr("Back"));
	setButtonText(QWizard::NextButton, QTStr("Next"));
	setButtonText(QWizard::CancelButton, QTStr("Cancel"));
}
Ejemplo n.º 19
0
void PinDialog::init( PinFlags flags, const QString &title, TokenData::TokenFlags token )
{
	setMinimumWidth( 350 );
	setWindowModality( Qt::ApplicationModal );

	QLabel *label = new QLabel( this );
	QVBoxLayout *l = new QVBoxLayout( this );
	l->addWidget( label );

	QString _title = title;
	QString text;

	if( token & TokenData::PinFinalTry )
		text += "<font color='red'><b>" + tr("PIN will be locked next failed attempt") + "</b></font><br />";
	else if( token & TokenData::PinCountLow )
		text += "<font color='red'><b>" + tr("PIN has been entered incorrectly one time") + "</b></font><br />";

	text += QString( "<b>%1</b><br />" ).arg( title );
	if( flags & Pin2Type )
	{
		_title = tr("Signing") + " - " + title;
		QString t = flags & PinpadFlag ?
			tr("For using sign certificate enter PIN2 at the reader") :
			tr("For using sign certificate enter PIN2");
		text += tr("Selected action requires sign certificate.") + "<br />" + t;
		regexp.setPattern( "\\d{5,12}" );
	}
	else
	{
		_title = tr("Authentication") + " - " + title;
		QString t = flags & PinpadFlag ?
			tr("For using authentication certificate enter PIN1 at the reader") :
			tr("For using authentication certificate enter PIN1");
		text += tr("Selected action requires authentication certificate.") + "<br />" + t;
		regexp.setPattern( "\\d{4,12}" );
	}
	setWindowTitle( _title );
	label->setText( text );
	Common::setAccessibleName( label );

	if( flags & PinpadFlag )
	{
		setWindowFlags( (windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowCloseButtonHint );
		QProgressBar *progress = new QProgressBar( this );
		progress->setRange( 0, 30 );
		progress->setValue( progress->maximum() );
		progress->setTextVisible( false );
		l->addWidget( progress );
		QTimeLine *statusTimer = new QTimeLine( progress->maximum() * 1000, this );
		statusTimer->setCurveShape( QTimeLine::LinearCurve );
		statusTimer->setFrameRange( progress->maximum(), progress->minimum() );
		connect( statusTimer, SIGNAL(frameChanged(int)), progress, SLOT(setValue(int)) );
		connect( this, SIGNAL(startTimer()), statusTimer, SLOT(start()) );
	}
	else if( !(flags & PinpadNoProgressFlag) )
	{
		m_text = new QLineEdit( this );
		m_text->setEchoMode( QLineEdit::Password );
		m_text->setFocus();
		m_text->setValidator( new QRegExpValidator( regexp, m_text ) );
		connect( m_text, SIGNAL(textEdited(QString)), SLOT(textEdited(QString)) );
		l->addWidget( m_text );
		label->setBuddy( m_text );

		QDialogButtonBox *buttons = new QDialogButtonBox(
			QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal, this );
		ok = buttons->button( QDialogButtonBox::Ok );
		ok->setAutoDefault( true );
		connect( buttons, SIGNAL(accepted()), SLOT(accept()) );
		connect( buttons, SIGNAL(rejected()), SLOT(reject()) );
		l->addWidget( buttons );

		textEdited( QString() );
	}
}
Ejemplo n.º 20
0
memory_viewer_panel::memory_viewer_panel(QWidget* parent) 
	: QDialog(parent)
{
	setWindowTitle(tr("Memory Viewer"));
	setObjectName("memory_viewer");
	setAttribute(Qt::WA_DeleteOnClose);
	setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
	exit = false;
	m_addr = 0;
	m_colcount = 16;
	m_rowcount = 16;
	int pSize = 10;

	//Font
	QFont mono = QFontDatabase::systemFont(QFontDatabase::FixedFont);
	mono.setPointSize(pSize);
	m_fontMetrics = new QFontMetrics(mono);

	//Layout:
	QVBoxLayout* vbox_panel = new QVBoxLayout();

	//Tools
	QHBoxLayout* hbox_tools = new QHBoxLayout();

	//Tools: Memory Viewer Options
	QGroupBox* tools_mem = new QGroupBox(tr("Memory Viewer Options"));
	QHBoxLayout* hbox_tools_mem = new QHBoxLayout();

	//Tools: Memory Viewer Options: Address
	QGroupBox* tools_mem_addr = new QGroupBox(tr("Address"));
	QHBoxLayout* hbox_tools_mem_addr = new QHBoxLayout();
	m_addr_line = new QLineEdit(this);
	m_addr_line->setPlaceholderText("00000000");
	m_addr_line->setFont(mono);
	m_addr_line->setMaxLength(8);
	m_addr_line->setFixedWidth(75);
	m_addr_line->setFocus();
	hbox_tools_mem_addr->addWidget(m_addr_line);
	tools_mem_addr->setLayout(hbox_tools_mem_addr);

	//Tools: Memory Viewer Options: Bytes
	QGroupBox* tools_mem_bytes = new QGroupBox(tr("Bytes"));
	QHBoxLayout* hbox_tools_mem_bytes = new QHBoxLayout();
	QSpinBox* sb_bytes = new QSpinBox(this);
	sb_bytes->setRange(1, 16);
	sb_bytes->setValue(16);
	hbox_tools_mem_bytes->addWidget(sb_bytes);
	tools_mem_bytes->setLayout(hbox_tools_mem_bytes);

	//Tools: Memory Viewer Options: Control
	QGroupBox* tools_mem_buttons = new QGroupBox(tr("Control"));
	QHBoxLayout* hbox_tools_mem_buttons = new QHBoxLayout();
	QPushButton* b_fprev = new QPushButton("<<", this);
	QPushButton* b_prev = new QPushButton("<", this);
	QPushButton* b_next = new QPushButton(">", this);
	QPushButton* b_fnext = new QPushButton(">>", this);
	b_fprev->setFixedWidth(20);
	b_prev->setFixedWidth(20);
	b_next->setFixedWidth(20);
	b_fnext->setFixedWidth(20);
	b_fprev->setAutoDefault(false);
	b_prev->setAutoDefault(false);
	b_next->setAutoDefault(false);
	b_fnext->setAutoDefault(false);
	hbox_tools_mem_buttons->addWidget(b_fprev);
	hbox_tools_mem_buttons->addWidget(b_prev);
	hbox_tools_mem_buttons->addWidget(b_next);
	hbox_tools_mem_buttons->addWidget(b_fnext);
	tools_mem_buttons->setLayout(hbox_tools_mem_buttons);

	//Merge Tools: Memory Viewer
	hbox_tools_mem->addWidget(tools_mem_addr);
	hbox_tools_mem->addWidget(tools_mem_bytes);
	hbox_tools_mem->addWidget(tools_mem_buttons);
	tools_mem->setLayout(hbox_tools_mem);

	//Tools: Raw Image Preview Options
	QGroupBox* tools_img = new QGroupBox(tr("Raw Image Preview Options"));
	QHBoxLayout* hbox_tools_img = new QHBoxLayout();;

	//Tools: Raw Image Preview Options : Size
	QGroupBox* tools_img_size = new QGroupBox(tr("Size"));
	QHBoxLayout* hbox_tools_img_size = new QHBoxLayout();
	QLabel* l_x = new QLabel(" x ");
	QSpinBox* sb_img_size_x = new QSpinBox(this);
	QSpinBox* sb_img_size_y = new QSpinBox(this);
	sb_img_size_x->setRange(1, 8192);
	sb_img_size_y->setRange(1, 8192);
	sb_img_size_x->setValue(256);
	sb_img_size_y->setValue(256);
	hbox_tools_img_size->addWidget(sb_img_size_x);
	hbox_tools_img_size->addWidget(l_x);
	hbox_tools_img_size->addWidget(sb_img_size_y);
	tools_img_size->setLayout(hbox_tools_img_size);

	//Tools: Raw Image Preview Options: Mode
	QGroupBox* tools_img_mode = new QGroupBox(tr("Mode"));
	QHBoxLayout* hbox_tools_img_mode = new QHBoxLayout();
	QComboBox* cbox_img_mode = new QComboBox(this);
	cbox_img_mode->addItem("RGB");
	cbox_img_mode->addItem("ARGB");
	cbox_img_mode->addItem("RGBA");
	cbox_img_mode->addItem("ABGR");
	cbox_img_mode->setCurrentIndex(1); //ARGB
	hbox_tools_img_mode->addWidget(cbox_img_mode);
	tools_img_mode->setLayout(hbox_tools_img_mode);

	//Merge Tools: Raw Image Preview Options
	hbox_tools_img->addWidget(tools_img_size);
	hbox_tools_img->addWidget(tools_img_mode);
	tools_img->setLayout(hbox_tools_img);

	//Tools: Tool Buttons
	QGroupBox* tools_buttons = new QGroupBox(tr("Tools"));
	QVBoxLayout* hbox_tools_buttons = new QVBoxLayout(this);
	QPushButton* b_img = new QPushButton(tr("View\nimage"), this);
	b_img->setAutoDefault(false);
	hbox_tools_buttons->addWidget(b_img);
	tools_buttons->setLayout(hbox_tools_buttons);

	//Merge Tools = Memory Viewer Options + Raw Image Preview Options + Tool Buttons
	hbox_tools->addSpacing(10);
	hbox_tools->addWidget(tools_mem);
	hbox_tools->addWidget(tools_img);
	hbox_tools->addWidget(tools_buttons);
	hbox_tools->addSpacing(10);

	//Memory Panel:
	QHBoxLayout* hbox_mem_panel = new QHBoxLayout();

	//Memory Panel: Address Panel
	m_mem_addr = new QLabel("");
	m_mem_addr->setObjectName("memory_viewer_address_panel");
	m_mem_addr->setFont(mono);
	m_mem_addr->setAutoFillBackground(true);
	m_mem_addr->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
	m_mem_addr->ensurePolished();

	//Memory Panel: Hex Panel
	m_mem_hex = new QLabel("");
	m_mem_hex->setObjectName("memory_viewer_hex_panel");
	m_mem_hex->setFont(mono);
	m_mem_hex->setAutoFillBackground(true);
	m_mem_hex->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
	m_mem_hex->ensurePolished();

	//Memory Panel: ASCII Panel
	m_mem_ascii = new QLabel("");
	m_mem_ascii->setObjectName("memory_viewer_ascii_panel");
	m_mem_ascii->setFont(mono);
	m_mem_ascii->setAutoFillBackground(true);
	m_mem_ascii->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
	m_mem_ascii->ensurePolished();

	//Merge Memory Panel:
	hbox_mem_panel->setAlignment(Qt::AlignLeft);
	hbox_mem_panel->addSpacing(20);
	hbox_mem_panel->addWidget(m_mem_addr);
	hbox_mem_panel->addSpacing(10);
	hbox_mem_panel->addWidget(m_mem_hex);
	hbox_mem_panel->addSpacing(10);
	hbox_mem_panel->addWidget(m_mem_ascii);
	hbox_mem_panel->addSpacing(10);

	//Memory Panel: Set size of the QTextEdits
	m_mem_hex->setFixedSize(QSize(pSize * 3 * m_colcount + 6, 228));
	m_mem_ascii->setFixedSize(QSize(pSize * m_colcount + 6, 228));

	//Set Margins to adjust WindowSize
	vbox_panel->setContentsMargins(0, 0, 0, 0);
	hbox_tools->setContentsMargins(0, 0, 0, 0);
	tools_mem_addr->setContentsMargins(0, 10, 0, 0);
	tools_mem_bytes->setContentsMargins(0, 10, 0, 0);
	tools_mem_buttons->setContentsMargins(0, 10, 0, 0);
	tools_img_mode->setContentsMargins(0, 10, 0, 0);
	tools_img_size->setContentsMargins(0, 10, 0, 0);
	tools_mem->setContentsMargins(0, 10, 0, 0);
	tools_img->setContentsMargins(0, 10, 0, 0);
	tools_buttons->setContentsMargins(0, 10, 0, 0);
	hbox_mem_panel->setContentsMargins(0, 0, 0, 0);

	//Merge and display everything
	vbox_panel->addSpacing(10);
	vbox_panel->addLayout(hbox_tools);
	vbox_panel->addSpacing(10);
	vbox_panel->addLayout(hbox_mem_panel);
	vbox_panel->addSpacing(10);
	setLayout(vbox_panel);

	//Events
	connect(m_addr_line, &QLineEdit::returnPressed, [=]
	{
		bool ok;
		m_addr = m_addr_line->text().toULong(&ok, 16);
		m_addr_line->setText(QString("%1").arg(m_addr, 8, 16, QChar('0')));	// get 8 digits in input line
		ShowMemory();
	});
	connect(sb_bytes, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=]
	{
		m_colcount = sb_bytes->value();
		m_mem_hex->setFixedSize(QSize(pSize * 3 * m_colcount + 6, 228));
		m_mem_ascii->setFixedSize(QSize(pSize * m_colcount + 6, 228));
		ShowMemory();
	});

	connect(b_prev, &QAbstractButton::clicked, [=]() { m_addr -= m_colcount; ShowMemory(); });
	connect(b_next, &QAbstractButton::clicked, [=]() { m_addr += m_colcount; ShowMemory(); });
	connect(b_fprev, &QAbstractButton::clicked, [=]() { m_addr -= m_rowcount * m_colcount; ShowMemory(); });
	connect(b_fnext, &QAbstractButton::clicked, [=]() { m_addr += m_rowcount * m_colcount; ShowMemory(); });
	connect(b_img, &QAbstractButton::clicked, [=]
	{
		int mode = cbox_img_mode->currentIndex();
		int sizex = sb_img_size_x->value();
		int sizey = sb_img_size_y->value();
		ShowImage(this, m_addr, mode, sizex, sizey, false);
	});
	
	//Fill the QTextEdits
	ShowMemory();
	setFixedSize(sizeHint());
}
Ejemplo n.º 21
0
// --- StyleSheetEditorDialog
StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *core, QWidget *parent, Mode mode):
    QDialog(parent),
    m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Help)),
    m_editor(new StyleSheetEditor),
    m_validityLabel(new QLabel(tr("Valid Style Sheet"))),
    m_core(core),
    m_addResourceAction(new QAction(tr("Add Resource..."), this)),
    m_addGradientAction(new QAction(tr("Add Gradient..."), this)),
    m_addColorAction(new QAction(tr("Add Color..."), this)),
    m_addFontAction(new QAction(tr("Add Font..."), this))
{
    setWindowTitle(tr("Edit Style Sheet"));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    connect(m_buttonBox, SIGNAL(helpRequested()), this, SLOT(slotRequestHelp()));
    m_buttonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents);

    connect(m_editor, SIGNAL(textChanged()), this, SLOT(validateStyleSheet()));

    QToolBar *toolBar = new QToolBar;

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(toolBar, 0, 0, 1, 2);
    layout->addWidget(m_editor, 1, 0, 1, 2);
    layout->addWidget(m_validityLabel, 2, 0, 1, 1);
    layout->addWidget(m_buttonBox, 2, 1, 1, 1);
    setLayout(layout);

    m_editor->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_editor, SIGNAL(customContextMenuRequested(QPoint)),
                this, SLOT(slotContextMenuRequested(QPoint)));

    QSignalMapper *resourceActionMapper = new QSignalMapper(this);
    QSignalMapper *gradientActionMapper = new QSignalMapper(this);
    QSignalMapper *colorActionMapper = new QSignalMapper(this);

    resourceActionMapper->setMapping(m_addResourceAction, QString());
    gradientActionMapper->setMapping(m_addGradientAction, QString());
    colorActionMapper->setMapping(m_addColorAction, QString());

    connect(m_addResourceAction, SIGNAL(triggered()), resourceActionMapper, SLOT(map()));
    connect(m_addGradientAction, SIGNAL(triggered()), gradientActionMapper, SLOT(map()));
    connect(m_addColorAction, SIGNAL(triggered()), colorActionMapper, SLOT(map()));
    connect(m_addFontAction, SIGNAL(triggered()), this, SLOT(slotAddFont()));

    m_addResourceAction->setEnabled(mode == ModePerForm);

    const char * const resourceProperties[] = {
        "background-image",
        "border-image",
        "image",
        0
    };

    const char * const colorProperties[] = {
        "color",
        "background-color",
        "alternate-background-color",
        "border-color",
        "border-top-color",
        "border-right-color",
        "border-bottom-color",
        "border-left-color",
        "gridline-color",
        "selection-color",
        "selection-background-color",
        0
    };

    QMenu *resourceActionMenu = new QMenu(this);
    QMenu *gradientActionMenu = new QMenu(this);
    QMenu *colorActionMenu = new QMenu(this);

    for (int resourceProperty = 0; resourceProperties[resourceProperty]; ++resourceProperty) {
        QAction *action = resourceActionMenu->addAction(QLatin1String(resourceProperties[resourceProperty]));
        connect(action, SIGNAL(triggered()), resourceActionMapper, SLOT(map()));
        resourceActionMapper->setMapping(action, QLatin1String(resourceProperties[resourceProperty]));
    }

    for (int colorProperty = 0; colorProperties[colorProperty]; ++colorProperty) {
        QAction *gradientAction = gradientActionMenu->addAction(QLatin1String(colorProperties[colorProperty]));
        QAction *colorAction = colorActionMenu->addAction(QLatin1String(colorProperties[colorProperty]));
        connect(gradientAction, SIGNAL(triggered()), gradientActionMapper, SLOT(map()));
        connect(colorAction, SIGNAL(triggered()), colorActionMapper, SLOT(map()));
        gradientActionMapper->setMapping(gradientAction, QLatin1String(colorProperties[colorProperty]));
        colorActionMapper->setMapping(colorAction, QLatin1String(colorProperties[colorProperty]));
    }

    connect(resourceActionMapper, SIGNAL(mapped(QString)), this, SLOT(slotAddResource(QString)));
    connect(gradientActionMapper, SIGNAL(mapped(QString)), this, SLOT(slotAddGradient(QString)));
    connect(colorActionMapper, SIGNAL(mapped(QString)), this, SLOT(slotAddColor(QString)));

    m_addResourceAction->setMenu(resourceActionMenu);
    m_addGradientAction->setMenu(gradientActionMenu);
    m_addColorAction->setMenu(colorActionMenu);

    toolBar->addAction(m_addResourceAction);
    toolBar->addAction(m_addGradientAction);
    toolBar->addAction(m_addColorAction);
    toolBar->addAction(m_addFontAction);

    m_editor->setFocus();

    QDesignerSettingsInterface *settings = core->settingsManager();
    settings->beginGroup(QLatin1String(StyleSheetDialogC));

    if (settings->contains(QLatin1String(Geometry)))
        restoreGeometry(settings->value(QLatin1String(Geometry)).toByteArray());

    settings->endGroup();
}
Ejemplo n.º 22
0
MainWindow::MainWindow( const QStringList &_params )
:	QWidget()
,	cardsGroup( new QActionGroup( this ) )
,	quitOnClose( false )
{
	setAttribute( Qt::WA_DeleteOnClose, true );
	setupUi( this );

	cards->hide();
	cards->hack();
	languages->hack();

	setWindowFlags( Qt::Window | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint );
#if QT_VERSION >= 0x040500
	setWindowFlags( windowFlags() | Qt::WindowCloseButtonHint );
#else
	setWindowFlags( windowFlags() | Qt::WindowSystemMenuHint );
#endif

	Settings s;
	// Mobile
	infoMobileCode->setValidator( new IKValidator( infoMobileCode ) );
	infoMobileCode->setText( s.value( "Client/MobileCode" ).toString() );
	infoMobileCell->setText( s.value( "Client/MobileNumber", "+372" ).toString() );
	connect( infoMobileCode, SIGNAL(textEdited(QString)), SLOT(enableSign()) );
	connect( infoMobileCell, SIGNAL(textEdited(QString)), SLOT(enableSign()) );
	connect( infoSignMobile, SIGNAL(toggled(bool)), SLOT(showCardStatus()) );

	// Buttons
	QButtonGroup *buttonGroup = new QButtonGroup( this );

	buttonGroup->addButton( settings, HeadSettings );
	buttonGroup->addButton( help, HeadHelp );
	buttonGroup->addButton( about, HeadAbout );

	buttonGroup->addButton( homeSign, HomeSign );
	buttonGroup->addButton( homeView, HomeView );
	buttonGroup->addButton( homeCrypt, HomeCrypt );

	introNext = introButtons->addButton( tr( "Next" ), QDialogButtonBox::ActionRole );
	buttonGroup->addButton( introNext, IntroNext );
	buttonGroup->addButton( introButtons->button( QDialogButtonBox::Cancel ), IntroBack );

	signButton = signButtons->addButton( tr("Sign"), QDialogButtonBox::AcceptRole );
	buttonGroup->addButton( signButton, SignSign );
	buttonGroup->addButton( signButtons->button( QDialogButtonBox::Cancel ), SignCancel );

	viewAddSignature = viewButtons->addButton( tr("Add signature"), QDialogButtonBox::ActionRole );
	buttonGroup->addButton( viewAddSignature, ViewAddSignature );
	buttonGroup->addButton( viewButtons->button( QDialogButtonBox::Close ), ViewClose );
	connect( buttonGroup, SIGNAL(buttonClicked(int)),
		SLOT(buttonClicked(int)) );

	connect( infoCard, SIGNAL(linkActivated(QString)), SLOT(parseLink(QString)) );
	connect( cards, SIGNAL(activated(QString)), qApp->signer(), SLOT(selectCard(QString)), Qt::QueuedConnection );
	connect( qApp, SIGNAL(dataChanged()), SLOT(showCardStatus()) );

	// Digidoc
	doc = new DigiDoc( this );

	// Translations
	lang << "et" << "en" << "ru";
	QString deflang;
	switch( QLocale().language() )
	{
	case QLocale::English: deflang = "en"; break;
	case QLocale::Russian: deflang = "ru"; break;
	case QLocale::Estonian:
	default: deflang = "et"; break;
	}
	on_languages_activated( lang.indexOf(
		s.value( "Main/Language", deflang ).toString() ) );
	QActionGroup *langGroup = new QActionGroup( this );
	QAction *etAction = langGroup->addAction( new QAction( langGroup ) );
	QAction *enAction = langGroup->addAction( new QAction( langGroup ) );
	QAction *ruAction = langGroup->addAction( new QAction( langGroup ) );
	etAction->setData( 0 );
	enAction->setData( 1 );
	ruAction->setData( 2 );
	etAction->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_1 );
	enAction->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_2 );
	ruAction->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_3 );
	addAction( etAction );
	addAction( enAction );
	addAction( ruAction );
	connect( langGroup, SIGNAL(triggered(QAction*)), SLOT(changeLang(QAction*)) );
	connect( cardsGroup, SIGNAL(triggered(QAction*)), SLOT(changeCard(QAction*)) );

	// Views
	signContentView->setColumnHidden( 2, true );
	viewContentView->setColumnHidden( 3, true );
	connect( signContentView, SIGNAL(remove(unsigned int)),
		SLOT(removeDocument(unsigned int)) );
	connect( viewContentView, SIGNAL(remove(unsigned int)),
		SLOT(removeDocument(unsigned int)) );

	if( !_params.empty() )
	{
		quitOnClose = true;
		params = _params;
		buttonClicked( HomeSign );
	}
}
Ejemplo n.º 23
0
GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
                           QWidget *parent)
    : QDialog(parent)
    , m_parameters(p)
    , m_filterModel(new QSortFilterProxyModel(this))
    , m_model(new GerritModel(p, this))
    , m_queryModel(new QStringListModel(this))
    , m_treeView(new Utils::TreeView)
    , m_detailsBrowser(new QTextBrowser)
    , m_queryLineEdit(new Utils::FancyLineEdit)
    , m_filterLineEdit(new Utils::FancyLineEdit)
    , m_repositoryChooser(new Utils::PathChooser)
    , m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Close))
    , m_repositoryChooserLabel(new QLabel(tr("Apply in:") + QLatin1Char(' '), this))
    , m_fetchRunning(false)
{
    setWindowTitle(tr("Gerrit %1@%2").arg(p->user, p->host));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    QGroupBox *changesGroup = new QGroupBox(tr("Changes"));
    QVBoxLayout *changesLayout = new QVBoxLayout(changesGroup);
    changesLayout->setMargin(layoutSpacing);
    QHBoxLayout *filterLayout = new QHBoxLayout;
    QLabel *queryLabel = new QLabel(tr("&Query:"));
    queryLabel->setBuddy(m_queryLineEdit);
    m_queryLineEdit->setFixedWidth(400);
    m_queryLineEdit->setPlaceholderText(tr("Change #, SHA-1, tr:id, owner:email or reviewer:email"));
    m_queryModel->setStringList(m_parameters->savedQueries);
    QCompleter *completer = new QCompleter(this);
    completer->setModel(m_queryModel);
    m_queryLineEdit->setSpecialCompleter(completer);
    m_queryLineEdit->setOkColor(Utils::creatorTheme()->color(Utils::Theme::TextColorNormal));
    m_queryLineEdit->setErrorColor(Utils::creatorTheme()->color(Utils::Theme::TextColorError));
    m_queryLineEdit->setValidationFunction([this](Utils::FancyLineEdit *, QString *) {
                                               return m_model->state() != GerritModel::Error;
                                           });
    filterLayout->addWidget(queryLabel);
    filterLayout->addWidget(m_queryLineEdit);
    filterLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored));
    m_filterLineEdit->setFixedWidth(300);
    m_filterLineEdit->setFiltering(true);
    filterLayout->addWidget(m_filterLineEdit);
    connect(m_filterLineEdit, &Utils::FancyLineEdit::filterChanged,
            m_filterModel, &QSortFilterProxyModel::setFilterFixedString);
    connect(m_queryLineEdit, &QLineEdit::returnPressed, this, &GerritDialog::slotRefresh);
    connect(m_model, &GerritModel::stateChanged, m_queryLineEdit, &Utils::FancyLineEdit::validate);
    m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    changesLayout->addLayout(filterLayout);
    changesLayout->addWidget(m_treeView);

    m_filterModel->setSourceModel(m_model);
    m_filterModel->setFilterRole(GerritModel::FilterRole);
    m_filterModel->setSortRole(GerritModel::SortRole);
    m_treeView->setRootIsDecorated(true);
    m_treeView->setModel(m_filterModel);
    m_treeView->setMinimumWidth(600);
    m_treeView->setUniformRowHeights(true);
    m_treeView->setRootIsDecorated(false);
    m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_treeView->setSortingEnabled(true);
    m_treeView->setActivationMode(Utils::DoubleClickActivation);

    connect(&m_progressIndicatorTimer, &QTimer::timeout,
            [this]() { setProgressIndicatorVisible(true); });
    m_progressIndicatorTimer.setSingleShot(true);
    m_progressIndicatorTimer.setInterval(50); // don't show progress for < 50ms tasks

    m_progressIndicator = new Utils::ProgressIndicator(Utils::ProgressIndicator::Large,
                                                       m_treeView);
    m_progressIndicator->attachToWidget(m_treeView->viewport());
    m_progressIndicator->hide();

    connect(m_model, &GerritModel::stateChanged, this, &GerritDialog::manageProgressIndicator);

    QItemSelectionModel *selectionModel = m_treeView->selectionModel();
    connect(selectionModel, &QItemSelectionModel::currentChanged,
            this, &GerritDialog::slotCurrentChanged);
    connect(m_treeView, &QAbstractItemView::activated,
            this, &GerritDialog::slotActivated);

    QGroupBox *detailsGroup = new QGroupBox(tr("Details"));
    QVBoxLayout *detailsLayout = new QVBoxLayout(detailsGroup);
    detailsLayout->setMargin(layoutSpacing);
    m_detailsBrowser->setOpenExternalLinks(true);
    m_detailsBrowser->setTextInteractionFlags(Qt::TextBrowserInteraction);
    detailsLayout->addWidget(m_detailsBrowser);

    m_repositoryChooser->setExpectedKind(Utils::PathChooser::Directory);
    m_repositoryChooser->setHistoryCompleter(QLatin1String("Git.RepoDir.History"));
    QHBoxLayout *repoPathLayout = new QHBoxLayout;
    repoPathLayout->addWidget(m_repositoryChooserLabel);
    repoPathLayout->addWidget(m_repositoryChooser);
    detailsLayout->addLayout(repoPathLayout);

    m_displayButton = addActionButton(tr("&Show"), [this]() { slotFetchDisplay(); });
    m_cherryPickButton = addActionButton(tr("Cherry &Pick"), [this]() { slotFetchCherryPick(); });
    m_checkoutButton = addActionButton(tr("C&heckout"), [this]() { slotFetchCheckout(); });
    m_refreshButton = addActionButton(tr("&Refresh"), [this]() { slotRefresh(); });

    connect(m_model, &GerritModel::refreshStateChanged,
            m_refreshButton, &QWidget::setDisabled);
    connect(m_model, &GerritModel::refreshStateChanged,
            this, &GerritDialog::slotRefreshStateChanged);
    connect(m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
    connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);

    QSplitter *splitter = new QSplitter(Qt::Vertical, this);
    splitter->addWidget(changesGroup);
    splitter->addWidget(detailsGroup);
    splitter->setSizes(QList<int>() <<  400 << 200);

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(splitter);
    mainLayout->addWidget(m_buttonBox);

    slotCurrentChanged();
    slotRefresh();

    resize(QSize(950, 600));
    m_treeView->setFocus();
    m_refreshButton->setDefault(true);
}
Ejemplo n.º 24
0
MovimentoEditDialog::MovimentoEditDialog(QSqlRelationalTableModel* model,
													  ColumnIndexes & colInd,
													  int curRow,
													  bool canSubmit, QWidget *parent)
	: QDialog(parent)
	, ui(new Ui::MovimentoEditDialog)
	, m_movModel(model)
	, m_insert(curRow<0) // se linha < 0, então é inserção, do contrário é edição
	, m_canSubmit(canSubmit)
	, m_colInd(colInd)
{
	ui->setupUi(this);


	if ( m_insert )
		ui->movimentoNavGroup->hide(); // se vai inserir, não haverá havegação.

	// seta as comboBox para que sejam alimentadas pelo relacionamento correspondente
	// exibindo a coluna "nome" ao inves de "id":

	// nomes de clientes na respectiva combo:
	QSqlTableModel *cliRelationModel =
									m_movModel->relationModel(m_colInd.movClienteId);
	ui->clienteCombo->setModel(cliRelationModel);
	ui->clienteCombo->setModelColumn(cliRelationModel->fieldIndex("name"));
	// como o relation model só duas colunas (chave e valor), poderia:
	//ui->clienteCombo->setModelColumn(1); // índice da coluna valor
	
	ui->clienteCombo->model()->sort(cliRelationModel->fieldIndex("name"), Qt::AscendingOrder);

	// tipos de movimento na respectiva combo:
	QSqlTableModel *tipoRelationModel = m_movModel->relationModel(m_colInd.movTipoId);
	ui->tipoCombo->setModel(tipoRelationModel);
	ui->tipoCombo->setModelColumn(tipoRelationModel->fieldIndex("name"));
	ui->tipoCombo->model()->sort(tipoRelationModel->fieldIndex("name"), Qt::AscendingOrder);

	// * ^^ Nos 2 "relationModel" acima, temos sempre duas colunas: "chave" e "valor associado".

	// cria um mapeador que relacionará widgets "sem-model" com
	// as colunas respectivas do model:
	m_movMapper = new QDataWidgetMapper(this);

	// "submitPolicy": "auto" ou "manual"; se "auto" irá completar alterações se a linha selecionada for alterada
	m_movMapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); // "manual" -> teremos que chamar "submit" no momento apropriado.
	// define o "model" a ser usado pelo "mapper":
	m_movMapper->setModel(m_movModel);
	// define o delegate que permite exibir colunas relacionadas em comboBox's
	m_movMapper->setItemDelegate(new QSqlRelationalDelegate(this));

	// mapeia cada widget necessário para a coluna respectiva no model:
	m_movMapper->addMapping(ui->clienteCombo, m_colInd.movClienteId);
	m_movMapper->addMapping(ui->tipoCombo, m_colInd.movTipoId);
	m_movMapper->addMapping(ui->movDate, m_colInd.movDate);
	m_movMapper->addMapping(ui->descrEdit, m_colInd.movDescription);

	// conecta os botões de navegação diretamente aos slots do "mapper"
	// (neste caso, não é necessário criar novos slots para isso, exceto se quisermos fazer algo diferenciado)
	if ( !m_insert )
	{
		connect(ui->movimentoNavFirstBtn, SIGNAL(clicked()),
																			m_movMapper, SLOT(toFirst()));
		connect(ui->movimentoNavPrevBtn, SIGNAL(clicked()),
																			m_movMapper, SLOT(toPrevious()));
		connect(ui->movimentoNavNextBtn, SIGNAL(clicked()),
																			m_movMapper, SLOT(toNext()));
		connect(ui->movimentoNavLastBtn, SIGNAL(clicked()),
																			m_movMapper, SLOT(toLast()));
	}

	// se for inserir, deve criar nova linha no model
	if ( m_insert ) // INSERIR
	{
		// insere uma nova linha no model (caso o insert seja cancelado, deverá ser removida):
		curRow = m_movModel->rowCount(); // altera curRow para o total de linhas
		// rowCount -> total de linhas -> uma nova linha no final:
		m_movModel->insertRow(curRow);

		// em inclusão, seta widgets de data (para forçar o default):
		ui->movDate->setDate( QDate::currentDate() );

		setWindowTitle("INCLUIR novo movimento - "); // título do diálogo
	}
	else  // ALTERAR
		setWindowTitle("ALTERAR um movimento - ");  // título do diálogo

	QSqlDatabase db = m_movModel->database();
	setWindowTitle( windowTitle() + db.driverName());

	m_movMapper->setCurrentIndex(curRow); // seta a "row" do mapper

	// desabilta a opção do menu de sistema "fechar" ("X");
	// desse modo só poderá fechar o diálogo com os botões "OK" e "CANCELAR"
	// e não precisaremos redefinir a virtual "closeEvent" para finalzação
	Qt::WindowFlags flags = windowFlags();
	flags |=  Qt::CustomizeWindowHint;  // acrescenta: flags customizados
	flags &= ~Qt::WindowCloseButtonHint;  // desabilita: closeButton
	setWindowFlags(flags);

}
Ejemplo n.º 25
0
bool Sdl2Application::tryCreateContext(const Configuration& configuration) {
    CORRADE_ASSERT(_context->version() == Version::None, "Platform::Sdl2Application::tryCreateContext(): context already created", false);

    /* Enable double buffering and 24bt depth buffer */
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);

    /* Multisampling */
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, configuration.sampleCount() > 1 ? 1 : 0);
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, configuration.sampleCount());

    #ifndef CORRADE_TARGET_EMSCRIPTEN
    /* sRGB */
    SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, configuration.isSRGBCapable());
    #endif

    /* Flags: if not hidden, set as shown */
    Uint32 windowFlags(configuration.windowFlags());
    if(!(configuration.windowFlags() & Configuration::WindowFlag::Hidden))
        windowFlags |= SDL_WINDOW_SHOWN;

    /** @todo Remove when Emscripten has proper SDL2 support */
    #ifndef CORRADE_TARGET_EMSCRIPTEN
    /* Set context version, if user-specified */
    if(configuration.version() != Version::None) {
        Int major, minor;
        std::tie(major, minor) = version(configuration.version());
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, major);
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minor);

        #ifndef MAGNUM_TARGET_GLES
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, configuration.version() >= Version::GL310 ?
            SDL_GL_CONTEXT_PROFILE_CORE : SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
        #else
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
        #endif

        SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, int(configuration.flags()));

    /* Request usable version otherwise */
    } else {
        #ifndef MAGNUM_TARGET_GLES
        /* First try to create core context. This is needed mainly on OS X and
           Mesa, as support for recent OpenGL versions isn't implemented in
           compatibility contexts (which are the default). At least GL 3.2 is
           needed on OSX, at least GL 3.1 is needed on Mesa. Bite the bullet
           and try 3.1 also elsewhere. */
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
        #ifdef CORRADE_TARGET_APPLE
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
        #else
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
        #endif
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, int(configuration.flags())|SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);
        #else
        /* For ES the major context version is compile-time constant */
        #ifdef MAGNUM_TARGET_GLES3
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
        #elif defined(MAGNUM_TARGET_GLES2)
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
        #else
        #error unsupported OpenGL ES version
        #endif
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
        #endif
    }

    /* Create window */
    if(!(_window = SDL_CreateWindow(configuration.title().data(),
        SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
        configuration.size().x(), configuration.size().y(),
        SDL_WINDOW_OPENGL|windowFlags)))
    {
        Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create window:" << SDL_GetError();
        return false;
    }

    /* Create context */
    _glContext = SDL_GL_CreateContext(_window);

    #ifndef MAGNUM_TARGET_GLES
    /* Fall back to (forward compatible) GL 2.1, if version is not
       user-specified and either core context creation fails or we are on
       binary NVidia/AMD drivers on Linux/Windows. Instead of creating forward-
       compatible context with highest available version, they force the
       version to the one specified, which is completely useless behavior. */
    #ifndef CORRADE_TARGET_APPLE
    constexpr static const char nvidiaVendorString[] = "NVIDIA Corporation";
    constexpr static const char amdVendorString[] = "ATI Technologies Inc.";
    const char* vendorString;
    #endif
    if(configuration.version() == Version::None && (!_glContext
        #ifndef CORRADE_TARGET_APPLE
        /* Sorry about the UGLY code, HOPEFULLY THERE WON'T BE MORE WORKAROUNDS */
        || (vendorString = reinterpret_cast<const char*>(glGetString(GL_VENDOR)),
        (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 ||
         std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0)
         && !_context->isDriverWorkaroundDisabled("amd-nv-no-forward-compatible-core-context"))
        #endif
    )) {
        /* Don't print any warning when doing the NV workaround, because the
           bug will be there probably forever */
        if(!_glContext) Warning()
            << "Platform::Sdl2Application::tryCreateContext(): cannot create core context:"
            << SDL_GetError() << "(falling back to compatibility context)";
        else SDL_GL_DeleteContext(_glContext);

        SDL_DestroyWindow(_window);

        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
        SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, int(configuration.flags()));

        if(!(_window = SDL_CreateWindow(configuration.title().data(),
            SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
            configuration.size().x(), configuration.size().y(),
            SDL_WINDOW_OPENGL|windowFlags)))
        {
            Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create window:" << SDL_GetError();
            return false;
        }

        /* Create compatibility context */
        _glContext = SDL_GL_CreateContext(_window);
    }
    #endif

    /* Cannot create context (or fallback compatibility context on desktop) */
    if(!_glContext) {
        Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create context:" << SDL_GetError();
        SDL_DestroyWindow(_window);
        _window = nullptr;
        return false;
    }

    #else
    /* Emscripten-specific initialization */
    _glContext = SDL_SetVideoMode(configuration.size().x(), configuration.size().y(), 24, SDL_OPENGL|SDL_HWSURFACE|SDL_DOUBLEBUF);
    #endif

    /* Return true if the initialization succeeds */
    return _context->tryCreate();
}
Ejemplo n.º 26
0
void MainWindow::on_transpBox_toggled(bool transparent)
{
#if defined(Q_WS_WIN)
    static Qt::WindowFlags initialWindowFlags = windowFlags();
#endif
    if (transparent) {
#if defined(Q_WS_X11)
        // one-time warning
        ButtonsDialog warning("EnableTransparency", tr("Transparency"), tr("This feature requires compositing (compiz or kwin4) to work on Linux.<br>If you see a black background then transparency is not supported on your system."), QDialogButtonBox::Ok, true, true);
        warning.setIcon(QStyle::SP_MessageBoxInformation);
        warning.execute();
#endif

#if QT_VERSION < 0x040600
        // WORKAROUND Qt <= 4.6-beta1: toggle opengl with transparency
        ui->accelBox->setChecked(false);
#endif

        // go transparent
        setAttribute(Qt::WA_NoSystemBackground, true);
        setAttribute(Qt::WA_TranslucentBackground, true);

        // hint the render that we're transparent now
        RenderOpts::ARGBWindow = true;

        // enable blur behind
#if defined(Q_WS_X11)
        kde4EnableBlurBehindWindow(winId(), true);
#elif defined(Q_WS_WIN)
        if (!dwmEnableBlurBehindWindow(this, true)) {
            // if blur fails, use a frameless window that's needed on XP for transparency
            setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
            show();
        }
#endif

        // disable appliance background too
        if (App::workflow)
            App::workflow->applianceCommand(App::AC_ClearBackground);
    } else {
        // back to normal (non-alphaed) window
        setAttribute(Qt::WA_TranslucentBackground, false);
        setAttribute(Qt::WA_NoSystemBackground, false);

	// disable blur behind
#if defined(Q_WS_X11)
        kde4EnableBlurBehindWindow(winId(), false);
#elif defined(Q_WS_WIN)
        // disable no-border on windows
        setWindowFlags(initialWindowFlags);
        show();
#endif

        // hint the render that we're opaque again
        RenderOpts::ARGBWindow = false;
    }
    // refresh the window
    update();

    // remember in settings
    App::settings->setValue("Fotowall/Tranlucent", transparent);
}
Ejemplo n.º 27
0
MusicRemoteWidget::MusicRemoteWidget(QWidget *parent)
    : MusicAbstractMoveWidget(parent)
{
    setWindowFlags( windowFlags() | Qt::WindowStaysOnTopHint);
    drawWindowShadow(false);

    QBitmap bmp(size());
    bmp.fill();
    QPainter p(&bmp);
    p.setPen(Qt::NoPen);
    p.setBrush(Qt::black);
    p.drawRoundedRect(bmp.rect(), 4, 4);
    setMask(bmp);

    setMouseTracking(true);

    m_showMainWindow = new QPushButton(this);
    m_PreSongButton = new QPushButton(this);
    m_NextSongButton = new QPushButton(this);
    m_PlayButton = new QPushButton(this);
    m_SettingButton = new QPushButton(this);
    m_mainWidget = new QWidget(this);
    m_mainWidget->setObjectName("mainWidget");

    m_showMainWindow->setStyleSheet(MusicUIObject::MPushButtonStyle04);
    m_showMainWindow->setIcon(QIcon(":/image/windowicon"));
    m_PreSongButton->setIcon(QIcon(":/desktopTool/previousP"));
    m_NextSongButton->setIcon(QIcon(":/desktopTool/nextP"));
    m_PlayButton->setIcon(QIcon(":/desktopTool/play"));
    m_SettingButton->setIcon(QIcon(":/desktopTool/setting"));
    m_showMainWindow->setToolTip(tr("showMainWindow"));
    m_PreSongButton->setToolTip(tr("Privious"));
    m_NextSongButton->setToolTip(tr("Next"));
    m_PlayButton->setToolTip(tr("Play"));
    m_SettingButton->setToolTip(tr("showSetting"));
    m_showMainWindow->setCursor(QCursor(Qt::PointingHandCursor));
    m_PreSongButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_NextSongButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_PlayButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_SettingButton->setCursor(QCursor(Qt::PointingHandCursor));
    connect(m_showMainWindow, SIGNAL(clicked()), SIGNAL(musicWindowSignal()));
    connect(m_PlayButton, SIGNAL(clicked()), SIGNAL(musicKeySignal()));
    connect(m_PreSongButton, SIGNAL(clicked()), SIGNAL(musicPlayPriviousSignal()));
    connect(m_NextSongButton, SIGNAL(clicked()), SIGNAL(musicPlayNextSignal()));
    connect(m_SettingButton, SIGNAL(clicked()), SIGNAL(musicSettingSignal()));

    m_volumeWidget = new QWidget(m_mainWidget);
    QHBoxLayout *volumnLayout = new QHBoxLayout(m_volumeWidget);
    volumnLayout->setContentsMargins(0, 0, 0, 0);
    volumnLayout->setSpacing(1);
    m_volumeLabel = new QLabel(m_volumeWidget);
    m_volumeLabel->setStyleSheet(MusicUIObject::MCustomStyle26);
    m_volumeLabel->setFixedSize(QSize(20, 20));
    m_volumeSlider = new QSlider(Qt::Horizontal, m_volumeWidget);
    m_volumeSlider->setRange(0, 100);
    m_volumeSlider->setStyleSheet(MusicUIObject::MSliderStyle04);
    m_volumeSlider->setFixedWidth(45);
    volumnLayout->addWidget(m_volumeLabel);
    volumnLayout->addWidget(m_volumeSlider);
    m_volumeSlider->setCursor(QCursor(Qt::PointingHandCursor));
    connect(m_volumeSlider, SIGNAL(valueChanged(int)), SLOT(musicVolumeChanged(int)));
}
Ejemplo n.º 28
0
PropertiesDialog::PropertiesDialog(std::shared_ptr<ObjectProperties> objectProperties, GraphNode* node, QWidget* parent)
	: QDialog(parent)
	, m_graphNode(node)
	, m_objectProperties(objectProperties)
{
	setMinimumSize(300, 200);
	resize(500, 600);
	setWindowTitle(QString::fromStdString(m_objectProperties->name()));
	setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

	auto tabWidget = new QTabWidget;
	auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Apply	|
										  QDialogButtonBox::Cancel	|
										  QDialogButtonBox::Reset	|
										  QDialogButtonBox::Ok);

	auto applyButton = buttonBox->button(QDialogButtonBox::Apply);
	auto resetButton = buttonBox->button(QDialogButtonBox::Reset);
	auto OkButton = buttonBox->button(QDialogButtonBox::Ok);
	connect(applyButton, &QPushButton::clicked, this, &PropertiesDialog::apply);
	connect(resetButton, &QPushButton::clicked, this, &PropertiesDialog::resetWidgets);
	connect(OkButton, &QPushButton::clicked, this, &PropertiesDialog::applyAndClose);
	connect(buttonBox, &QDialogButtonBox::rejected, this, &PropertiesDialog::reject);

	auto mainLayout = new QVBoxLayout;
	mainLayout->addWidget(tabWidget);
	mainLayout->addWidget(buttonBox);
	mainLayout->setContentsMargins(5, 5, 5, 5);

	std::map<std::string, std::vector<int>> propertyGroups;
	m_propertyWidgets.reserve(m_objectProperties->properties().size());

	// Create the property widgets
	for(const auto& prop : m_objectProperties->properties())
	{
		// create property type specific widget
		std::shared_ptr<BasePropertyWidget> propWidget = PropertyWidgetFactory::instance().create(prop, this);
		if(propWidget)
		{
			connect(propWidget.get(), &BasePropertyWidget::stateChanged, this, &PropertiesDialog::stateChanged);
			int id  = m_propertyWidgets.size();
			propertyGroups[prop->group()].push_back(id);

			PropertyStruct propStruct;
			propStruct.property = prop;
			propStruct.widget = propWidget;
			m_propertyWidgets.push_back(propStruct);
		}
		else
		{
			std::cerr << "Couldn't create a widget for the property " << prop->name() << std::endl;
		}
	}

	// Group the widgets and add them to the dialog
	for(const auto& group : propertyGroups)
	{
		QString name = QString::fromStdString(group.first);
		if(name.isEmpty())
			name = "Property";

		const int maxPerTab = 10; // TODO: use combined default height of widgets instead
		const auto& properties = group.second;
		const int nb = properties.size();
		if(nb > maxPerTab)
		{
			int nbTabs = (properties.size() + maxPerTab - 1) / maxPerTab;
			auto beginIt = properties.begin();
			for(int i = 0; i < nbTabs; ++i)
			{
				QString tabName = name + " " + QString::number(i+1) + "/" + QString::number(nbTabs);
				auto startDist = i * maxPerTab;
				auto endDist = std::min(nb, startDist + maxPerTab);
				addTab(tabWidget, tabName, beginIt + startDist, beginIt + endDist);
			}
		}
		else
			addTab(tabWidget, name, properties.begin(), properties.end());
	}

	setLayout(mainLayout);

	m_objectProperties->addModifiedCallback([this](){
		readFromProperties();
	});
}
Ejemplo n.º 29
0
    // --------------- QDesignerPromotionDialog
    QDesignerPromotionDialog::QDesignerPromotionDialog(QDesignerFormEditorInterface *core,
                                                       QWidget *parent,
                                                       const QString &promotableWidgetClassName,
                                                       QString *promoteTo) :
        QDialog(parent),
        m_mode(promotableWidgetClassName.isEmpty() || promoteTo == 0 ? ModeEdit : ModeEditChooseClass),
        m_promotableWidgetClassName(promotableWidgetClassName),
        m_core(core),
        m_promoteTo(promoteTo),
        m_promotion(core->promotion()),
        m_model(new PromotionModel(core)),
        m_treeView(new QTreeView),
        m_buttonBox(0),
        m_removeButton(new QPushButton(createIconSet(QString::fromUtf8("minus.png")), QString()))
    {
        m_buttonBox = createButtonBox();
        setModal(true);
        setWindowTitle(tr("Promoted Widgets"));
        setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

        QVBoxLayout *vboxLayout = new QVBoxLayout(this);

        // tree view group
        QGroupBox *treeViewGroup = new QGroupBox();
        treeViewGroup->setTitle(tr("Promoted Classes"));
        QVBoxLayout *treeViewVBoxLayout = new QVBoxLayout(treeViewGroup);
        // tree view
        m_treeView->setModel (m_model);
        m_treeView->setMinimumWidth(450);
        m_treeView->setContextMenuPolicy(Qt::CustomContextMenu);

        connect(m_treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
                this, SLOT(slotSelectionChanged(QItemSelection,QItemSelection)));

        connect(m_treeView, SIGNAL(customContextMenuRequested(QPoint)),
                this, SLOT(slotTreeViewContextMenu(QPoint)));

        QHeaderView *headerView = m_treeView->header();
        headerView->setSectionResizeMode(QHeaderView::ResizeToContents);
        treeViewVBoxLayout->addWidget(m_treeView);
        // remove button
        QHBoxLayout *hboxLayout = new QHBoxLayout();
        hboxLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));

        m_removeButton->setAutoDefault(false);
        connect(m_removeButton, SIGNAL(clicked()), this, SLOT(slotRemove()));
        m_removeButton->setEnabled(false);
        hboxLayout->addWidget(m_removeButton);
        treeViewVBoxLayout->addLayout(hboxLayout);
        vboxLayout->addWidget(treeViewGroup);
        // Create new panel: Try to be smart and preselect a base class. Default to QFrame
        const QStringList &baseClassNameList = baseClassNames(m_promotion);
        int preselectedBaseClass = -1;
        if (m_mode == ModeEditChooseClass) {
            preselectedBaseClass = baseClassNameList.indexOf(m_promotableWidgetClassName);
        }
        if (preselectedBaseClass == -1)
            preselectedBaseClass = baseClassNameList.indexOf(QStringLiteral("QFrame"));

        NewPromotedClassPanel *newPromotedClassPanel = new NewPromotedClassPanel(baseClassNameList, preselectedBaseClass);
        newPromotedClassPanel->setPromotedHeaderSuffix(core->integration()->headerSuffix());
        newPromotedClassPanel->setPromotedHeaderLowerCase(core->integration()->isHeaderLowercase());
        connect(newPromotedClassPanel, SIGNAL(newPromotedClass(PromotionParameters,bool*)), this, SLOT(slotNewPromotedClass(PromotionParameters,bool*)));
        connect(this, SIGNAL(selectedBaseClassChanged(QString)),
                newPromotedClassPanel, SLOT(chooseBaseClass(QString)));
        vboxLayout->addWidget(newPromotedClassPanel);
        // button box
        vboxLayout->addWidget(m_buttonBox);
        // connect model
        connect(m_model, SIGNAL(includeFileChanged(QDesignerWidgetDataBaseItemInterface*,QString)),
                this, SLOT(slotIncludeFileChanged(QDesignerWidgetDataBaseItemInterface*,QString)));

        connect(m_model, SIGNAL(classNameChanged(QDesignerWidgetDataBaseItemInterface*,QString)),
                this, SLOT(slotClassNameChanged(QDesignerWidgetDataBaseItemInterface*,QString)));

        // focus
        if (m_mode == ModeEditChooseClass)
            newPromotedClassPanel->grabFocus();

        slotUpdateFromWidgetDatabase();
    }
Ejemplo n.º 30
0
ProcessingDialog::ProcessingDialog(FileListModel *fileListModel, const AudioFileModel_MetaInfo *metaInfo, SettingsModel *settings, QWidget *parent)
:
	QDialog(parent),
	ui(new Ui::ProcessingDialog),
	m_windowIcon(NULL),
	m_systemTray(new QSystemTrayIcon(QIcon(":/icons/cd_go.png"), this)),
	m_settings(settings),
	m_metaInfo(metaInfo),
	m_shutdownFlag(shutdownFlag_None),
	m_threadPool(NULL),
	m_diskObserver(NULL),
	m_cpuObserver(NULL),
	m_ramObserver(NULL),
	m_progressViewFilter(-1),
	m_initThreads(0),
	m_firstShow(true)
{
	//Init the dialog, from the .ui file
	ui->setupUi(this);
	setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
	
	//Update the window icon
	m_windowIcon = lamexp_set_window_icon(this, lamexp_app_icon(), true);

	//Update header icon
	ui->label_headerIcon->setPixmap(lamexp_app_icon().pixmap(ui->label_headerIcon->size()));
	
	//Setup version info
	ui->label_versionInfo->setText(QString().sprintf("v%d.%02d %s (Build %d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build()));
	ui->label_versionInfo->installEventFilter(this);

	//Register meta type
	qRegisterMetaType<QUuid>("QUuid");

	//Center window in screen
	QRect desktopRect = QApplication::desktop()->screenGeometry();
	QRect thisRect = this->geometry();
	move((desktopRect.width() - thisRect.width()) / 2, (desktopRect.height() - thisRect.height()) / 2);
	setMinimumSize(thisRect.width(), thisRect.height());

	//Enable buttons
	connect(ui->button_AbortProcess, SIGNAL(clicked()), this, SLOT(abortEncoding()));
	
	//Init progress indicator
	m_progressIndicator = new QMovie(":/images/Working.gif");
	m_progressIndicator->setCacheMode(QMovie::CacheAll);
	ui->label_headerWorking->setMovie(m_progressIndicator);
	ui->progressBar->setValue(0);

	//Init progress model
	m_progressModel = new ProgressModel();
	ui->view_log->setModel(m_progressModel);
	ui->view_log->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
	ui->view_log->verticalHeader()->hide();
	ui->view_log->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
	ui->view_log->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
	ui->view_log->viewport()->installEventFilter(this);
	connect(m_progressModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(progressModelChanged()));
	connect(m_progressModel, SIGNAL(modelReset()), this, SLOT(progressModelChanged()));
	connect(ui->view_log, SIGNAL(activated(QModelIndex)), this, SLOT(logViewDoubleClicked(QModelIndex)));
	connect(ui->view_log->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(logViewSectionSizeChanged(int,int,int)));

	//Create context menu
	m_contextMenu = new QMenu();
	QAction *contextMenuDetailsAction = m_contextMenu->addAction(QIcon(":/icons/zoom.png"), tr("Show details for selected job"));
	QAction *contextMenuShowFileAction = m_contextMenu->addAction(QIcon(":/icons/folder_go.png"), tr("Browse Output File Location"));
	m_contextMenu->addSeparator();

	//Create "filter" context menu
	m_progressViewFilterGroup = new QActionGroup(this);
	QAction *contextMenuFilterAction[5] = {NULL, NULL, NULL, NULL, NULL};
	if(QMenu *filterMenu = m_contextMenu->addMenu(QIcon(":/icons/filter.png"), tr("Filter Log Items")))
	{
		contextMenuFilterAction[0] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobRunning), tr("Show Running Only"));
		contextMenuFilterAction[1] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobComplete), tr("Show Succeeded Only"));
		contextMenuFilterAction[2] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobFailed), tr("Show Failed Only"));
		contextMenuFilterAction[3] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobSkipped), tr("Show Skipped Only"));
		contextMenuFilterAction[4] = filterMenu->addAction(m_progressModel->getIcon(ProgressModel::JobState(-1)), tr("Show All Items"));
		if(QAction *act = contextMenuFilterAction[0]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobRunning); }
		if(QAction *act = contextMenuFilterAction[1]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobComplete); }
		if(QAction *act = contextMenuFilterAction[2]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobFailed); }
		if(QAction *act = contextMenuFilterAction[3]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(ProgressModel::JobSkipped); }
		if(QAction *act = contextMenuFilterAction[4]) { m_progressViewFilterGroup->addAction(act); act->setCheckable(true); act->setData(-1); act->setChecked(true); }
	}

	//Create info label
	if(m_filterInfoLabel = new QLabel(ui->view_log))
	{
		m_filterInfoLabel->setFrameShape(QFrame::NoFrame);
		m_filterInfoLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
		m_filterInfoLabel->setUserData(0, new IntUserData(-1));
		SET_FONT_BOLD(m_filterInfoLabel, true);
		SET_TEXT_COLOR(m_filterInfoLabel, Qt::darkGray);
		m_filterInfoLabel->setContextMenuPolicy(Qt::CustomContextMenu);
		connect(m_filterInfoLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
		m_filterInfoLabel->hide();
	}
	if(m_filterInfoLabelIcon = new QLabel(ui->view_log))
	{
		m_filterInfoLabelIcon->setFrameShape(QFrame::NoFrame);
		m_filterInfoLabelIcon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
		m_filterInfoLabelIcon->setContextMenuPolicy(Qt::CustomContextMenu);
		const QIcon &ico = m_progressModel->getIcon(ProgressModel::JobState(-1));
		m_filterInfoLabelIcon->setPixmap(ico.pixmap(16, 16));
		connect(m_filterInfoLabelIcon, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
		m_filterInfoLabelIcon->hide();
	}

	//Connect context menu
	ui->view_log->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(ui->view_log, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTriggered(QPoint)));
	connect(contextMenuDetailsAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuDetailsActionTriggered()));
	connect(contextMenuShowFileAction, SIGNAL(triggered(bool)), this, SLOT(contextMenuShowFileActionTriggered()));
	for(size_t i = 0; i < 5; i++)
	{
		if(contextMenuFilterAction[i]) connect(contextMenuFilterAction[i], SIGNAL(triggered(bool)), this, SLOT(contextMenuFilterActionTriggered()));
	}
	SET_FONT_BOLD(contextMenuDetailsAction, true);

	//Enque jobs
	if(fileListModel)
	{
		for(int i = 0; i < fileListModel->rowCount(); i++)
		{
			m_pendingJobs.append(fileListModel->getFile(fileListModel->index(i,0)));
		}
	}

	//Translate
	ui->label_headerStatus->setText(QString("<b>%1</b><br>%2").arg(tr("Encoding Files"), tr("Your files are being encoded, please be patient...")));
	
	//Enable system tray icon
	connect(m_systemTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason)));

	//Init other vars
	m_runningThreads = 0;
	m_currentFile = 0;
	m_allJobs.clear();
	m_succeededJobs.clear();
	m_failedJobs.clear();
	m_skippedJobs.clear();
	m_userAborted = false;
	m_forcedAbort = false;
	m_timerStart = 0I64;
}