Exemplo n.º 1
0
Game::Game(Character *ch, QTextEdit *textLog) :
    m_MainChar(ch),
    m_EventLog(textLog),
    TIME_TILL_NEXT_TURN(2)
{
    qDebug() << ch->getName();
    foreach ( unsigned stat, ch->statsList() ) {
        qDebug() << stat << " ";
    }
    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(proceed()));
    connect(&EventsGenerator::Instance(), SIGNAL(appendToLog(QString)), m_EventLog, SLOT(append(QString)));
    connect(&EventsGenerator::Instance(), SIGNAL(appendToLog(QString)), this, SLOT(declamation(QString)));
}
Exemplo n.º 2
0
void MeltJob::onReadyRead()
{
    QString msg;
    do {
        msg = readLine();
        int index = msg.indexOf("Frame:");
        if (index > -1) {
            index += 6;
            int comma = msg.indexOf(',', index);
            m_currentFrame = msg.mid(index, comma - index).toInt();
        }
        index = msg.indexOf("percentage:");
        if (index > -1) {
            int percent = msg.mid(index + 11).toInt();
            if (percent != m_previousPercent) {
                emit progressUpdated(m_item, percent);
                QCoreApplication::processEvents();
                m_previousPercent = percent;
            }
        }
        else {
            appendToLog(msg);
        }
    } while (!msg.isEmpty());
}
Exemplo n.º 3
0
void Game::stop()
{
    disconnect(&EventsGenerator::Instance(), SIGNAL(appendToLog(QString)), m_EventLog, SLOT(append(QString)));
    timer->stop();
    delete(timer);
    timer = 0;
}
Exemplo n.º 4
0
Log::Log() : QTextEdit()
{
	setWindowTitle("Log");
	//setTextInteractionFlags( Qt::TextBrowserInteraction );
	setReadOnly(true);
	setFixedSize(400, 800);

	connect( this, SIGNAL(newMessage(QString)), this, SLOT(appendToLog(QString)) );
}
Exemplo n.º 5
0
void MeltJob::onReadyRead()
{
    QString msg = readLine();
    if (msg.contains("percentage:")) {
        uint percent = msg.mid(msg.indexOf("percentage:") + 11).toUInt();
        emit progressUpdated(m_index, percent);
    }
    else {
        appendToLog(msg);
    }
}
Exemplo n.º 6
0
void writeLogLine(void) {
#if EFI_FILE_LOGGING || defined(__DOXYGEN__)
	if (!main_loop_started)
		return;
	resetLogging(&fileLogger);
	printSensors(&fileLogger, true);

	if (isSdCardAlive()) {
		appendPrintf(&fileLogger, "\r\n");
		appendToLog(fileLogger.buffer);
		logFileLineIndex++;
	}
#endif /* EFI_FILE_LOGGING */
}
Exemplo n.º 7
0
ConsoleLog::ConsoleLog() :
    PandemicModule("org.newspawn.PandemicPlugin.ConsoleLog", "Console Log")
{
    _logLength = 80;
    _log = new QPlainTextEdit();
    _log->setObjectName("Console");
    _log->setReadOnly(true);
    connect(application()->outputLog(), SIGNAL(outputted(QString)), this, SLOT(appendToLog(QString)));

    _window = new PandemicWindow(this, _log);
    _window->setWindowTitle("Console Log");
    _window->setMinimumSize(690, 150);
    _window->resize(690, 350);
}
Exemplo n.º 8
0
void LoadingDialog::reportRouteExtent(int nTerrainTiles, int nTrackTiles, int nRoadTiles, int nSceneryTiles)
{
    loadingAmt = 1;
    progressBar->setValue(1);
	int tot = nTerrainTiles + nTrackTiles + nRoadTiles + nSceneryTiles;
    progressBar->setRange(0, 1 + tot);

    QString newmsg = QString("Route Extent: %1 tiles in total, consisting of:\n"
							 "              %3 track tiles\n"
							 "              %4 road tiles\n"
							 "              %5 scenery tiles\n"
							 "              %2 terrain tiles\n")
							.arg(tot)
							.arg(nTerrainTiles)
							.arg(nTrackTiles)
							.arg(nRoadTiles)
							.arg(nSceneryTiles);
    appendToLog(newmsg);
}
Exemplo n.º 9
0
void LoadingDialog::reportLoadTerrain()
{
    appendToLog("Reading terrain tiles...\n");
}
Exemplo n.º 10
0
void LoadingDialog::reportLoadScenery()
{
    appendToLog("Reading scenery tiles...\n");
}
Exemplo n.º 11
0
void LoadingDialog::reportLoadRoads()
{
    appendToLog("Reading road tiles...\n");
}
Exemplo n.º 12
0
void LoadingDialog::reportLoadTrack()
{
    appendToLog("Reading track tiles...\n");
}
Exemplo n.º 13
0
void LoadingDialog::reportRouteLoaded()
{
    appendToLog("Route loaded");
}
Exemplo n.º 14
0
void LoadingDialog::reportRouteInfo(QString name, double lat, double lon)
{
    progressBar->setValue(2);
    QString newmsg = QString("Route name: \"%1\"\nRoute origin: %2, %3\n").arg(name).arg(lat).arg(lon);
    appendToLog(newmsg);
}
Exemplo n.º 15
0
void SimulationDrivenWare::OPENFLUID_RaiseWarning(const std::string& /*Source*/, const std::string& Msg)
{
  appendToLog(openfluid::tools::FileLogger::LOG_WARNING,Msg);
}
Exemplo n.º 16
0
LauncherWindow::LauncherWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::LauncherWindow)
{
    ui->setupUi(this);

    settings = Settings::instance();
    logger = Logger::logger();

    // Show welcome message
    QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
    ui->logDisplay->setFont(font);

    appendToLog( tr("Welcome to the ttyhlauncher.") );

    QFile logoFile(":/resources/logo.txt");
    if ( logoFile.open(QFile::ReadOnly | QFile::Text) )
    {
        appendToLog( QTextStream(&logoFile).readAll() );
        logoFile.close();
    }
    else
    {
        log( tr("Can't open logo resource.") );
    }

    // Setup menu
    connect(ui->runSettings, &QAction::triggered, this,
            &LauncherWindow::showSettingsDialog);

    connect(ui->changeSkin, &QAction::triggered, this,
            &LauncherWindow::showSkinLoadDialog);

    connect(ui->updateManager, &QAction::triggered, this,
            &LauncherWindow::showUpdateManagerDialog);

    connect(ui->bugReport, &QAction::triggered, this,
            &LauncherWindow::showFeedBackDialog);

    connect(ui->aboutLauncher, &QAction::triggered, this,
            &LauncherWindow::showAboutDialog);

    connect(ui->runStoreSettings, &QAction::triggered, this,
            &LauncherWindow::showStoreSettingsDialog);

    connect(ui->runStoreManage, &QAction::triggered, this,
            &LauncherWindow::showStoreManageDialog);

    connect(ui->runStoreInstall, &QAction::triggered, this,
            &LauncherWindow::showStoreInstallDialog);

    bool isOffline = settings->loadOfflineModeState();
    ui->playOffline->setChecked(isOffline);
    offlineModeChanged();

    connect(ui->playOffline, &QAction::triggered, this,
            &LauncherWindow::offlineModeChanged);

    bool isHideWindow = settings->loadHideWindowModeState();
    ui->hideLauncher->setChecked(isHideWindow);

    connect(ui->hideLauncher, &QAction::triggered, this,
            &LauncherWindow::hideWindowModeChanged);

    bool isLoadNews = settings->loadNewsState();
    ui->loadNews->setChecked(isLoadNews);

    connect(ui->loadNews, &QAction::triggered, this,
            &LauncherWindow::fetchNewsModeChanged);

    connect(&newsFetcher, &DataFetcher::finished, this,
            &LauncherWindow::newsFetched);

    if ( settings->loadNewsState() )
    {
        newsFetcher.makeGet( QUrl(Settings::newsFeed) );
    }

    // Setup form
    QString login = settings->loadLogin();
    ui->nickEdit->setText(login);

    connect(ui->nickEdit, &QLineEdit::textChanged, settings,
            &Settings::saveLogin);

    bool isPassStored = settings->loadPassStoreState();
    ui->savePassword->setChecked(isPassStored);

    if (isPassStored)
    {
        QString password = settings->loadPassword();
        ui->passEdit->setText(password);
    }

    connect(ui->savePassword, &QCheckBox::clicked, settings,
            &Settings::savePassStoreState);

    QStringList clients = settings->getClientCaptions();
    ui->clientCombo->addItems(clients);

    int currentClient = settings->loadActiveClientID();
    ui->clientCombo->setCurrentIndex(currentClient);

    connect( ui->clientCombo, SIGNAL( activated(int) ), settings,
             SLOT( saveActiveClientID(int) ) );

    // Setup window parameters
    QRect geometry = settings->loadWindowGeometry();

    if (geometry.x() < 0)
    {
        QPoint scrCenter = QApplication::desktop()->screen()->rect().center();
        QPoint winCenter = this->rect().center();

        this->move(scrCenter - winCenter);
    }
    else
    {
        this->setGeometry(geometry);
    }

    if ( settings->loadMaximizedState() )
    {
        this->showMaximized();
    }

    // Other
    connect(ui->playButton, &QPushButton::clicked, this,
            &LauncherWindow::playButtonClicked);

    connect(logger, &Logger::lineAppended, this, &LauncherWindow::appendToLog);

#ifdef Q_OS_WIN
    QString latest = settings->getlatestVersion();

    if (Settings::launcherVersion != latest)
    {
        connect(this, &LauncherWindow::windowOpened, this, [=]()
        {
            QString msg = tr("New launcher version avialable: %1").arg(latest);

            SelfUpdateDialog *d = new SelfUpdateDialog(msg, this);
            d->exec();
            delete d;
        },
        Qt::QueuedConnection);
    }
#endif

    if (ui->clientCombo->count() == 0)
    {
        connect(this, &LauncherWindow::windowOpened, this, [=]()
        {
            ui->playButton->setEnabled(false);
            showError(tr("No available clients!"), true);
        },
        Qt::QueuedConnection);
    }
}
void MainWindow::onLogMessageReceived(QString logMessage)
{
    appendToLog(logMessage);
}
Exemplo n.º 18
0
/**
 *
 * The entry point for the application.
 * It is responsible for creating queues, starting tasks and running the
 * main scheduler
 *
 */
