ModuleFourDialog::ModuleFourDialog(QWidget *parent) : QDialog(parent)
{
    ui = new Ui_ModuleFourDialog;
    ui->setupUi(this);
    connect(ui->okButton, SIGNAL(clicked()), this, SLOT(deal()));
    connect(ui->setLineEdit, SIGNAL(textEdited(QString)), this, SLOT(clearText(QString)));
    connect(ui->RLineEdit, SIGNAL(textEdited(QString)), this, SLOT(clearText(QString)));
}
Beispiel #2
0
void ConnectionForm::createControls()
{
    receiveBox = new QTextEdit;

    utilityBar = new QToolBar;

    QAction *clearAction = new QAction(tr("Clear Text"), this);
    clearAction->setIcon(QIcon(":/resources/icons/edit_clear.png"));
    connect(clearAction, SIGNAL(triggered()), this, SLOT(clearText()));

    QAction *exportAction = new QAction(tr("Export..."), this);
    connect(exportAction, SIGNAL(triggered()), this, SLOT(exportResult()));
    exportAction->setIcon(QIcon(":/resources/icons/export.png"));

    utilityBar->addAction(exportAction);
    utilityBar->addAction(clearAction);

    QComboBox *combo = new QComboBox;
    combo->addItems(QStringList() << tr("Packet Mode") << tr("Original Data"));
    connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(changeDisplayMode(int)));
    combo->setCurrentIndex(0);

    utilityBar->addWidget(combo);

    utilityBar->setIconSize(QSize(24, 24));
    utilityBar->setStyleSheet("QToolBar{border:0}");
}
Beispiel #3
0
void PlayState::suspend()
{
	player.unuseImg();

	REG_BG0VOFS = 0;
	REG_BG0HOFS = 0;

	playerBullets.spriteDestroy();
	enemyBullets.spriteDestroy();
	enemies.spriteDestroy();

	R_triggered_indicator.unuseImg();
	
	// deinit display sprites at bottom
	lifeIndic.setVisible(false);
	lifeIndic.unuseImg();
	
	bombIndic.setVisible(false);
	bombIndic.unuseImg();

	int lifeCount = player.getLifeCount();
	for(int i = 0; i < lifeCount - 1; ++i)
	{
		lives[i].unuseImg();
	}
   
	powerUp.unuseImg();

	clearText();

	g_oamMan->deallocSprites(sprites, NUM_SPRITES);
}
Beispiel #4
0
//gets text from the text graphics vector and returns it as a string also deals with pesky space bar
std::string textIn::getText(){

    std::string temp;
    for( auto t: text){

        //add each char of text to string on the condition that the text is not the troublesome spacebar
        if(t.getString() != '_'){

            temp += t.getString();
        }else{

            //adds an actual space to avoid issues
            temp += ' ';
        }
    }

    //pulls the caret back
    caretBack();

    //unless clearText is set to false clears the string afterwards so theres nothing on it anymore!
    if(clearText())
        text.clear();

    //returns the string
    return temp;
}
static void initSidesAndText()
{
    // Make sure the text is cleared on the first launch
    clearText();

    // Retrieve the window layer and its bounds
    Layer *window_layer = window_get_root_layer(window);
// 		GRect bounds = layer_get_bounds(window_layer);

    // Create a text layer for the text that is typed - WTF? - it was never used!
//     text_layer = text_layer_create((GRect) { .origin = { 0, 72 }, .size = { bounds.size.w, 20 } });
//     text_layer_set_font(text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD));
//     layer_add_child(window_layer, text_layer_get_layer(text_layer));

    // Create a text layer for the title
#if defined(PBL_ROUND)
    text_title = text_layer_create( GRect( 34, 16, 86, 32 ) );
#else
    text_title = text_layer_create( GRect( 3, 0, 107, 32 ) );
#endif
    text_layer_set_font( text_title, fonts_get_system_font( FONT_KEY_GOTHIC_14_BOLD ) );
    text_layer_set_text( text_title, title );
    layer_add_child( window_layer, text_layer_get_layer( text_title ) );

    // Create a text layer for the text that has been typed - PRS
#if defined(PBL_ROUND)
    text_input = text_layer_create((GRect) { .origin = { 32, 40 }, .size = { 90, 120 } });
Beispiel #6
0
bool MonitorItem::docmd(const char* command)
{
   if (!doconnect()) {
      return false;
   }

   if (command[0] != 0) {
      writecmd(command);
   }

   emit clearText(get_name());
   bool jobRunning = false;

   while (1) {
      int stat;
      if ((stat = bnet_recv(d->DSock)) >= 0) {
         strip_trailing_newline(d->DSock->msg);
         QString msg = QString::fromUtf8(d->DSock->msg);
         emit appendText(QString::fromUtf8(get_name()), msg);
         if (d->type == R_CLIENT) {
             if (msg.contains("Job started:"))
                jobRunning = true;
         }
      } else if (stat == BNET_SIGNAL) {
         if (d->DSock->msglen == BNET_EOD) {
            // qDebug() << "<< EOD >>";
             if (d->type == R_CLIENT)
                emit jobIsRunning (jobRunning);
            return true;
         }
         else if (d->DSock->msglen == BNET_SUB_PROMPT) {
            // qDebug() << "<< PROMPT >>";
            return false;
         }
         else if (d->DSock->msglen == BNET_HEARTBEAT) {
            bnet_sig(d->DSock, BNET_HB_RESPONSE);
         }
         else {
            qDebug() << bnet_sig_to_ascii(d->DSock);
         }
      } else { /* BNET_HARDEOF || BNET_ERROR */
         d->DSock = NULL;
         d->state = MonitorItem::Error;
         emit statusChanged(get_name(), d->state);
         emit showStatusbarMessage("Error : BNET_HARDEOF or BNET_ERROR");
         //fprintf(stderr, "<< ERROR >>\n"));
         return false;
      } /* if ((stat = bnet_recv(d->DSock)) >= 0) */

      if (is_bnet_stop(d->DSock)) {
         d->DSock = NULL;
         d->state = MonitorItem::Error;
         emit statusChanged(get_name(), d->state);
         emit showStatusbarMessage("Error : Connection closed.");
         //fprintf(stderr, "<< STOP >>\n");
         return false;            /* error or term */
      } /* if (is_bnet_stop(d->DSock) */

   } /* while (1) */
}
Beispiel #7
0
static void updateOnceEveryFrame() {
  if (gKeyPressed) {
		++gKeyPressTime;
	}

	if ((gTimeTick%(TIME_FRAMES_PER_SEC/SCREEN_AND_SENSOR_UPDATES_PER_SEC) == 0)) {
    updateSensorsAndScreen();
	}

#ifdef TIME_ENABLED
	updateTime();
#endif //TIMEENABLED

#ifdef TEXT_ENABLED
  for (uint8_t i = 0; i < TEXT_LINES; ++i) {
	  clearText(i);
	  updateText(i);
  }
#endif //TEXT_ENABLED

#ifdef GRAPICSENABLED
	clearGraphics();
	updateGrapics();
#endif //GRAPICSENABLED
}
Beispiel #8
0
char* input_name(void)
{
	static char name[256];
	clearText();
	printf("请输入您的姓名(英文),回车键结束\n");
	gets(name);
	return name;
}
Beispiel #9
0
// User can call this to put or change the text in the text box
void Text2DBox::setImage(int xOffset, int yOffset, int width, int height)
{
	//glUseProgram(box2DProgramId); // TODO is this line needed? Probably it is not needed here.

	clearText();

	texture_id = drawImageTextureFactory(xOffset, yOffset, width, height); // This creates an image, Remember to delete texture (glDeleteTextures) when no longer needed.
}
DebugPrint::DebugPrint(QWidget *parent, Qt::WFlags flags) : QDialog(parent)
{
	ui.setupUi(this);
	this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);

	QObject::connect(ui.pushButtonClear, SIGNAL(clicked()), this, SLOT(clearText()));

	lineCounter = 0;
	f.setFont(QFont("Courier New", 10));
}
Beispiel #11
0
TQPopupMenu *KWrited::createPopupMenu( const TQPoint &pos )
{
   TQPopupMenu *menu = TQTextEdit::createPopupMenu( pos );

   menu->insertItem( i18n( "Clear Messages" ),
                     this, TQT_SLOT( clearText() ), 
                     0, -1, 0 );

   return menu;
}
Beispiel #12
0
Text2DBox::~Text2DBox()
{
	clearText();

	//glUseProgram(box2DProgramId); // TODO is this line needed? Probably it is not needed here.

	glDeleteBuffers(1, &vbo_vertices);
	glDeleteBuffers(1, &vbo_texcoords);
	glDeleteBuffers(1, &ibo_elements);

	//free(textString);
	//free(buttonCommand);
};
void MessageWindow::setupGui() {
	textEdit = new QPlainTextEdit;
	textEdit->setReadOnly( true );
	textEdit->setWordWrapMode( QTextOption::WrapAnywhere );

	clearTextButton = new QPushButton( QString::fromUtf8( "クリア" ) );
	connect( clearTextButton, SIGNAL(clicked()), this, SLOT(clearText()) );

	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addWidget(textEdit);
	mainLayout->addWidget(clearTextButton);

	setLayout(mainLayout);
}
Beispiel #14
0
void MonitorItem::connectToMainWindow(QObject* mainWindow)
{
   connect(this, SIGNAL(showStatusbarMessage(QString)),
           mainWindow, SLOT(onShowStatusbarMessage(QString)));
   connect(this, SIGNAL(appendText(QString,QString)),
           mainWindow, SLOT(onAppendText(QString,QString)));
   connect(this, SIGNAL(clearText(QString)),
           mainWindow, SLOT(onClearText(QString)));
   connect(this, SIGNAL(statusChanged(QString,int)),
           mainWindow, SLOT(onStatusChanged(QString,int)));
   if (d->type == R_CLIENT) {
     connect(this, SIGNAL(jobIsRunning(bool)),
           mainWindow, SLOT(onFdJobIsRunning(bool)));
   }
void CopyGui::on_btnCPSave_clicked()
{
    clearText();
    checkEdit = false;
    ui->btnCPAdd->setText("Add");
    if(checkHide == false){
      ui->widget->show();
      fadeIn(ui->widget);
      checkHide = true;
    }else if(checkHide == true){
      fadeOut(ui->widget);
      checkHide = false;
    }
}
Beispiel #16
0
	void setText(const std::string &var)
	{
		m_bCallbackTextChanged = false;
		clearText();

		if (var.empty())
		{
			updateImage();
		}
		else
		{
			insertText(var.c_str(), (int)var.length());
		}
		m_bCallbackTextChanged = true;
	}
Beispiel #17
0
void CBuffer_Delete(CBuffer* cb)
{
    assert(cb);

    lock(cb, true);

    clearText(cb, false);
    clearWriteBuffer(cb);
    clearIndex(cb);
    clearUsedNodes(cb);

    lock(cb, false);
    Sys_DestroyMutex(cb->mutex);
    cb->mutex = 0;
    free(cb);
}
int DialogEditor::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: clearText(); break;
        case 1: backUp(); break;
        case 2: saveRC(); break;
        case 3: closeDialog(); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Beispiel #19
0
// User can call this to put or change the text in the text box
void Text2DBox::setText(const char *str)
{
	//glUseProgram(box2DProgramId); // TODO is this line needed? Probably it is not needed here.

	clearText();

	const unsigned int characterBoxSize = (width * 2 * mainAspectRatio) / height; // How many characters that there is room for in one line in the box without squeezing the characters.

	//free(textString);
	//textString=stringCopyFactory(str);


	if ((str!=NULL) && (*str))
	{
		texture_id = drawTextTextureFactory(str, characterBoxSize); // This creates an image with the desired text. Remember to delete texture (glDeleteTextures) when no longer needed.
	}

}
Beispiel #20
0
Server::Server(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Server)
{
    ui->setupUi(this);

    QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
    ui->lineEditIP->setText(ipAddressesList.at(0).toString());
    ui->lineEditPort->setValidator(new QIntValidator(1, 65535, this));

    tcpServer = new QTcpServer(this);

    QObject::connect(tcpServer, SIGNAL(newConnection()), this, SLOT(acceptConnection()));
    QObject::connect(ui->pushButtonClear, SIGNAL(clicked()), this, SLOT(clearText()));
    QObject::connect(ui->pushButtonSend, SIGNAL(clicked()), this, SLOT(sendClient()));
    QObject::connect(ui->pushButtonQuit, SIGNAL(clicked()), this, SLOT(close()));
    QObject::connect(ui->pushButtonListen, SIGNAL(clicked()), this, SLOT(setListen()));
}
//-------------------------------------------------------------------------------------------------
//
// Display initalization
//
//-------------------------------------------------------------------------------------------------
void T6963::Initialize(void){
  //Set up data and control ports
  InitalizeInterface();

  //reset LCD, should be able to have hardware solution
  //GLCD_CTRL_PORT &= ~(1 << GLCD_RESET);
  //_delay_ms(1);
  //GLCD_CTRL_PORT |= (1 << GLCD_RESET);

  //Set Graphics Home Address
  writeData(_GH & 0xFF);
  writeData(_GH >> 8);
  writeCommand(T6963_SET_GRAPHIC_HOME_ADDRESS);

  //Set Graphics Area
  writeData(_GA);
  writeData(0x00);
  writeCommand(T6963_SET_GRAPHIC_AREA);

  //Set Text home address
  writeData(_TH & 0xFF);
  writeData(_TH >> 8);
  writeCommand(T6963_SET_TEXT_HOME_ADDRESS);

  //Set Text Area
  writeData(_TA);
  writeData(0x00);
  writeCommand(T6963_SET_TEXT_AREA);

  //Set Internal CGRAM address
  writeData(((_sizeMem/2)-1));
  writeData(0x00);
  writeCommand(T6963_SET_OFFSET_REGISTER);


  setDispMode(true,true,false,false);

  setMode('O','I');

  clearText();
  clearGraphic();
  delay(100);

}
Beispiel #22
0
void TestApp::update(float _dt) {
    static float time = 0.f;
    time += _dt;

    m_xrot += m_cursorX;
    m_yrot += m_cursorY;

    displayText(15.f, {m_width - 80.f, 20.f}, std::to_string(_dt).c_str() + std::string("ms"), true);

    if(glfwGetKey(m_window, 'N') && time > 0.5f) {
        m_texture++;
        if (m_texture == m_textures.end()) {
            m_texture = m_textures.begin();
        }
        clearText(m_textId);
        m_textId = displayText(30.f, {10.f, 30.f}, m_texture->first);
        time = 0.f;
    }
}
Beispiel #23
0
void TileInfo::setTile(std::shared_ptr<MapTile> tile, uint x, uint y) {
    clearText();
    setAlignments(Alignment::Top, Alignment::Left);

    std::stringstream line1, line2, line3, line4, line5;
    line1 << "Map tile at (" << x << ", " << y << ")";
    addLine(line1.str());

    // Blank line
    addLine("");

    line2 << "Temprature: " << tile->temp;
    addLine(line2.str());

    line3 << "Height: " << tile->height;
    addLine(line3.str());

    line4 << "Humidity: " << tile->humidity;
    addLine(line4.str());
}
Beispiel #24
0
void SDLFontGL::updateCells() {
	clearGLCells();

	if (0 == m_cols || 0 == m_rows) return;

	m_cellsWidth = nextPowerOfTwo(m_cols);
	assert(m_cellsWidth >= m_cols);
	m_cellsWidth = (m_cellsWidth+3) & ~0x3; /* align at four bytes */
	m_cellsHeight = nextPowerOfTwo(m_rows);
	assert(m_cellsHeight >= m_rows);

	if (!m_openglActive) return;

	syslog(LOG_DEBUG, "updateCells: rows = %i, cols = %i, width = %i, height = %i", m_rows, m_cols, m_cellsWidth, m_cellsHeight);

	glActiveTexture(GL_TEXTURE0);
	glGenTextures(1, &m_cellsTex);
	checkGLError();
	glBindTexture(GL_TEXTURE_2D, m_cellsTex);
	checkGLError();

	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	checkGLError();

	m_cellData = static_cast<unsigned char*>(malloc(4*m_cellsWidth * m_cellsHeight));
	assert(m_cellData);
	clearText();

	// set size
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_cellsWidth, m_cellsHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	checkGLError();

	if (m_charShader.program) {
		glUseProgram(m_charShader.program);
		checkGLError();

		glUniform2f(m_charShader.aCellsize, 1.0/(float)m_cellsWidth, 1.0/(float)m_cellsHeight);
		checkGLError();
	}
}
//--------------------------------------------------------------
void ofxFileDialog::keyPressedNewFolder(int key, bool saveAs) {
	
	switch(key) {

		case OF_KEY_RETURN:
			if(!ofDirectory::createDirectory(wstring_to_string(m_path+m_text))) {
				ofLogError("ofxFileDialog") << "couldn't create new folder: \"" << wstring_to_string(m_text) << "\"";
				m_saveAsState = FILENAME;
			}
			else {
				ofLogVerbose("ofxFileDialog") << "created new folder: \"" << wstring_to_string(m_text) << "\"";
				refresh();
				for(int i = 0; i < m_filenames.size(); ++i) {
					if(m_filenames[i] == m_text) {
						m_currentFile = i;
						break;
					}
				}
				if(SAVEAS) {
					m_saveAsState = BROWSER;
				}
			}
			clearText();
			break;
			
		case OF_KEY_ESC:
			if(saveAs) {
				m_saveAsState = FILENAME;
			}
			else {
				m_active = false;
			}
			break;
			
		default:
			keyPressedText(key);
			break;
	}
}
Beispiel #26
0
void level(void)
{

	drawMap();
	GotoMap(MAP_WIDTH / 4, MAP_HEIGHT / 4-2);
	printf("  请选择级别:");
	GotoMap(MAP_WIDTH / 4, MAP_HEIGHT / 4-1);
	printf("  1. 入门(积分X1)");
	GotoMap(MAP_WIDTH / 4, MAP_HEIGHT / 4);
	printf("  2. 普通(积分X2)");
	GotoMap(MAP_WIDTH / 4, MAP_HEIGHT / 4+1);
	printf("  3. 大师(积分X4)");
	ch4 = jkGetKey();
	switch(ch4)
	{
		case 0x0031:ms=200;break;
		case 0x0032:ms=100;break;
		case 0x0033:ms=50;break;
		default:break;
	}
	clearText();
	drawMap();
}
Beispiel #27
0
TextOutDisplay::TextOutDisplay(int min_height, int font_size, bool user_input, QWidget* parent) :
    QWidget( parent )
{
  user_input_ = user_input;

  QVBoxLayout* layout = new QVBoxLayout( this );

  smileys_.push_back( ">:" );
  smileys_.push_back( ":)" );
  smileys_.push_back( ":(" );
  smileys_.push_back( ":O" );
  smileys_.push_back( ":o" );
  smileys_.push_back( ":!" );
  smileys_.push_back( ":&" );

  // Text output
  font_.setPixelSize(font_size);
  font_.setBold(true);

  text_out_label_ = new QLabel( this );
  text_out_label_->setFont( font_ );
  text_out_label_->setMinimumSize( 100, min_height );
  text_out_label_->setAlignment ( Qt::AlignCenter );
  text_out_label_->setWordWrap ( true );

  layout->addWidget( text_out_label_ );

  setLayout( layout );

  reset_timer_ = new QTimer ( this );  // create internal timer
  connect ( reset_timer_, SIGNAL ( timeout() ), SLOT ( clearText() ) );
  reset_timer_->start ( 1000 / 25  );

  setVisible( false );

  text_ = "";
}
Beispiel #28
0
	void deleteBackward()
	{
		CC_RETURN_IF(m_sText.empty() || m_iCurPos==0);
		if (m_pTextFieldX->isSecureTextEntry())
		{
			clearText();
			updateImage();
			return;
		}

		if (m_curSelCharRange.first != m_curSelCharRange.second)
		{
			if (!textValueChanged(m_curSelCharRange.first, m_curSelCharRange.second - m_curSelCharRange.first, ""))
				return;
			
			CC_RETURN_IF(execCurSelCharRange());
		}
		else
		{
			int nDeleteLen = 1;
			while (0x80 == (0xC0 & m_sText.at(m_iCurPos - nDeleteLen)))
			{
				++nDeleteLen;
			}

			if (!textValueChanged(m_iCurPos, nDeleteLen, ""))
				return;

			m_sText.erase(m_iCurPos - nDeleteLen, nDeleteLen);
			m_iCurPos -= nDeleteLen;
			m_curSelCharRange = std::make_pair(m_iCurPos, m_iCurPos);
			m_vTextFiledChars.erase(m_vTextFiledChars.begin() + getStringCharCount(m_sText.substr(0, m_iCurPos)));

			adjustCursorMove();
		}
	}
Beispiel #29
0
void CBuffer_Clear(CBuffer* cb)
{
    lock(cb, true);
    clearText(cb, true);
    lock(cb, false);
}
Beispiel #30
0
WindowWriterThread::WindowWriterThread(QObject *parent, WindowInterface* window) {
    mainWindow = (MainWindow*)parent;
    this->textEdit = dynamic_cast<QPlainTextEdit*>(window);
    this->window = window;

    highlighter = new Highlighter(parent);

    this->exit = false;

    GenericWindow* genericWindow = dynamic_cast<GenericWindow*>(window);
    if(genericWindow != NULL) {
        connect(this, SIGNAL(writeStream(const QString&)), genericWindow, SLOT(appendHtmlStream(const QString&)));
    }

    connect(this, SIGNAL(writeText(const QString&)), this->textEdit, SLOT(appendHtml(const QString&)));
    connect(this, SIGNAL(clearText()), this->textEdit, SLOT(clear()));
}

void WindowWriterThread::updateSettings() {
    highlighter->reloadSettings();
}

void WindowWriterThread::addText(QString text) {
    mMutex.lock();
    dataQueue.enqueue(text);
    mMutex.unlock();
}

void WindowWriterThread::run() {
    while(!this->exit) {
        while(!dataQueue.isEmpty()) {