Ejemplo n.º 1
0
void LogViewerDialog::handleLogClear()
{
    clearLog(guiDebugLogPath());
    clearLog(guiWarningLogPath());
    clearLog(guiWarningLogPath());
    clearLog(guiFatalLogPath());

    updateCurrentLog();
}
Ejemplo n.º 2
0
//-------------------------------------------------------------------------
void MainWindow::processContent()
{
  QString fileName = getCurrentSourceFile();
  if(fileName.isEmpty())
  {
    return;
  }

  QPlainTextEdit *currentSourceCode = getCurrentSourceCode();

  std::vector<const char*> Args;
  std::list<std::string> commandLine;
  QByteArray sourceCode(currentSourceCode->toPlainText().toUtf8());
  APP::Application::addCmdArgsFromProject(Args, commandLine);

  std::string processedFile;
  std::stringstream diagnostics;
  APP::Application::processFile(sourceCode.constData(),
                                sourceCode.constData() + sourceCode.size(),
                                QFileInfo(fileName).canonicalFilePath().toUtf8().constData(),
                                Args, processedFile, diagnostics);
  clearLog();
//diagnostics<<processedFile;
  log(diagnostics.str());
  setTransformedSource(processedFile.c_str());

  ui.tabWidget_2->setTabText(0, QFileInfo(fileName).fileName());
}
Ejemplo n.º 3
0
JDMainWin::JDMainWin(const QString &name, const QString &jid, int acc, QWidget *p)
	: QDialog(p, Qt::Window)
	, model_(0)
	, commands_(0)
	, refreshInProgres_(false)
	, yourJid_(name)
{
	setAttribute(Qt::WA_DeleteOnClose);
	ui_.setupUi(this);

	setWindowTitle(tr("Jabber Disk - %1").arg(name));

	model_ = new JDModel(jid, this);
	ui_.lv_disk->setModel(model_);

	commands_ = new JDCommands(acc, jid, this);

	ui_.pb_send->setShortcut(QKeySequence("Ctrl+Return"));
	connect(commands_, SIGNAL(incomingMessage(QString,JDCommands::Command)), SLOT(incomingMessage(QString,JDCommands::Command)));
	connect(commands_, SIGNAL(outgoingMessage(QString)), SLOT(outgoingMessage(QString)));
	connect(ui_.pb_refresh, SIGNAL(clicked()), SLOT(refresh()));
	connect(ui_.pb_send, SIGNAL(clicked()), SLOT(doSend()));
	connect(ui_.pb_clear, SIGNAL(clicked()), SLOT(clearLog()));

	connect(ui_.lv_disk, SIGNAL(newIndex(QModelIndex)), SLOT(indexChanged(QModelIndex)));
	connect(ui_.lv_disk, SIGNAL(contextMenu(QModelIndex)), SLOT(indexContextMenu(QModelIndex)));

	connect(model_, SIGNAL(moveItem(QString,QString)), SLOT(moveItem(QString,QString)));

	show();

	QTimer::singleShot(0, this, SLOT(refresh()));
}
Ejemplo n.º 4
0
void LogWindow::createUi()
{
    ui->setupUi(this);

    QWidget *widget = new QWidget (this);
    setCentralWidget(widget);
    QVBoxLayout *mainLayout = new QVBoxLayout (widget);

    m_log = new QTextEdit(this);
    m_log->setReadOnly(true);
    mainLayout->addWidget(m_log);

    QHBoxLayout *logSettingsLayout = new QHBoxLayout ();

    QPushButton *clearLogButton = new QPushButton(tr("&Clear log"), this);
    connect(clearLogButton, SIGNAL(clicked()), this, SLOT(clearLog()));
    logSettingsLayout->addWidget(clearLogButton);

    logSettingsLayout->addStretch();

    QLabel *maxEntriesLabel = new QLabel (tr("&Maximum log size:"), this);
    m_maxEntries = new QSpinBox (this);
    m_maxEntries->setRange(0, 10000);
    m_maxEntries->setValue(Logger::maxEntries());
    m_maxEntries->setSuffix(QString(" ") + tr("entries"));
    connect(m_maxEntries, SIGNAL(editingFinished()),
            this, SLOT(changeMaxEntries()));
    maxEntriesLabel->setBuddy(m_maxEntries);
    logSettingsLayout->addWidget(maxEntriesLabel);
    logSettingsLayout->addWidget(m_maxEntries);

    mainLayout->addLayout(logSettingsLayout);
}
Ejemplo n.º 5
0
/*******************************************************************
** INDI Menu: Handles communication to server and fetching basic XML
** data.
*******************************************************************/
INDIMenu::INDIMenu(QWidget *parent) : QWidget(parent, Qt::Window)
{

    ksw = (KStars *) parent;

    mainLayout    = new QVBoxLayout(this);
    mainLayout->setMargin(10);
    mainLayout->setSpacing(10);

    mainTabWidget = new QTabWidget(this);

    mainLayout->addWidget(mainTabWidget);

    setWindowTitle(xi18n("INDI Control Panel"));
    setAttribute(Qt::WA_ShowModal, false);

    clearB      = new QPushButton(xi18n("Clear"));
    closeB      = new QPushButton(xi18n("Close"));

    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->insertStretch(0);
    buttonLayout->addWidget(clearB, 0, Qt::AlignRight);
    buttonLayout->addWidget(closeB, 0, Qt::AlignRight);
    
    mainLayout->addLayout(buttonLayout);

    connect(closeB, SIGNAL(clicked()), this, SLOT(close()));
    connect(clearB, SIGNAL(clicked()), this, SLOT(clearLog()));

    resize( 640, 480);
}
Ejemplo n.º 6
0
Archivo: workers.cpp Proyecto: RP7/USRT
int main( int argc, char *argv[] )
{
  clearLog();
  attachLog(6);
  attachLog(TRACELOG);
  std::USRTWorkers *workers = new std::USRTWorkers( argv[1] );
  workers->mainWorker( workers );
}
Ejemplo n.º 7
0
void Logger::printLog(void) {
  printf("CPSim prints log\n");
  for (auto it = __log.begin(); it != __log.end(); ++it) {
    printf("%s\n", it->c_str());
  }

  clearLog();
}
Ejemplo n.º 8
0
EkosManager::EkosManager()
        : QDialog(KStars::Instance())
{
    setupUi(this);

    nDevices=0;
    useGuiderFromCCD=false;
    useFilterFromCCD=false;
    useST4          =false;
    ccdStarted      =false;

    scope   =  NULL;
    ccd     =  NULL;
    guider  =  NULL;
    focuser =  NULL;
    filter  =  NULL;

    scope_di   = NULL;
    ccd_di     = NULL;
    guider_di  = NULL;
    focuser_di = NULL;
    filter_di  = NULL;
    remote_indi= NULL;

    captureProcess = NULL;
    focusProcess   = NULL;
    guideProcess   = NULL;

    kcfg_localMode->setChecked(Options::localMode());
    kcfg_remoteMode->setChecked(Options::remoteMode());

    connect(toolsWidget, SIGNAL(currentChanged(int)), this, SLOT(updateLog()));

    toolsWidget->setTabEnabled(1, false);

    connect(processINDIB, SIGNAL(clicked()), this, SLOT(processINDI()));

    connect(connectB, SIGNAL(clicked()), this, SLOT(connectDevices()));

    connect(disconnectB, SIGNAL(clicked()), this, SLOT(disconnectDevices()));

    connect(controlPanelB, SIGNAL(clicked()), GUIManager::Instance(), SLOT(show()));

    connect(optionsB, SIGNAL(clicked()), KStars::Instance(), SLOT(slotViewOps()));

    connect(clearB, SIGNAL(clicked()), this, SLOT(clearLog()));

    connect(kcfg_localMode, SIGNAL(toggled(bool)), this, SLOT(processINDIModeChange()));

    localMode = Options::localMode();

    if (localMode)
        initLocalDrivers();
    else
        initRemoteDrivers();

}
Ejemplo n.º 9
0
void Logger::init(QTreeWidget* o, QCheckBox* w, QPlainTextEdit* d)
{
	m_cmlog.clear();
	m_cmtxt.clear();

	if (m_treeOut)
		m_treeOut->disconnect(this);

	if (m_textOut)
		m_textOut->disconnect(this);

	if (m_chkWrite)
		m_chkWrite->disconnect(this);

    m_treeOut = o;
	m_textOut = d;
    m_chkWrite = w;

	if (m_treeOut && m_textOut && m_chkWrite)
	{
		QList<QKeySequence> ks;
		ks << QKeySequence(Qt::CTRL + Qt::Key_D);

		QAction* copy = new QAction(tr("Copy"), this);
		copy->setShortcuts(QKeySequence::Copy);
		connect(copy, SIGNAL(triggered()), this, SLOT(copy()));

		QAction* clear = new QAction(tr("Clear"), this);
		clear->setShortcuts(ks);
		connect(clear, SIGNAL(triggered()), this, SIGNAL(clearLog()));

		QAction* all = new QAction(tr("Select All"), this);
		all->setShortcuts(QKeySequence::SelectAll);
        connect(all, SIGNAL(triggered()), m_textOut, SLOT(selectAll()));

		m_cmlog.addAction(copy);
		m_cmlog.addSeparator();
		m_cmlog.addAction(clear);

		m_cmtxt.addAction(copy);
		m_cmtxt.addSeparator();
		m_cmtxt.addAction(all);

		QPalette pal = m_textOut->palette();
		pal.setBrush(QPalette::Base, m_treeOut->palette().brush(QPalette::Window));
		m_textOut->setPalette(pal);

		m_treeOut->setContextMenuPolicy(Qt::CustomContextMenu);
		connect(m_treeOut, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ctxmenu(const QPoint&)));
		connect(m_treeOut, SIGNAL(itemSelectionChanged()), this, SLOT(syncOutput()));

		m_textOut->setContextMenuPolicy(Qt::CustomContextMenu);
		connect(m_textOut, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ctxmenu(const QPoint&)));
	}