int main(void)
{
	//
	// Setup the Hardware
	//
	prvSetupHardware();

	//
	// start Logging
	//
	UARTprintf("Init log file: Status = %d\n", initLog());
	appendToLog("Starting Firmware");
	appendToLog("Universelles Interface von Anzinger Martin und Hahn Florian");

	//
	// write welcome text to the debug console
	//
	printf("\n\n\nStarte Programm ...\n");
	printf("Universelles Interface von Anzinger Martin und Hahn Florian\n");
	printf("Starting Firmware ...\n");

	//
	// initialize Taglibrary
	//
	printf("Initialisiere Taglib ...");
	vInitTagLibrary();
	printf(" done\n");

	//
	// Queue Definition
	// The main Communication between COMM-, GRAPH and HTTPD Task
	//
	printf("Initialize Queues ...\n\txComQueue\n");
	xComQueue = xQueueCreate(COM_QUEUE_SIZE, sizeof(xComMessage));
	printf("\txHttpdQueue\n");
	xHttpdQueue = xQueueCreate(HTTPD_QUEUE_SIZE, sizeof(xComMessage));
	appendToLog("Queues created");

	//
	// start Tasks
	//

	//
	//Real Time Clock Task
	//
	printf("Starting RealTimeClock ... ");
	xTaskCreate( vRealTimeClockTask, (const signed char * const)TIME_TASK_NAME, TIME_STACK_SIZE, NULL, TIME_TASK_PRIORITY, &xRealtimeTaskHandle );
	printf("ok\n");
	appendToLog("RealTimeClock started");

	//
	// Communication Task
	//
	printf("Starting Communication Task ... ");
	xTaskCreate( vComTask, (const signed char * const)COM_TASK_NAME, COM_STACK_SIZE, NULL, COM_TASK_PRIORITY, &xComTaskHandle);
	printf("ok\n");
	appendToLog("ComTask started");

	//
	// Check if an Ethernet Port is available
	//
	if (SysCtlPeripheralPresent(SYSCTL_PERIPH_ETH))
	{
		//
		// LWIP Task
		//
		printf("Starting LWIP ...\n");
		xTaskCreate( LWIPServiceTaskInit, (const signed char * const)LWIP_TASK_NAME, LWIP_STACK_SIZE, NULL, LWIP_TASK_PRIORITY, &xLwipTaskHandle );
		appendToLog("IP-Stack started");
	}

#if ENABLE_GRAPHIC
	//
	// Graphic Task
	//
	printf("Starting Graphic Task ... ");
	xTaskCreate( vGraphicTask, (const signed char * const)GRAPH_TASK_NAME, GRAPH_STACK_SIZE, NULL, GRAPH_TASK_PRIORITY, &xGraphTaskHandle );
	printf("ok\n");
#endif

	//
	// Starting the scheduler.
	//
	vTaskStartScheduler();

	//
	// Fallbackloop if Scheduler Fails
	//
	while (1)
		;
	return 0;
}