Esempio n. 1
0
	GridRenderer::GridRenderer(RenderBackend* renderbackend, int position):
		RendererBase(renderbackend, position) {
		setEnabled(false);
	}
Esempio n. 2
0
void ScrollList::enableGame()
{
	setEnabled( true );
}
/**
 * Generate scez file menu slot function.
 */
void CreateSceFile::generateCompressedFileSlot()
{
    bool success = false;
    QString sceFileName = ui->fileLineEdit->text() + "/" + QFileInfo(ui->fileLineEdit->text()).fileName() + ".sce";
    ScriptFile fileHelper(this, sceFileName, false);
    QStringList copiedFiles;

    if(!isExecutableScriptInFilesTable())
    {
        QMessageBox::information(this, "could not start generation", "No executable script defined.");
        return;
    }

    setEnabled(false);

    ui->progressBar->setValue(0);
    ui->progressBar->setMinimum(0);
    ui->progressBar->setMaximum(ui->filesTableWidget->rowCount() * 2);

    statusBar()->showMessage("generating scez file", 0);

    generateSlot(&copiedFiles, ui->progressBar, &success);
    if(success)
    {
        copiedFiles << sceFileName;
        QString zipFileName = ui->fileLineEdit->text() + ".scez";

        (void)fileHelper.deleteFile(zipFileName, false);

        QList<QStringList> fileList;
        QString rootDir = QDir(QFileInfo(sceFileName).path()).absolutePath();
        for(auto el : copiedFiles)
        {
            QStringList entry;
            entry << el;
            entry << QFileInfo(el).filePath().remove(0, rootDir.length() + 1);
            fileList << entry;
        }

        success = ScriptFile::zipFiles(zipFileName, fileList, ui->progressBar);
        if(!success)
        {
            (void)QFile::remove(zipFileName);
        }
        else
        {
            QFile inFile;
            inFile.setFileName(zipFileName);

            success = inFile.open(QIODevice::ReadOnly);
            if(success)
            {
                QCryptographicHash hashObject(QCryptographicHash::Sha512);
                success = hashObject.addData(&inFile);
                if(success)
                {   inFile.close();
                    success = inFile.open(QIODevice::Append);
                    if(success)
                    {
                        (void)inFile.seek(inFile.size());
                        QByteArray hash = hashObject.result();
                        success = (inFile.write(hash) == hash.length()) ? true : false;
                    }
                }

                inFile.close();
            }
        }
    }

    //Delete the sce folder.
    (void)QDir(ui->fileLineEdit->text()).removeRecursively();

    if(success)
    {
        QMessageBox::information(this, "information", "scez file creation succeeded");
        statusBar()->showMessage("scez file created", 5000);
    }
    else
    {
        statusBar()->showMessage("scez file creation failed", 5000);
    }

    setEnabled(true);
}
Esempio n. 4
0
void RenderPlugin::applyItemState()
{
    setEnabled( d->m_item.checkState() == Qt::Checked );
}
Esempio n. 5
0
void BtOpenWorkAction::slotModelChanged() {
    setEnabled(m_menu->postFilterModel()->rowCount() > 0);
}
Esempio n. 6
0
void CAntiFlashhack::unload() {
	setEnabled(false);
	if( m_flFlashTill != NULL )
		delete[] m_flFlashTill;
	m_flFlashTill = NULL;
}
Esempio n. 7
0
void DGLMainWindow::createActions() {

    // create "QActions" - bindings between mainwindow clickable widgets,
    // and
    // local slots

    quitAct = new QAction(tr("&Quit"), this);
    quitAct->setShortcuts(QKeySequence::Quit);
    quitAct->setStatusTip(tr("Quit the application"));
    CONNASSERT(quitAct, SIGNAL(triggered()), this, SLOT(close()));
    quitAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4));

    aboutAct = new QAction(tr("&About"), this);
    aboutAct->setStatusTip(tr("Show the application's About box"));
    CONNASSERT(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
    aboutAct->setShortcut(QKeySequence(Qt::Key_F1));

    newProjectAct = new QAction(tr("&New Project..."), this);
    newProjectAct->setStatusTip(tr("Created new debugging project"));
    CONNASSERT(newProjectAct, SIGNAL(triggered()), this, SLOT(newProject()));
    newProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));


    openProjectAct = new QAction(tr("&Open Project..."), this);
    openProjectAct->setStatusTip(tr("Opens a debugging project"));
    CONNASSERT(openProjectAct, SIGNAL(triggered()), this, SLOT(openProject())); //TODO: implement
    openProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));

    saveProjectAct = new QAction(tr("&Save Project"), this);
    saveProjectAct->setStatusTip(tr("Save a debugging project"));
    CONNASSERT(saveProjectAct, SIGNAL(triggered()), this, SLOT(saveProject())); //TODO: implement
    saveProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));

    saveAsProjectAct = new QAction(tr("&Save Project As ..."), this);
    saveAsProjectAct->setStatusTip(tr("Save a debugging project as as a file ..."));
    CONNASSERT(saveAsProjectAct, SIGNAL(triggered()), this, SLOT(saveProjectAs())); //TODO: implement
    saveAsProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S));
    

    projectProperiesAct = new QAction(tr("&Project properties..."), this);
    projectProperiesAct->setStatusTip(tr("Change properties of current project"));
    CONNASSERT(projectProperiesAct, SIGNAL(triggered()), this, SLOT(projectProperties()));
    

    closeProjectAct = new QAction(tr("&Close project"), this);
    closeProjectAct->setStatusTip(tr("Created new debugging project"));
    CONNASSERT(closeProjectAct, SIGNAL(triggered()), this, SLOT(closeProject()));

    debugStartAct = new QAction(tr("&Start debugging"), this);
    debugStartAct->setStatusTip(tr("Stop debugging."));
    CONNASSERT(debugStartAct, SIGNAL(triggered()), this, SLOT(debugStart()));
    CONNASSERT(&m_controller, SIGNAL(setDisconnected(bool)), debugStartAct,
        SLOT(setVisible(bool)));
    debugStartAct->setShortcut(QKeySequence(Qt::Key_F5));

    debugStopAct = new QAction(tr("Sto&p debugging"), this);
    debugStopAct->setStatusTip(tr("Stop debugging."));
    CONNASSERT(debugStopAct, SIGNAL(triggered()), this, SLOT(debugStop()));
    CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStopAct,
        SLOT(setEnabled(bool)));
    debugStopAct->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F5));
    debugStopAct->setEnabled(false);

    debugTerminateAct = new QAction(tr("Terminate"), this);
    debugTerminateAct->setStatusTip(tr("Terminate debugged process."));
    CONNASSERT(debugTerminateAct, SIGNAL(triggered()), this, SLOT(debugTerminate()));
    CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugTerminateAct,
        SLOT(setEnabled(bool)));
    debugTerminateAct->setEnabled(false);

    debugContinueAct = new QAction(tr("&Continue"), this);
    debugContinueAct->setStatusTip(tr("Continue program execution"));
    CONNASSERT(debugContinueAct, SIGNAL(triggered()), &m_controller,
               SLOT(debugContinue()));
    CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugContinueAct,
               SLOT(setVisible(bool)));
    CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugContinueAct,
               SLOT(setEnabled(bool)));
    debugContinueAct->setShortcut(QKeySequence(Qt::Key_F5));
    debugContinueAct->setVisible(false);

    debugInterruptAct = new QAction(tr("&Break on next call"), this);
    debugInterruptAct->setStatusTip(
            tr("Break program execution on GL call"));
    CONNASSERT(debugInterruptAct, SIGNAL(triggered()), &m_controller,
               SLOT(debugInterrupt()));
    CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugInterruptAct,
               SLOT(setEnabled(bool)));
    CONNASSERT(&m_controller, SIGNAL(setRunning(bool)), debugInterruptAct,
               SLOT(setEnabled(bool)));
    debugInterruptAct->setShortcut(QKeySequence(Qt::Key_F6));
    debugInterruptAct->setEnabled(false);

    debugStepAct = new QAction(tr("&Step"), this);
    debugStepAct->setStatusTip(tr("Step one GL call"));
    CONNASSERT(debugStepAct, SIGNAL(triggered()), &m_controller,
               SLOT(debugStep()));
    CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepAct,
               SLOT(setEnabled(bool)));
    CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepAct,
               SLOT(setEnabled(bool)));
    debugStepAct->setShortcut(QKeySequence(Qt::Key_F11));
    debugStepAct->setEnabled(false);

    debugStepDrawCallAct = new QAction(tr("&Draw step"), this);
    debugStepDrawCallAct->setStatusTip(tr("Step one GL drawing call"));
    CONNASSERT(debugStepDrawCallAct, SIGNAL(triggered()), &m_controller,
               SLOT(debugStepDrawCall()));
    CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepDrawCallAct,
               SLOT(setEnabled(bool)));
    CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepDrawCallAct,
               SLOT(setEnabled(bool)));
    debugStepDrawCallAct->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F11));
    debugStepDrawCallAct->setEnabled(false);

    debugStepFrameAct = new QAction(tr("&Frame step"), this);
    debugStepFrameAct->setStatusTip(tr("Step one GL frame"));
    CONNASSERT(debugStepFrameAct, SIGNAL(triggered()), &m_controller,
               SLOT(debugStepFrame()));
    CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepFrameAct,
               SLOT(setEnabled(bool)));
    CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepFrameAct,
               SLOT(setEnabled(bool)));
    debugStepFrameAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F11));
    debugStepFrameAct->setEnabled(false);

    addDeleteBreakPointsAct = new QAction(tr("&Breakpoints..."), this);
    addDeleteBreakPointsAct->setStatusTip(tr("Add or remove breakpoints"));
    CONNASSERT(addDeleteBreakPointsAct, SIGNAL(triggered()), this,
               SLOT(addDeleteBreakPoints()));
    addDeleteBreakPointsAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B));

    setBreakOnGLErrorAct = new QAction(tr("Break on GL error"), this);
    setBreakOnGLErrorAct->setStatusTip(
            tr("Break execution on GL error (glGetError() != GL_NO_ERROR)"));

    // this action has a state - it is checbox-like checkable

    DGLConfiguration& currentConfig = m_controller.getConfig();

    setBreakOnGLErrorAct->setCheckable(true);
    setBreakOnGLErrorAct->setChecked(currentConfig.m_BreakOnGLError);
    CONNASSERT(setBreakOnGLErrorAct, SIGNAL(toggled(bool)), this,
               SLOT(setBreakOnWhatever(bool)));

    setBreakOnDebugOutputAct = new QAction(tr("Break on debug output"), this);
    setBreakOnDebugOutputAct->setStatusTip(
            tr("Break execution on debug output message"));

    // this action has a state - it is checbox-like checkable

    setBreakOnDebugOutputAct->setCheckable(true);
    setBreakOnDebugOutputAct->setChecked(
            currentConfig.m_BreakOnGLError);
    CONNASSERT(setBreakOnDebugOutputAct, SIGNAL(toggled(bool)), this,
               SLOT(setBreakOnWhatever(bool)));

    setBreakOnCompilerErrAct =
            new QAction(tr("Break on compiler/linker error"), this);
    setBreakOnCompilerErrAct->setStatusTip(
            tr("Break execution on debug GLSL compiler or linker error"));

    // this action has a state - it is checbox-like checkable

    setBreakOnCompilerErrAct->setCheckable(true);
    setBreakOnCompilerErrAct->setChecked(
            currentConfig.m_BreakOnCompilerError);
    CONNASSERT(setBreakOnCompilerErrAct, SIGNAL(toggled(bool)), this,
               SLOT(setBreakOnWhatever(bool)));

    // Only one color scheme can be choosed - put all related actions to
    // action
    // group

    setColorSchemeActGroup = new QActionGroup(this);

    // iterate through all color schemes. for each one create one action

    for (uint i = 0; i < DGLNUM_COLOR_SCHEMES; i++) {
        setColorSchemeActs[i] = new QAction(tr(dglColorSchemes[i].name), this);
        setColorSchemeActs[i]->setCheckable(true);
        setColorSchemeActs[i]->setActionGroup(setColorSchemeActGroup);
        setColorSchemeActs[i]->setStatusTip(tr("Set this color scheme"));

        // connect all color scheme actions to one mapper, so we can connect
        // it
        // later to only one signal

        m_SetColorSchemeSignalMapper.setMapping(setColorSchemeActs[i], i);
        CONNASSERT(setColorSchemeActs[i], SIGNAL(triggered()),
                   &m_SetColorSchemeSignalMapper, SLOT(map()));
    }

    // mapper maps connected actions to one emitted signal by int parameter.
    // Connect this signal to "this"

    CONNASSERT(&m_SetColorSchemeSignalMapper, SIGNAL(mapped(int)), this,
               SLOT(setColorScheme(int)));

    configurationAct = new QAction(tr("Configuration..."), this);
    configurationAct->setStatusTip(tr("Configuration options"));
    CONNASSERT(configurationAct, SIGNAL(triggered()), this, SLOT(configure()));

    prepareAndroidAct = new QAction(tr("Prepare Android device..."), this);
    prepareAndroidAct->setStatusTip(tr("Installs " DGL_PRODUCT " on Android device"));
    CONNASSERT(prepareAndroidAct, SIGNAL(triggered()), this,
               SLOT(androidPrepare()));
}
Esempio n. 8
0
DdeFaceTracker::~DdeFaceTracker() {
    setEnabled(false);
}
Esempio n. 9
0
//------------------------------------------------------------------
//
// MenuLayer4
//
//------------------------------------------------------------------
MenuLayer4::MenuLayer4()
{
    MenuItemFont::setFontName("American Typewriter");
    MenuItemFont::setFontSize(18);
    auto title1 = MenuItemFont::create("Sound");
    title1->setEnabled(false);
    MenuItemFont::setFontName( "fonts/Marker Felt.ttf" );
    MenuItemFont::setFontSize(34);
    auto item1 = MenuItemToggle::createWithCallback( CC_CALLBACK_1(MenuLayer4::menuCallback, this),
                 MenuItemFont::create( "On" ),
                 MenuItemFont::create( "Off"),
                 nullptr );

    MenuItemFont::setFontName( "American Typewriter" );
    MenuItemFont::setFontSize(18);
    auto title2 = MenuItemFont::create( "Music" );
    title2->setEnabled(false);
    MenuItemFont::setFontName( "fonts/Marker Felt.ttf" );
    MenuItemFont::setFontSize(34);
    auto item2 = MenuItemToggle::createWithCallback(CC_CALLBACK_1(MenuLayer4::menuCallback, this),
                 MenuItemFont::create( "On" ),
                 MenuItemFont::create( "Off"),
                 nullptr );

    MenuItemFont::setFontName( "American Typewriter" );
    MenuItemFont::setFontSize(18);
    auto title3 = MenuItemFont::create( "Quality" );
    title3->setEnabled( false );
    MenuItemFont::setFontName( "fonts/Marker Felt.ttf" );
    MenuItemFont::setFontSize(34);
    auto item3 = MenuItemToggle::createWithCallback(CC_CALLBACK_1(MenuLayer4::menuCallback, this),
                 MenuItemFont::create( "High" ),
                 MenuItemFont::create( "Low" ),
                 nullptr );

    MenuItemFont::setFontName( "American Typewriter" );
    MenuItemFont::setFontSize(18);
    auto title4 = MenuItemFont::create( "Orientation" );
    title4->setEnabled(false);
    MenuItemFont::setFontName( "fonts/Marker Felt.ttf" );
    MenuItemFont::setFontSize(34);
    auto item4 = MenuItemToggle::createWithCallback(CC_CALLBACK_1(MenuLayer4::menuCallback, this),
                 MenuItemFont::create( "Off" ),
                 nullptr );

    // TIP: you can manipulate the items like any other MutableArray
    item4->getSubItems().pushBack( MenuItemFont::create( "33%" ) );
    item4->getSubItems().pushBack( MenuItemFont::create( "66%" ) );
    item4->getSubItems().pushBack( MenuItemFont::create( "100%" ) );

    // you can change the one of the items by doing this
    item4->setSelectedIndex( 2 );

    MenuItemFont::setFontName( "fonts/Marker Felt.ttf" );
    MenuItemFont::setFontSize( 34 );

    auto label = Label::createWithBMFont("fonts/bitmapFontTest3.fnt",  "go back");
    auto back = MenuItemLabel::create(label, CC_CALLBACK_1(MenuLayer4::backCallback, this) );

    auto menu = Menu::create(
                    title1, title2,
                    item1, item2,
                    title3, title4,
                    item3, item4,
                    back, nullptr ); // 9 items.

    menu->alignItemsInColumns(2, 2, 2, 2, 1, NULL);

    addChild( menu );

    auto s = Director::getInstance()->getWinSize();
    menu->setPosition(Vec2(s.width/2, s.height/2));
}
Esempio n. 10
0
/*!
   Constructor
   \param parent Widget to be magnified
*/
QwtMagnifier::QwtMagnifier( QWidget *parent ):
    QObject( parent )
{
    d_data = new PrivateData();
    setEnabled( true );
}
Esempio n. 11
0
 void toggleEnabled(void) { setEnabled(! enabled_); }