Ejemplo n.º 10
0
void ZoneScene::draw()
{
    Zone *zone = m_game->zone();
    vec4 clearColor = zone ? zone->info().fogColor : vec4(0.4, 0.4, 0.6, 0.1);
    if(m_renderCtx->beginFrame(clearColor))
    {
        clearLog();
        drawFrame();
    }
    m_renderCtx->endFrame();
}
Ejemplo n.º 11
0
static void execCommand(ConsoleData* consoleData, const char* commandLine)
{
    // TODO: Hook up as PD event

    addLog(consoleData, "# %s\n", commandLine);

    // Insert history. First find match and delete it, so it can be pushed to the back.
    consoleData->historyPos = -1;
    for (int i = int(consoleData->history.size()) - 1; i >= 0; --i)
    {
        if (strcasecmp(consoleData->history[(size_t)i], commandLine) == 0)
        {
            free(consoleData->history[(size_t)i]);
            consoleData->history.erase(consoleData->history.begin() + i);
            break;
        }
    }

    consoleData->history.push_back(strdup(commandLine));

    // Process the command

    if (strcasecmp(commandLine, "clear") == 0)
    {
        clearLog(consoleData);
    }
    else if (strcasecmp(commandLine, "help") == 0)
    {
        addLog(consoleData, "Commands:");
        for (size_t i = 0; i < consoleData->commands.size(); i++)
            addLog(consoleData, "- %s", consoleData->commands[i]);
    }
    else if (strcasecmp(commandLine, "history") == 0)
    {
        for (size_t i = consoleData->history.size() >= 10 ? consoleData->history.size() - 10 : 0; i < consoleData->history.size(); i++)
            addLog(consoleData, "%3d: %s\n", i, consoleData->history[i]);
    }
    else if (strcasecmp(commandLine, "testText") == 0) // TODO: Temp for testing
    {
        addLog(consoleData, "Some text\nSome more text\nDisplay very important message here!\n");
    }
    else if (strcasecmp(commandLine, "testError") == 0) // TODO: Temp for testing
    {
        addLog(consoleData, "[Error] Something went wrong!\n");
    }
    else if (strcasecmp(commandLine, "testScript") == 0) // TODO: Temp for testing
    {
        consoleData->scripts.push_back((char*)"print(\"Hello ProDBG Lua World!\")");
    }
    else
    {
        addLog(consoleData, "Unknown command: '%s'\n", commandLine);
    }
}
Ejemplo n.º 12
0
TriangulationWidget::TriangulationWidget(QWidget *parent) :
		QWidget(parent),
		lastRoverPos(0, 0),
		lastRoverHeading(0),
		validBitmap(0)
{
    setupUi(this);
	setupInputs();

	connect(setToRoverButtonA, SIGNAL(clicked()), this, SLOT(setInputAToRover()));
	connect(setToRoverButtonB, SIGNAL(clicked()), this, SLOT(setInputBToRover()));
	connect(saveToLogButton, SIGNAL(clicked()), this, SLOT(saveToLog()));
	connect(clearLogButton, SIGNAL(clicked()), this, SLOT(clearLog()));
}
Ejemplo n.º 13
0
/*
 *  Constructs a sqlLogForm as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
sqlLogForm::sqlLogForm( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "sqlLogForm" );
    sqlLogFormLayout = new QVBoxLayout( this, 11, 6, "sqlLogFormLayout"); 

    layout6 = new QHBoxLayout( 0, 0, 6, "layout6"); 

    textLabel1 = new QLabel( this, "textLabel1" );
    layout6->addWidget( textLabel1 );

    comboBox3 = new QComboBox( FALSE, this, "comboBox3" );
    layout6->addWidget( comboBox3 );
    QSpacerItem* spacer = new QSpacerItem( 150, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout6->addItem( spacer );

    clearButton = new QPushButton( this, "clearButton" );
    layout6->addWidget( clearButton );
    sqlLogFormLayout->addLayout( layout6 );

    logStack = new QWidgetStack( this, "logStack" );

    WStackPage = new QWidget( logStack, "WStackPage" );
    WStackPageLayout = new QGridLayout( WStackPage, 1, 1, 11, 6, "WStackPageLayout"); 

    userLogText = new QTextEdit( WStackPage, "userLogText" );
    userLogText->setTextFormat( QTextEdit::PlainText );
    userLogText->setReadOnly( TRUE );

    WStackPageLayout->addWidget( userLogText, 0, 0 );
    logStack->addWidget( WStackPage, 0 );

    WStackPage_2 = new QWidget( logStack, "WStackPage_2" );
    WStackPageLayout_2 = new QVBoxLayout( WStackPage_2, 11, 6, "WStackPageLayout_2"); 

    appLogText = new QTextEdit( WStackPage_2, "appLogText" );
    appLogText->setTextFormat( QTextEdit::PlainText );
    appLogText->setReadOnly( TRUE );
    WStackPageLayout_2->addWidget( appLogText );
    logStack->addWidget( WStackPage_2, 1 );
    sqlLogFormLayout->addWidget( logStack );
    languageChange();
    resize( QSize(547, 203).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( clearButton, SIGNAL( clicked() ), this, SLOT( clearLog() ) );
    connect( comboBox3, SIGNAL( activated(int) ), logStack, SLOT( raiseWidget(int) ) );
}
Ejemplo n.º 14
0
LogListWidget::LogListWidget(int max_lines, QWidget *parent) :
  QListWidget(parent),
  m_maxLines(max_lines)
{
  // Allow multiple selections
  setSelectionMode(QAbstractItemView::ExtendedSelection);
  // Context menu
  QAction *copyAct = new QAction(IconProvider::instance()->getIcon("edit-copy"), tr("Copy"), this);
  QAction *clearAct = new QAction(IconProvider::instance()->getIcon("edit-clear"), tr("Clear"), this);
  connect(copyAct, SIGNAL(triggered()), SLOT(copySelection()));
  connect(clearAct, SIGNAL(triggered()), SLOT(clearLog()));
  addAction(copyAct);
  addAction(clearAct);
  setContextMenuPolicy(Qt::ActionsContextMenu);
}
Ejemplo n.º 15
0
//-------------------------------------------------------------------------
void MainWindow::openConfigurationDialog()
{
  QString fileName = QFileDialog::getOpenFileName(this, "Configuration file",
                                                  APP::Application::getConfigurationPath().c_str(), "C++ Source (*.cc *.cpp)");
  if (!fileName.isEmpty())
  {
    std::stringstream diagnostics;
    std::string configFile(fileName.toUtf8().constData());
    if (!APP::Application::loadConfiguration(configFile, diagnostics))
    {
      displayError("Error loading configuration", diagnostics.str().c_str());
    }
    APP::Application::getPreferences().setConfiguration(configFile);
    clearLog();
    log(diagnostics.str());
  }
}
Ejemplo n.º 16
0
Aircrack::Aircrack(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Aircrack)
{

    logThread::addLog("Constructor of aircrack GUI", logInfo::MAIN);

    attack = new attackAircrack();
    ui->setupUi(this);
    connect(attack, SIGNAL(processOutput(QString)), this, SLOT(update(QString)));
    connect(this->ui->pushButtonStop, SIGNAL(clicked()), this, SLOT(stop()));
    connect(this->ui->pushButtonLog, SIGNAL(clicked()), this, SLOT(clearLog()));
    //SUPER FIX: maybe we found the key so fast that function update could not execute.
    connect(attack->getProcess(), SIGNAL(finished(int)), this, SLOT(update()));

    this->setStatus(STOPPED);

}
Ejemplo n.º 17
0
static void* createInstance(PDUI* uiFuncs, ServiceFunc* serviceFunc) {
    (void)serviceFunc;
    (void)uiFuncs;

    ConsoleData* consoleData = new ConsoleData;
    clearLog(consoleData);

    consoleData->historyPos = -1;
    consoleData->commands.push_back((char*)"HELP");
    consoleData->commands.push_back((char*)"HISTORY");
    consoleData->commands.push_back((char*)"CLEAR");
    consoleData->commands.push_back((char*)"CLASSIFY");   // TODO: "classify" is here to provide an example of "C"+[tab] completing to "CL" and displaying matches.
    consoleData->commands.push_back((char*)"TESTTEXT");   // TODO: Temp, for testing
    consoleData->commands.push_back((char*)"TESTERROR");  // TODO: Temp, for testing
    consoleData->commands.push_back((char*)"TESTSCRIPT"); // TODO: Temp, for testing

    return consoleData;
}
Ejemplo n.º 18
0
//-------------------------------------------------------------------------
void MainWindow::processContentExt()
{
    const APP::Preferences& preferences = APP::Application::getPreferences();

    QString fileName = getCurrentSourceFile();
    QString logStr;
    if(fileName.isEmpty())
    {
      return;
    }

//Todo move to new class

    //Prepare external program to run
    QString extProg = preferences.getExtProcessorFile().c_str();
    QStringList extProgArguments;
    if (preferences.getExtProcessorOption().size() > 0)
        extProgArguments << preferences.getExtProcessorOption().c_str();

    extProgArguments.replaceInStrings("%f", QString::fromStdString(fileName.toStdString()));

    QProcess extProcess;
    extProcess.start(extProg, extProgArguments);

    if (!extProcess.waitForStarted())
        logStr.append("!!! Error starting external process !!!");

    //We are not writing data to the external process so we can close this channel.
    //This resolves some trouble with processes waiting for input.
    extProcess.closeWriteChannel();

    if (!extProcess.waitForFinished())
        logStr.append("!!! Error running external process !!!");

    logStr.append( extProcess.readAllStandardError());

//Todo move to new class (end)

    setTransformedSource( QString(extProcess.readAllStandardOutput()).toLatin1() );

    clearLog();
    log(logStr.toStdString());

}
Ejemplo n.º 19
0
//-------------------------------------------------------------------------
void MainWindow::openProject()
{
  QString projectName = QFileDialog::getOpenFileName(this, "Project",
                                                     QString::fromUtf8(APP::Application::getCurrentProjectFile().c_str()),
                                                     "Scout project (*.spr)");
  if (!projectName.isEmpty())
  {
    std::stringstream diagnostics;
    if (!APP::Application::loadProject(projectName.toUtf8().constData(), diagnostics))
    {
      displayError("Error loading project", diagnostics.str().c_str());
    }
    else
    {
      clearLog();
      log(diagnostics.str());
    }
  }
}
Ejemplo n.º 20
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    ssl(new SSLHelper)
{
    setAcceptDrops(true);
    ui->setupUi(this);
    connect(ui->pushButton, SIGNAL( clicked() ), this, SLOT(startDiagnosis()));
    connect(ssl, SIGNAL(logging()), this, SLOT(addLog()));
    connect(ui->refreshButton, SIGNAL( clicked() ), this, SLOT(refreshCAs()));
    connect(ssl, SIGNAL(addCA(string,string)), this, SLOT(addToolboxItem(string,string)));
    connect(ui->dumpcertsButton, SIGNAL( clicked()), this, SLOT(dumpCerts()));
    connect(ui->clearlogButton, SIGNAL( clicked()), this, SLOT(clearLog()));
    refreshCAs();
    ui->toolBox->setAcceptDrops(true);
    connect(ui->toolBox, SIGNAL(dropCert(string)), this, SLOT(addCert(string)));
    connect(ssl, SIGNAL(verifiedStatus(bool)), this, SLOT(verified(bool)));
    connect(ui->sendLog, SIGNAL(clicked()), this, SLOT(emailLog()));
}
Ejemplo n.º 21
0
void RestoreFrame::OnStartButtonClick(wxCommandEvent& WXUNUSED(event))
{
    verboseMsgsM = checkbox_showlog->IsChecked();
    clearLog();

    DatabasePtr database = getDatabase();
    wxCHECK_RET(database,
        "Cannot restore unassigned database");
    ServerPtr server = database->getServer();
    wxCHECK_RET(server,
        "Cannot restore database without assigned server");

    wxString username;
    wxString password;
    if (!getConnectionCredentials(this, database, username, password))
        return;

    int flags = (int)IBPP::brVerbose; // this will be ORed in anyway
    if (checkbox_replace->IsChecked())
        flags |= (int)IBPP::brReplace;
    if (checkbox_deactivate->IsChecked())
        flags |= (int)IBPP::brDeactivateIdx;
    if (checkbox_noshadow->IsChecked())
        flags |= (int)IBPP::brNoShadow;
    if (checkbox_validity->IsChecked())
        flags |= (int)IBPP::brNoValidity;
    if (checkbox_commit->IsChecked())
        flags |= (int)IBPP::brPerTableCommit;
    if (checkbox_space->IsChecked())
        flags |= (int)IBPP::brUseAllSpace;

    unsigned long pagesize;
    if (!choice_pagesize->GetStringSelection().ToULong(&pagesize))
        pagesize = 0;

    std::auto_ptr<wxThread> thread(new RestoreThread(this,
        server->getConnectionString(), username, password,
        text_ctrl_filename->GetValue(), database->getPath(), pagesize,
        (IBPP::BRF)flags));
    startThread(thread);
    updateControls();
}
Ejemplo n.º 22
0
aireplayDeauth::aireplayDeauth(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::aireplayDeauth)
{
    logThread::addLog("Constructor of fake deauth GUI", logInfo::MAIN);

    qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
    attack = new attackDeauth();

    ui->setupUi(this);

    connect(attack, SIGNAL(processOutput(QString)), this, SLOT(update(QString)), Qt::QueuedConnection);
    connect(this->ui->pushButtonLog, SIGNAL(clicked()), this, SLOT(clearLog()));
    connect(this->ui->pushButtonStop, SIGNAL(clicked()), this, SLOT(stop()));

    //CONNECT WITH FUNCTION WHEN THE PROCESS END BY HIMSELF
    connect(attack->getProcess(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(endAuthentication(int,QProcess::ExitStatus)));

    this->setStatus(STOPPED);
}
Ejemplo n.º 23
0
int main(int argc, char *argv[]) {
	data_t entry;
	int dataSize;
	time_t tcurrent;
	char *data;
	FILE *fp;
	int aflag = 0; // option to do the if stmt
	char *mvalue = NULL; // should log any value given here
	int c;

	// clear any old log that could exist
	clearLog();
	// getopt example
	while((c = getopt(argc, argv, "am:")) != -1) { // ck options
		switch(c) {
			case 'a':
				aflag = 1; 
				break;
			case 'm':
				mvalue = optarg;
				// send mvalue to logger 
				tcurrent = time(NULL);
				entry = (data_t){.time = tcurrent, .string = mvalue};
				addMsg(entry, argv[0]);
				break;
			case '?':
				if(optopt == 'm') { // init and add entry to log
					tcurrent = time(NULL);
					data = "Error: option -m requires an argument";
					entry = (data_t){.time = tcurrent, .string = data};
					addMsg(entry, argv[0]);
				} else { // init and add entry to log
					tcurrent = time(NULL);
					data = "Error: options available are  a & c";
					entry = (data_t){.time = tcurrent, .string = data};
					addMsg(entry, argv[0]);
				}
				break;
			default:
				printf("Unknown error occured");
		}
Ejemplo n.º 24
0
GUIManager::GUIManager(QWidget *parent) : QWidget(parent, Qt::Window)
{    
#ifdef Q_OS_OSX
    if(Options::independentWindowINDI())
         setWindowFlags(Qt::Window);
     else{
        setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
        connect(QApplication::instance(), SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(changeAlwaysOnTop(Qt::ApplicationState)));
     }
#endif

    mainLayout    = new QVBoxLayout(this);
    mainLayout->setMargin(10);
    mainLayout->setSpacing(10);

    mainTabWidget = new QTabWidget(this);

    mainLayout->addWidget(mainTabWidget);

    setWindowIcon(QIcon::fromTheme("kstars_indi", QIcon(":/icons/breeze/default/kstars_indi.svg")));

    setWindowTitle(i18n("INDI Control Panel"));
    setAttribute(Qt::WA_ShowModal, false);

    clearB      = new QPushButton(i18n("Clear"));
    closeB      = new QPushButton(i18n("Close"));

    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->insertStretch(0);
    buttonLayout->addWidget(clearB, 0, Qt::AlignRight);
    buttonLayout->addWidget(closeB, 0, Qt::AlignRight);

    mainLayout->addLayout(buttonLayout);

    connect(closeB, SIGNAL(clicked()), this, SLOT(close()));
    connect(clearB, SIGNAL(clicked()), this, SLOT(clearLog()));

    resize( 640, 480);
}
Ejemplo n.º 25
0
void BaseForm::initLogger(QCheckBox* w, QToolButton* c, QTreeWidget* o, QPlainTextEdit* d)
{
    m_logger.init(o, w, d);

    connect(c, SIGNAL(released()), this, SLOT(clear()));
    connect(&m_logger, SIGNAL(clearLog()), this, SLOT(clear()));

    bindFocus(o, Qt::Key_F3);

    QShortcut* wr = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
    QShortcut* cl = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_D), this);
    QShortcut* sl = new QShortcut(QKeySequence(Qt::Key_F4), this);

    sl->setProperty(PROP_TARG, qVariantFromValue((void*)d));

    connect(wr, SIGNAL(activated()), w, SLOT(click()));
    connect(sl, SIGNAL(activated()), this, SLOT(hotOutput()));
    connect(cl, SIGNAL(activated()), this, SLOT(clear()));

    connect(this, SIGNAL(output(const QString&)), &m_logger, SLOT(output(const QString&)));
    connect(this, SIGNAL(output(const QString&, const char*, quint32)), &m_logger, SLOT(output(const QString&, const char*, quint32)));
}
    void ScriptingWidget::setupGUI() {
        setWindowTitle(tr("Scripting Console"));

        QHBoxLayout* mainLayout = new QHBoxLayout(this);

        QVBoxLayout* leftColumnLayout = new QVBoxLayout();
        mainLayout->addLayout(leftColumnLayout);

        QHBoxLayout* controlsLayout = new QHBoxLayout();
        leftColumnLayout->addLayout(controlsLayout);

        _consoleDisplay = new QTextEdit(this);
        _consoleDisplay->setReadOnly(true);
        leftColumnLayout->addWidget(_consoleDisplay);

        // Use the system's default monospace font at the default size in the log viewer
        QFont monoFont = QFont("Monospace");
        monoFont.setStyleHint(QFont::TypeWriter);
        monoFont.setPointSize(QFont().pointSize() + 1);

        _consoleDisplay->document()->setDefaultFont(monoFont);
        _editCommand = new CompletingLuaLineEdit(nullptr, this);
        _editCommand->setPlaceholderText(tr("Enter Lua commands here..."));
        _editCommand->installEventFilter(this);
        controlsLayout->addWidget(_editCommand);

        _btnExecute = new QPushButton(tr("&Execute"), this);
        controlsLayout->addWidget(_btnExecute);

        _btnClear = new QPushButton(tr("&Clear"), this);
        controlsLayout->addWidget(_btnClear);


        connect(_btnClear, SIGNAL(clicked()), this, SLOT(clearLog()));
        connect(_btnExecute, SIGNAL(clicked()), this, SLOT(execute()));
        connect(_editCommand, SIGNAL(returnPressed()), this, SLOT(execute()));

        connect(this, SIGNAL(s_messageAppended(QString)), this, SLOT(appendMessage(QString)));
    }
Ejemplo n.º 27
0
LogViewer::LogViewer( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
	setName( "LogViewer" );
	setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, sizePolicy().hasHeightForWidth() ) );
	
 	QBoxLayout *logLayout = new QVBoxLayout( this, 5, 5); 
	
	textLog = new QTextEdit(this);
	textLog->setMinimumSize( QSize( 200, 80) );
	textLog->setTextFormat(Qt::LogText);
	QFont text_font(  textLog->font() );
	text_font.setFamily( "Courier" );
	text_font.setPointSize( 12 );
	textLog->setFont( text_font ); 
	
	clearButton = new QPushButton( this, "clearButton" );
	saveButton = new QPushButton( this, "saveButton" );
	closeButton = new QPushButton( this, "closeButton" );
	
	logLayout->addWidget( textLog, 2 );
	
	QBoxLayout *hLayout = new QHBoxLayout( logLayout ); 
	hLayout->addWidget(clearButton);
	hLayout->addWidget(saveButton);
	hLayout->addWidget(closeButton);
	
	languageChange();
	resize( QSize(700, 300).expandedTo(minimumSizeHint()) );
	clearWState( WState_Polished );
	
	// signals and slots connections
	connect( clearButton, SIGNAL( clicked() ), this, SLOT( clearLog() ) );
	connect( saveButton, SIGNAL( clicked() ), this, SLOT( saveLog() ) );
	connect( closeButton, SIGNAL( clicked() ), this, SLOT( closeLog() ) );
}
Ejemplo n.º 28
0
static void showInUI(ConsoleData* consoleData, PDReader* reader, PDUI* uiFuncs) {
    (void)consoleData;
    (void)reader;

    uiFuncs->text_wrapped("ProDBG Scripting Console");
    uiFuncs->text_wrapped("Enter 'HELP' for help. Press TAB to use text completion.");

    // TODO: display from bottom
    // TODO: clip manually

    if (uiFuncs->small_button("Clear"))
        clearLog(consoleData);

    uiFuncs->same_line(0, -1);
    uiFuncs->separator();

    PDVec2 pad = { 0.0f, 0.0f };

    uiFuncs->push_style_varVec(PDUIStyleVar_FramePadding, pad);

    //static ImGuiTextFilter filter;
    //filter.Draw("Filter (\"incl,-excl\") (\"error\")", 180);

    if (uiFuncs->is_item_hovered())
        uiFuncs->set_keyboard_focus_here(-1); // Auto focus on hover

    uiFuncs->pop_style_var(1);

    uiFuncs->separator();

    PDVec2 spacing = { 0, -uiFuncs->get_text_line_height_with_spacing() * 2 };
    PDVec2 itemSpacing = { 4.0f, 1.0f };

    uiFuncs->begin_child("ScrollingRegion", spacing, false, PDUIWindowFlags(0));
    uiFuncs->push_style_varVec(PDUIStyleVar_ItemSpacing, itemSpacing); // Tighten spacing

    for (size_t i = 0; i < consoleData->items.size(); i++) {
        const char* item = consoleData->items[i];
        //if (!filter.PassFilter(item))
        //    continue;
        PDColor col = PDUI_COLOR(255, 255, 255, 255); //{ 1.0f, 1.0f, 1.0f, 1.0f }; // A better implementation may store a type per-item. For now let's just parse the text.
        if (strstr(item, "[Error]"))
            col = PDUI_COLOR(255, 100, 100, 255);
        else if (strncmp(item, "# ", 2) == 0)
            col = PDUI_COLOR(255, 200, 150, 255);
        uiFuncs->text_colored(col, item);
    }

    if (consoleData->scrollToBottom)
        uiFuncs->set_scroll_here(0.5f);

    consoleData->scrollToBottom = false;

    uiFuncs->pop_style_var(1);
    uiFuncs->end_child();
    uiFuncs->separator();

    // Command Line

    if (uiFuncs->input_text("Input", consoleData->inputBuffer, sizeof(consoleData->inputBuffer), PDUIInputTextFlags_EnterReturnsTrue | PDUIInputTextFlags_CallbackCompletion | PDUIInputTextFlags_CallbackHistory, &textEditCallbackStub, (void*)consoleData)) {
        char* inputEnd = consoleData->inputBuffer + strlen(consoleData->inputBuffer);

        while (inputEnd > consoleData->inputBuffer && inputEnd[-1] == ' ')
            inputEnd--;

        *inputEnd = 0;

        if (consoleData->inputBuffer[0])
            execCommand(consoleData, consoleData->inputBuffer);

        strcpy(consoleData->inputBuffer, "");
    }

    if (uiFuncs->is_item_hovered())
        uiFuncs->set_keyboard_focus_here(-1); // Auto focus on hover
}
Ejemplo n.º 29
0
static void destroyInstance(void* user_data) {
    ConsoleData* consoleData = (ConsoleData*)user_data;
    clearLog(consoleData);
    free(consoleData);
}
Ejemplo n.º 30
0
LogfileReader::LogfileReader(QWidget* parent, const QString& log, const QString& caption) : ChatWindow(parent)
{
    setType(ChatWindow::LogFileReader);
    setName(i18n("Logfile of %1", caption));

    fileName = log;

    setSpacing(0);

    toolBar = new KToolBar(this, true, true);
    toolBar->setObjectName("logfile_toolbar");
    toolBar->addAction(QIcon::fromTheme("document-save-as"), i18n("Save As..."), this, SLOT(saveLog()));
    toolBar->addAction(QIcon::fromTheme("view-refresh"), i18n("Reload"), this, SLOT(updateView()));
    toolBar->addAction(QIcon::fromTheme("edit-delete"), i18n("Clear Logfile"), this, SLOT(clearLog()));

    toolBar->addWidget(new QLabel(i18n("Show last:"),toolBar));
    sizeSpin = new QSpinBox(toolBar);
    sizeSpin->setMinimum(10);
    sizeSpin->setMaximum(1000);
    sizeSpin->setSingleStep(10);
    sizeSpin->setObjectName("logfile_size_spinbox");
    sizeSpin->setWhatsThis(i18n("Use this box to set the maximum size of the log file. This setting does not take effect until you restart Konversation. Each log file may have a separate setting."));
    sizeSpin->setValue(Preferences::self()->logfileBufferSize());
    sizeSpin->setSuffix(i18n(" KB"));
    sizeSpin->installEventFilter(this);
    toolBar->addWidget(sizeSpin);
    connect(sizeSpin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &LogfileReader::storeBufferSize);

    IRCViewBox* ircBox = new IRCViewBox(this);
    setTextView(ircBox->ircView());
    getTextView()->setWhatsThis(i18n("The messages in the log file are displayed here. The oldest messages are at the top and the most recent are at the bottom."));

    updateView();
    ircBox->ircView()->setFocusPolicy(Qt::StrongFocus);
    setFocusPolicy(Qt::StrongFocus);
    setFocusProxy(ircBox->ircView());

    updateAppearance();

    connect(getTextView(), SIGNAL(gotFocus()), getTextView(), SLOT(setFocus()));
}