Esempio n. 12
0
 //-----------------------------------------------------------------------
 void ParticleEmitter::setStartTime(Real startTime)
 {
     setEnabled(false);
     mStartTime = startTime;
 }
Esempio n. 13
0
void ChatControllerBase::setOnline(bool online) {
	setEnabled(online);
}
Esempio n. 14
0
 	GridRenderer::GridRenderer(const GridRenderer& old):
		RendererBase(old) {
		setEnabled(false);
	}
 void handleUpdateFinished(void) {setEnabled(true);}
Esempio n. 16
0
Menu::Menu(MenuRole role, QWidget *parent) : QMenu(parent),
	m_actionGroup(NULL),
	m_bookmark(NULL),
	m_role(role)
{
	switch (role)
	{
		case BookmarksMenuRole:
		case BookmarkSelectorMenuRole:
		case NotesMenuRole:
			{
				installEventFilter(this);

				Menu *parentMenu = qobject_cast<Menu*>(parent);

				if (!parentMenu || parentMenu->getRole() != m_role)
				{
					if (m_role == NotesMenuRole)
					{
						connect(NotesManager::getModel(), SIGNAL(modelModified()), this, SLOT(clearModelMenu()));
					}
					else
					{
						connect(BookmarksManager::getModel(), SIGNAL(modelModified()), this, SLOT(clearModelMenu()));
					}
				}

				connect(this, SIGNAL(aboutToShow()), this, SLOT(populateModelMenu()));
			}

			break;
		case CharacterEncodingMenuRole:
			connect(this, SIGNAL(aboutToShow()), this, SLOT(populateCharacterEncodingMenu()));
			connect(this, SIGNAL(triggered(QAction*)), this, SLOT(selectCharacterEncoding(QAction*)));

			break;
		case ClosedWindowsMenu:
			{
				setIcon(Utils::getIcon(QLatin1String("user-trash")));

				MainWindow *mainWindow = MainWindow::findMainWindow(parent);

				if (mainWindow)
				{
					setEnabled(!SessionsManager::getClosedWindows().isEmpty() || !mainWindow->getWindowsManager()->getClosedWindows().isEmpty());

					connect(mainWindow->getWindowsManager(), SIGNAL(closedWindowsAvailableChanged(bool)), this, SLOT(updateClosedWindowsMenu()));
				}

				connect(SessionsManager::getInstance(), SIGNAL(closedWindowsChanged()), this, SLOT(updateClosedWindowsMenu()));
				connect(this, SIGNAL(aboutToShow()), this, SLOT(populateClosedWindowsMenu()));
			}

			break;
		case ImportExportMenuRole:
			QMenu::addAction(tr("Import Opera Bookmarks…"))->setData(QLatin1String("OperaBookmarks"));
			QMenu::addAction(tr("Import HTML Bookmarks…"))->setData(QLatin1String("HtmlBookmarks"));
			QMenu::addSeparator();
			QMenu::addAction(tr("Import Opera Notes…"))->setData(QLatin1String("OperaNotes"));

			connect(this, SIGNAL(triggered(QAction*)), this, SLOT(openImporter(QAction*)));

			break;
		case SessionsMenuRole:
			connect(this, SIGNAL(aboutToShow()), this, SLOT(populateSessionsMenu()));
			connect(this, SIGNAL(triggered(QAction*)), this, SLOT(openSession(QAction*)));

			break;
		case ToolBarsMenuRole:
			connect(this, SIGNAL(aboutToShow()), this, SLOT(populateToolBarsMenu()));

			break;
		case UserAgentMenuRole:
			connect(this, SIGNAL(aboutToShow()), this, SLOT(populateUserAgentMenu()));
			connect(this, SIGNAL(triggered(QAction*)), this, SLOT(selectUserAgent(QAction*)));

			break;
		case WindowsMenuRole:
			connect(this, SIGNAL(aboutToShow()), this, SLOT(populateWindowsMenu()));
			connect(this, SIGNAL(triggered(QAction*)), this, SLOT(selectWindow(QAction*)));

			break;
		default:
			break;
	}
}
Esempio n. 17
0
QSocketNotifier::~QSocketNotifier()
{
    setEnabled( FALSE );
}
Esempio n. 18
0
void Menu::updateClosedWindowsMenu()
{
	MainWindow *mainWindow = MainWindow::findMainWindow(parent());

	setEnabled((mainWindow && mainWindow->getWindowsManager()->getClosedWindows().count() > 0) || SessionsManager::getClosedWindows().count() > 0);
}
Esempio n. 19
0
void controlUC::setAttribute(PCWSTR pstrName, PCWSTR pstrValue)
{
	if( _tcscmp(pstrName, L"pos") == 0 ) {
		RECT rcPos = { 0 };
		PWSTR pstr = NULL;
		rcPos.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcPos.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcPos.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcPos.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);    
		SIZE szXY = {rcPos.left >= 0 ? rcPos.left : rcPos.right, rcPos.top >= 0 ? rcPos.top : rcPos.bottom};
		setFixedXY(szXY);
		setFixedWidth(rcPos.right - rcPos.left);
		setFixedHeight(rcPos.bottom - rcPos.top);
	}
	else if( _tcscmp(pstrName, L"relativepos") == 0 ) {
		SIZE szMove,szZoom;
		PWSTR pstr = NULL;
		szMove.cx = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		szMove.cy = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		szZoom.cx = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		szZoom.cy = _tcstol(pstr + 1, &pstr, 10); assert(pstr); 
		setRelativePos(szMove,szZoom);
	}
	else if( _tcscmp(pstrName, L"padding") == 0 ) {
		RECT rcPadding = { 0 };
		PWSTR pstr = NULL;
		rcPadding.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcPadding.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcPadding.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);    
		setPadding(rcPadding);
	}
	else if( _tcscmp(pstrName, L"bkcolor") == 0 || _tcscmp(pstrName, L"bkcolor1") == 0 ) {
		while( *pstrValue > L'\0' && *pstrValue <= L' ')  pstrValue = ::CharNext(pstrValue);
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		PWSTR pstr = NULL;
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"bordercolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		PWSTR pstr = NULL;
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setBorderColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"focusbordercolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		PWSTR pstr = NULL;
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setFocusBorderColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"bordersize") == 0 ) setBorderSize(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"borderround") == 0 ) {
		SIZE cxyRound = { 0 };
		PWSTR pstr = NULL;
		cxyRound.cx = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		cxyRound.cy = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);     
		setBorderRound(cxyRound);
	}
	else if( _tcscmp(pstrName, L"width") == 0 ) setFixedWidth(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"height") == 0 ) setFixedHeight(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"minwidth") == 0 ) setMinWidth(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"minheight") == 0 ) setMinHeight(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"maxwidth") == 0 ) setMaxWidth(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"maxheight") == 0 ) setMaxHeight(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"name") == 0 ) setName(pstrValue);
	else if( _tcscmp(pstrName, L"text") == 0 ) setText(pstrValue);
	else if( _tcscmp(pstrName, L"tooltip") == 0 ) setToolTip(pstrValue);
	else if( _tcscmp(pstrName, L"userdata") == 0 ) setUserData(pstrValue);
	else if( _tcscmp(pstrName, L"enabled") == 0 ) setEnabled(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"mouse") == 0 ) setMouseEnabled(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"visible") == 0 ) setVisible(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"float") == 0 ) setFloat(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"shortcut") == 0 ) setShortcut(pstrValue[0]);
	else if( _tcscmp(pstrName, L"menu") == 0 ) setContextMenuUsed(_tcscmp(pstrValue, L"true") == 0);
}
Esempio n. 20
0
//-----------------------------------------------------------------------
void PUObserver::notifyStart (void)
{
    _eventHandlersExecuted = false;
    _observe = true;
    setEnabled(_originalEnabled);
}
Esempio n. 21
0
void Sensors::setMesurementData(cocos2d::Node *panel,
                                lib::object::LocationItem &location_item) {

  auto p_panel_record = panel->getChildByName<ui::Layout *>("panelRecord");

  std::stringstream ss;
  auto p_text_sensor_id =
      p_panel_record->getChildByName<ui::Text *>("txtSenserId");
  ss << location_item.sensor1_device_id << "(" << location_item.tube_name << "/"
     << location_item.conversion_rate << ")";

  std::string sensor1_device_id = "device_id : " + ss.str();
  ss.clear();
  p_text_sensor_id->setContentSize(Size(400, 150));
  p_text_sensor_id->setPositionX(220);
  p_text_sensor_id->setString(sensor1_device_id);

  auto p_text_city = p_panel_record->getChildByName<ui::Text *>("textCity");
  p_text_city->setString(location_item.name_en);

  int cpm = location_item.recent_value;
  std::stringstream ss1, ss2, ss3;
  ss1 << cpm;
  auto p_text_recent_cpm =
      p_panel_record->getChildByName<ui::Text *>("textRecentCpm");
  p_text_recent_cpm->setString(ss1.str());
  ss1.clear();
  double usv =
      lib::Util::round((double)cpm / (double)location_item.conversion_rate, 3);
  ss2 << usv;
  auto p_text_recent_usv =
      p_panel_record->getChildByName<ui::Text *>("textRecentuSv");
  p_text_recent_usv->setString(ss2.str());

  auto p_text_sensor_status =
      p_panel_record->getChildByName<ui::Text *>("txtSensorStatus");
  std::string status_str;
  cocos2d::Color4B color;
  switch (location_item.sensor_status) {
  case 1: {
    status_str = "Online";
    color = Color4B(91, 192, 222, 255);
    break;
  }
  case 2: {
    status_str = "Offline";
    color = Color4B(217, 83, 79, 255);
    break;
  }
  case 3: {
    status_str = "Offline long";
    color = Color4B(217, 83, 79, 255);
    break;
  }
  }

  p_text_sensor_status->setString(status_str);
  p_text_sensor_status->setTextColor(color);

  p_text_recent_usv->setString(ss2.str());

  auto p_txt_recent_datetime =
      p_panel_record->getChildByName<ui::Text *>("txtRecentDatetime");
  std::string captured_at = location_item.recent_captured_at;
  p_txt_recent_datetime->setString(captured_at);

  // aggregations
  std::stringstream ss4, ss5, ss6;

  double avg_value = static_cast<double>(location_item.yesterday_average_value /
                                         location_item.conversion_rate);
  double peak_value = static_cast<double>(location_item.yesterday_peak_value /
                                          location_item.conversion_rate);

  // @note round method
  avg_value = lib::Util::round(avg_value, 3);
  peak_value = lib::Util::round(peak_value, 3);

  ss4 << avg_value << " μSv/hour";
  ss5 << peak_value << " μSv/hour";

  CCLOG("peak_value : %s, avg_value : %s", ss5.str().c_str(),
        ss4.str().c_str());

  auto p_text_avg_value =
      p_panel_record->getChildByName<ui::Text *>("txtYesterdayAverage");
  p_text_avg_value->setString(ss4.str());
  auto p_text_peak_value =
      p_panel_record->getChildByName<ui::Text *>("txtYesterdayPeak");
  p_text_peak_value->setString(ss5.str());

  // favorite
  auto p_button_favorite =
      p_panel_record->getChildByName<ui::Button *>("btnFavorite");

  auto flag = lib::Util::getFavorite(location_item.m_sensor_main_id);
  if (flag) {
    // enabled
    p_button_favorite->loadTextures("res/icon/menu/star_orange.png",
                                    "res/icon/menu/star_orange.png",
                                    "res/icon/menu/star_orange.png");
  } else {
    // disabled
    p_button_favorite->loadTextures("res/icon/menu/star_gray.png",
                                    "res/icon/menu/star_gray.png",
                                    "res/icon/menu/star_gray.png");
  }

  p_button_favorite->setEnabled(false);
}
Esempio n. 22
0
ThingRulesView::ThingRulesView(QWidget* parent) :
	QTableView(parent),
	thingRulesTableModel(NULL)
{
	setEnabled(false);
}
Esempio n. 23
0
void RenderPlugin::setSettings( const QHash<QString,QVariant> &settings )
{
    setEnabled( settings.value( "enabled", enabled() ).toBool() );
    setVisible( settings.value( "visible", visible() ).toBool() );
}
Esempio n. 24
0
void ConnectionSettingsPage::clientDisconnected()
{
    setEnabled(false);
    setChangedState(false);
}
bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem)
{
	LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");

	if(!editor)
	{
		llwarns << "Cannot get handle to the notecard editor." << llendl;
		return false;
	}

	if(!editor->isPristine())
	{
		// We need to update the asset information
		LLTransactionID tid;
		LLAssetID asset_id;
		tid.generate();
		asset_id = tid.makeAssetID(gAgent.getSecureSessionID());

		LLVFile file(gVFS, asset_id, LLAssetType::AT_NOTECARD, LLVFile::APPEND);

		std::string buffer;
		if (!editor->exportBuffer(buffer))
		{
			return false;
		}

		editor->makePristine();

		S32 size = buffer.length() + 1;
		file.setMaxSize(size);
		file.write((U8*)buffer.c_str(), size);

		const LLInventoryItem* item = getItem();
		// save it out to database
		if (item)
		{			
			const LLViewerRegion* region = gAgent.getRegion();
			if (!region)
			{
				llwarns << "Not connected to a region, cannot save notecard." << llendl;
				return false;
			}
			std::string agent_url = region->getCapability("UpdateNotecardAgentInventory");
			std::string task_url = region->getCapability("UpdateNotecardTaskInventory");

			if (mObjectUUID.isNull() && !agent_url.empty())
			{
				// Saving into agent inventory
				mAssetStatus = PREVIEW_ASSET_LOADING;
				setEnabled(FALSE);
				LLSD body;
				body["item_id"] = mItemUUID;
				llinfos << "Saving notecard " << mItemUUID
					<< " into agent inventory via " << agent_url << llendl;
				LLHTTPClient::post(agent_url, body,
					new LLUpdateAgentInventoryResponder(body, asset_id, LLAssetType::AT_NOTECARD));
			}
			else if (!mObjectUUID.isNull() && !task_url.empty())
			{
				// Saving into task inventory
				mAssetStatus = PREVIEW_ASSET_LOADING;
				setEnabled(FALSE);
				LLSD body;
				body["task_id"] = mObjectUUID;
				body["item_id"] = mItemUUID;
				llinfos << "Saving notecard " << mItemUUID << " into task "
					<< mObjectUUID << " via " << task_url << llendl;
				LLHTTPClient::post(task_url, body,
					new LLUpdateTaskInventoryResponder(body, asset_id, LLAssetType::AT_NOTECARD));
			}
			else if (gAssetStorage)
			{
				LLSaveNotecardInfo* info = new LLSaveNotecardInfo(this, mItemUUID, mObjectUUID,
																tid, copyitem);
				gAssetStorage->storeAssetData(tid, LLAssetType::AT_NOTECARD,
												&onSaveComplete,
												(void*)info,
												FALSE);
			}
			else // !gAssetStorage
			{
				llwarns << "Not connected to an asset storage system." << llendl;
				return false;
			}
		}
	}
	return true;
}
Esempio n. 26
0
void ConnectionSettingsPage::initDone()
{
    setEnabled(true);
}
Esempio n. 27
0
void OSCheckBox::onModelObjectRemove(Handle handle)
{
  m_modelObject.reset();
  m_property = "";
  setEnabled(false);
}
 void handleUpdateIntprogress(void) {setEnabled(false);}
/**
 * Generate sce file menu slot function.
 * @param copiedFilesOutput
 *      The copied files.
 * @param progress
 *      Pointer to a progress bar. The value of this progress bar
 *      is increased by one for every finished file in the files table.
 * @param resultPointer
 *      True on success.
 */
void CreateSceFile::generateSlot(QStringList* copiedFilesOutput, QProgressBar* progress, bool *resultPointer)
{
    QString sceFileName = ui->fileLineEdit->text() + "/" + QFileInfo(ui->fileLineEdit->text()).fileName() + ".sce";
    QFile file(sceFileName);
    file.remove();
    bool success = true;
    QStringList copiedFiles;

    if(!isExecutableScriptInFilesTable())
    {
        QMessageBox::information(this, "could not start generation", "No executable script defined.");
        return;
    }

    //Delete and create the sce folder.
    (void)QDir(ui->fileLineEdit->text()).removeRecursively();
    if(!QDir().mkpath(ui->fileLineEdit->text()))
    {
        QMessageBox::critical(this, "error", QString("could not create: %1").arg(ui->fileLineEdit->text()));
        return;
    }

    setEnabled(false);

    if(progress == 0)
    {
        progress = ui->progressBar;

        progress->setValue(0);
        progress->setMinimum(0);
        progress->setMaximum(ui->filesTableWidget->rowCount());
        statusBar()->showMessage("generating sce file", 0);
    }

    if(file.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        QTextStream data( &file );
        data.setCodec("UTF-8");
        data << createSceFile();
        file.close();

        for(int i = 0; i < ui->filesTableWidget->rowCount(); i++)
        {
            QString currentFolder = ui->filesTableWidget->item(i, COLUMN_SUBDIR)->text();
            currentFolder = QFileInfo(sceFileName).absolutePath() + "/" + currentFolder;
            QString source = ui->filesTableWidget->item(i, COLUMN_SOURCE)->text();

            if(!QFile().exists(currentFolder))
            {
                if(!QDir().mkpath(currentFolder))
                {
                    QMessageBox::critical(this, "error", QString("could not create: %1").arg(currentFolder));
                    success = false;
                    break;
                }
            }

            QString scriptName = QFileInfo(source).fileName();
            QString destinationFile = currentFolder + "/" + scriptName;
            destinationFile = QFileInfo(destinationFile).absoluteFilePath();
            QFile::remove(destinationFile);

            copiedFiles << destinationFile;

            if(!QFile::copy(source, destinationFile))
            {
                QMessageBox::critical(this, "error", QString("could not copy: %1").arg(source));
                success = false;
                break;
            }
            progress->setValue(progress->value() + 1);
        }

    }// if(file.open(QIODevice::WriteOnly | QIODevice::Text))
    else
    {
        QMessageBox::critical(this, "error", QString("could not create: %1").arg(sceFileName));
        success = false;
    }

    if(success)
    {
        if(copiedFilesOutput == 0)
        {
            QMessageBox::information(this, "information", "sce file creation succeeded");
            statusBar()->showMessage("sce file created", 5000);
        }
    }
    else
    {
        statusBar()->showMessage("sce file creation failed", 5000);

        //Delete the sce folder.
        (void)QDir(ui->fileLineEdit->text()).removeRecursively();

        //Delete all copied files.
        for(auto el : copiedFiles)
        {
            (void)QFile::remove(el);
        }

        (void)QFile::remove(sceFileName);
    }

    if(copiedFilesOutput == 0)
    {
        setEnabled(true);
    }
    else
    {
        *copiedFilesOutput = copiedFiles;
    }

    if(resultPointer != 0)
    {
        *resultPointer = success;
    }
}
Esempio n. 30
0
void qAnimationDlg::render(bool asSeparateFrames)
{
	if (!m_view3d)
	{
		assert(false);
		return;
	}
	QString outputFilename = outputFileLineEdit->text();

	//save to persistent settings
	{
		QSettings settings;
		settings.beginGroup("qAnimation");
		settings.setValue("filename", outputFilename);
		settings.endGroup();
	}

	setEnabled(false);

	//count the total number of frames
	int frameCount = countFrames(0);
	int fps = fpsSpinBox->value();
	int superRes = superResolutionSpinBox->value();

	//show progress dialog
	QProgressDialog progressDialog(QString("Frames: %1").arg(frameCount), "Cancel", 0, frameCount, this);
	progressDialog.setWindowTitle("Render");
	progressDialog.show();
	QApplication::processEvents();

#ifdef QFFMPEG_SUPPORT
	QScopedPointer<QVideoEncoder> encoder(0);
	QSize originalViewSize;
	if (!asSeparateFrames)
	{
		//get original viewport size
		originalViewSize = m_view3d->qtSize();

		//hack: as the encoder requires that the video dimensions are multiples of 8, we resize the window a little bit...
		{
			//find the nearest multiples of 8
			QSize customSize = originalViewSize;
			if (originalViewSize.width() % 8 || originalViewSize.height() % 8)
			{
				if (originalViewSize.width() % 8)
					customSize.setWidth((originalViewSize.width() / 8 + 1) * 8);
				if (originalViewSize.height() % 8)
					customSize.setHeight((originalViewSize.height() / 8 + 1) * 8);
				m_view3d->resize(customSize);
				QApplication::processEvents();
			}
		}

		int bitrate = bitrateSpinBox->value() * 1024;
		int gop = fps;
		encoder.reset(new QVideoEncoder(outputFilename, m_view3d->glWidth(), m_view3d->glHeight(), bitrate, gop, static_cast<unsigned>(fpsSpinBox->value())));
		QString errorString;
		if (!encoder->open(&errorString))
		{
			QMessageBox::critical(this, "Error", QString("Failed to open file for output: %1").arg(errorString));
			setEnabled(true);
			return;
		}
	}
#else
	if (!asSeparateFrames)
	{
		QMessageBox::critical(this, "Error", QString("Animation mode is not supported (no FFMPEG support)"));
		return;
	}
#endif

	bool lodWasEnabled = m_view3d->isLODEnabled();
	m_view3d->setLODEnabled(false);

	QDir outputDir( QFileInfo(outputFilename).absolutePath() );

	int frameIndex = 0;
	bool success = true;
	size_t vp1 = 0, vp2 = 0;
	while (getNextSegment(vp1, vp2))
	{
		Step& step1 = m_videoSteps[vp1];
		Step& step2 = m_videoSteps[vp2];

		ViewInterpolate interpolator(step1.viewport, step2.viewport);
		int frameCount = static_cast<int>( fps * step1.duration_sec );
		interpolator.setMaxStep(frameCount);

		cc2DViewportObject current_params;
		while ( interpolator.nextView( current_params ) )
		{
			applyViewport ( &current_params );

			//render to image
			QImage image = m_view3d->renderToImage(superRes, false, false, true );

			if (image.isNull())
			{
				QMessageBox::critical(this, "Error", "Failed to grab the screen!");
				success = false;
				break;
			}

			if (superRes > 1)
			{
				image = image.scaled(image.width()/superRes, image.height()/superRes, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
			}

			if (asSeparateFrames)
			{
				QString filename = QString("frame_%1.png").arg(frameIndex, 6, 10, QChar('0'));
				QString fullPath = outputDir.filePath(filename);
				if (!image.save(fullPath))
				{
					QMessageBox::critical(this, "Error", QString("Failed to save frame #%1").arg(frameIndex + 1));
					success = false;
					break;
				}
			}
			else
			{
#ifdef QFFMPEG_SUPPORT
				QString errorString;
				if (!encoder->encodeImage(image, frameIndex, &errorString))
				{
					QMessageBox::critical(this, "Error", QString("Failed to encode frame #%1: %2").arg(frameIndex + 1).arg(errorString));
					success = false;
					break;
				}
#endif
			}
			++frameIndex;
			progressDialog.setValue(frameIndex);
			QApplication::processEvents();
			if (progressDialog.wasCanceled())
			{
				QMessageBox::warning(this, "Warning", QString("Process has been cancelled"));
				success = false;
				break;
			}
		}

		if (!success)
		{
			break;
		}

		if (vp2 == 0)
		{
			//stop loop here!
			break;
		}
		vp1 = vp2;
	}

	m_view3d->setLODEnabled(lodWasEnabled);

#ifdef QFFMPEG_SUPPORT
	if (encoder)
	{
		encoder->close();

		//hack: restore original size
		m_view3d->resize(originalViewSize);
		QApplication::processEvents();
	}
#endif

	progressDialog.hide();
	QApplication::processEvents();

	if (success)
	{
		QMessageBox::information(this, "Job done", "The animation has been saved successfully");
	}

	setEnabled(true);
}