当前位置: 首页>>代码示例>>C++>>正文


C++ qInstallMsgHandler函数代码示例

本文整理汇总了C++中qInstallMsgHandler函数的典型用法代码示例。如果您正苦于以下问题:C++ qInstallMsgHandler函数的具体用法?C++ qInstallMsgHandler怎么用?C++ qInstallMsgHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qInstallMsgHandler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QString

LogToFileMsgHandler::LogToFileMsgHandler()
{
    logFile = 0;
    qint64 appPid = QApplication::applicationPid();
    QString logFileName = QString("/tmp/ktechlab-pid-%1-log").arg(appPid);
    qDebug() << "Starting logging to " << logFileName;
    logFile = fopen(logFileName.toLatin1().data(), "w+");
    if (!logFile) {
        const int lastErrno = errno;
        qWarning() << "Failed to create log file" << logFileName
            << ". errno=" << lastErrno << ", strerror=" << strerror(lastErrno);
        return;
    }
    qInstallMsgHandler(ktlMessageOutput);
    qDebug() << "logging started to " << logFileName << " by " << this;
}
开发者ID:ktechlab,项目名称:ktechlab-0.3,代码行数:16,代码来源:logtofilemsghandler.cpp

示例2: main

int main(int argc, char **argv)
{
  if (logFileOutput) {
#if defined(HAVE_QT5)
    qInstallMessageHandler(LogFile::msgHandler);
#else
    qInstallMsgHandler(LogFile::msgHandler);
#endif
  }

  MainApplication app(argc, argv);

  if (app.isClosing())
    return 0;

  return app.exec();
}
开发者ID:DanMan,项目名称:quiterss,代码行数:17,代码来源:main.cpp

示例3: instance

    static LoggerPrivate* instance()
    {
      LoggerPrivate* result = 0;
      {
        result = m_self;
      }

      if (!result)
      {
        m_self = new LoggerPrivate;
        qInstallMsgHandler(qtLoggerMessageHandler);
        qAddPostRoutine(cleanupLoggerPrivate);
        result = m_self;
      }

      return result;
    }
开发者ID:therealbop,项目名称:qgltennis,代码行数:17,代码来源:Logger.cpp

示例4: main

int main(int argc, char *argv[]) {

    if (getenv("QT_RADIO_NO_DEBUG")) fOutputDisabled = 1;
    qInstallMsgHandler(myMessageOutput);

    // initialize resources, if needed
    // Q_INIT_RESOURCE(resfile);

    QApplication app(argc, argv);

    // create and show your widgets here
    UI widget;

    widget.show();

    return app.exec();
}
开发者ID:kj6dzb,项目名称:ghpsdr3-alex,代码行数:17,代码来源:main.cpp

示例5: main

int main(int argc, char* argv[]){

  QCoreApplication::setOrganizationName("Ibrahim Sha'ath");
  QCoreApplication::setOrganizationDomain("ibrahimshaath.co.uk");
  QCoreApplication::setApplicationName(GuiStrings::getInstance()->appName());

  // libav setup
  av_register_all();
  av_log_set_level(AV_LOG_ERROR);
  av_lockmgr_register(NULL);

  // primitive command line use
  if(argc > 2){
    int cliResult = commandLineInterface(argc,argv);
    if(cliResult >= 0)
      return cliResult;
  }

  qInstallMsgHandler(LoggingHandler);

  QApplication a(argc, argv);

  QTranslator qtTranslator;
  qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
  a.installTranslator(&qtTranslator);

  QString localeParam = "%1/Translations/is_keyfinder_%2.qm";
#if defined Q_OS_MAC
  QDir dir(QApplication::applicationDirPath());
  dir.cdUp();
  QString localePath = localeParam.arg(dir.absolutePath()).arg(QLocale::system().name());
#elif defined Q_OS_LINUX
  QString localePath = localeParam.arg(WORK_CACHEDIR).arg(QLocale::system().name());
#else
  QString localePath = localeParam.arg(QCoreApplication::applicationDirPath()).arg(QLocale::system().name());
#endif

  QTranslator myappTranslator;
  myappTranslator.load(localePath);
  a.installTranslator(&myappTranslator);

  MainMenuHandler* menuHandler = new MainMenuHandler(0);
  menuHandler->new_Batch_Window(true);

  return a.exec();
}
开发者ID:birkestroem,项目名称:is_KeyFinder,代码行数:46,代码来源:main.cpp

示例6: main

int main( int argc, char ** argv )
{
    while (argc > 1) {
        if (strcmp(argv[--argc], "-d") == 0) {
            // daemonize
            openlog(APPNAME, 0, LOG_DAEMON);
            qInstallMsgHandler(toSyslog);
            if (daemon_init() != 0) {
                fprintf(stderr, "%s: Error: Unable to daemonize\n", APPNAME);
                return 1;
	    }
	}
    }

    OQWSServer a(argc, argv, QApplication::GuiServer);
    return a.exec();
}
开发者ID:opieproject,项目名称:opie,代码行数:17,代码来源:main.cpp

示例7: main

int main(int argc, char **argv)
{
#ifndef DEBUG
    qInstallMsgHandler(debugMessagesFilter);
#endif
    QtSingleApplication a(argc, argv);

    a.setApplicationName("ImageShack Uploader");
    a.setOrganizationName("ImageShack");
    a.setOrganizationDomain("imageshack.us");
    a.setApplicationVersion(VERSION);

    QStringList filelist;
    for (int i=1; i< argc; i++)
        filelist << QString::fromLocal8Bit(argv[i]);
    if ((argc==2) && (QString(argv[1]) == "-unregister"))
    {
        qDebug() << "unregistering...";
#ifdef Q_OS_WIN
        WindowsExplorerIntegrator().deintegrate();
#endif
        QSettings sets;
        sets.clear();
        return 0;
    }
    if (a.isRunning() && argc>1)
    {
        a.sendMessage(filelist.join("\r\n"), 5000);
        return 0;
    }

    MainWindow w;
    if (filelist.size()) w.commandLineAddFile(filelist.join("\r\n"));
    QObject::connect(&a,
                     SIGNAL(messageReceived(const QString&)),
                     &w,
                     SLOT(commandLineAddFile(const QString&)));

#ifdef Q_OS_WIN
    WindowsExplorerIntegrator().integrate();
#endif

    w.show();

    return a.exec();
}
开发者ID:altamimi513,项目名称:imageshack-uploader,代码行数:46,代码来源:main.cpp

示例8: main

int main( int _argc, char* _argv[] )
{
    try{
        App Application(_argc, _argv);

        QCoreApplication::setOrganizationName("genome-tools");
        QCoreApplication::setApplicationName(_APPNAME);

        gArgs().Init(QCoreApplication::arguments());
        for(int j=1; j< _argc;j++) {
              QString s(_argv[j]);
              if(s.contains("pass"))
                  for(int i=0;i<s.size();i++)
                      _argv[j][i]='*';
        }
        _logfile.setFileName(gArgs().getArgs("log").toString());
        _logfile.open(QIODevice::WriteOnly|QIODevice::Append);

#ifdef _WARDROBE_
        gSettings().Init(gArgs().getArgs("wardrobe").toString());
#endif

#if QT_VERSION >= 0x050000
        qInstallMessageHandler(printMsgHandler);
#else
        qInstallMsgHandler(printMsgHandler);
#endif

        FSTM *machine = new FSTM();
        QObject::connect(machine,SIGNAL(finished()),QCoreApplication::instance(),SLOT(quit()));
        QTimer::singleShot(0, machine, SLOT(start()));
        return Application.exec();
    }
    catch(char *str)
    {
        cerr << "Error rised:"<<str << endl;
    }
    catch(exception &e )
    {
        cerr << "Caught " << e.what( ) << endl;
        cerr << "Type " << typeid( e ).name( ) << endl;
    }
    catch(...)
    {
    }
}
开发者ID:portah,项目名称:repeats,代码行数:46,代码来源:Main.hpp

示例9: main

int main(int argc, char *argv[]){
	qDebug()<<"Starting up.";
	qInstallMsgHandler(dbgout);
	qDebug()<<"Debug output is on."<<endl;
	qDebug()<<"Creating QApplication...";
	QApplication a(argc, argv); qDebug()<<"done."<<endl;
	qDebug()<<"Creating WPI...";
	WPI wpi; qDebug()<<"done."<<endl;
	qDebug()<<"Setting up signals and slots...";
	QObject::connect(&a,SIGNAL(aboutToQuit()),&wpi,SLOT(aboutToQuit()));
	QTimer::singleShot(100,&wpi,SLOT(run())); qDebug()<<"done."<<endl;
	qDebug()<<"Entering main event loop."<<endl;
	int rc=a.exec();
	qDebug().nospace()<<"Exited main event loop with rc="<<rc<<"."<<endl;
	qDebug()<<"Quitting."<<endl;
	return rc;
}
开发者ID:dbanet,项目名称:QWarpIN,代码行数:17,代码来源:main.cpp

示例10: main

int main( int argc, char ** argv ) {
    qInstallMsgHandler(SysTrace::debug);
    QApplication app( argc, argv );
#if defined(Q_OS_MAC)
    QDir dir(QApplication::applicationDirPath());
    dir.cdUp();
    dir.cd("plugins");
    QApplication::addLibraryPath(dir.absolutePath());
#endif
    QString absolutePath = QCoreApplication::instance()->applicationDirPath();
    // portable installation:
    // check for a configuration file in the program folder.
    QSettings *user;
    if(QFileInfo(absolutePath + "/RockboxUtility.ini").isFile())
        user = new QSettings(absolutePath + "/RockboxUtility.ini", QSettings::IniFormat, 0);
    else user = new QSettings(QSettings::IniFormat, QSettings::UserScope, "rockbox.org", "RockboxUtility");

    QString applang = QLocale::system().name();
    QTranslator translator;
    QTranslator qttrans;
    // install translator
    if(!user->value("lang", "").toString().isEmpty()) {
        applang = user->value("lang", "").toString();
    }
    if(!applang.isEmpty()) {
        if(!translator.load("rbutil_" + applang, absolutePath))
            translator.load("rbutil_" + applang, ":/lang");
        if(!qttrans.load("qt_" + applang,
            QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
            qttrans.load("qt_" + applang, ":/lang");

        QLocale::setDefault(applang);
    }
    delete user;
    app.installTranslator(&translator);
    app.installTranslator(&qttrans);
    if(applang.startsWith("he"))
        app.setLayoutDirection(Qt::RightToLeft);

    RbUtilQt window(0);
    window.show();

//    app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
    return app.exec();

}
开发者ID:a-martinez,项目名称:rockbox,代码行数:46,代码来源:main.cpp

示例11: main

int main(int argc, char *argv[]) {
    const char *logname;

    if ( (logname = getenv("SWIPL_LOGFILE")) ) {
        logfile = fopen(logname, "w");
#if QT_VERSION < 0x050000
        previous = qInstallMsgHandler(logger);
#else
        previous = qInstallMessageHandler(logger);
#endif
    }

    auto a = new swipl_win(argc, argv);
    int rc = a->exec();
    qDebug() << "main loop finished" << rc;
    return rc;
}
开发者ID:ddgold,项目名称:design_patterns,代码行数:17,代码来源:main.cpp

示例12: QSocketNotifier

void
Phantom::onInitialized()
{
    // Add 'phantom' object to the global scope
    m_page->mainFrame()->addToJavaScriptWindowObject("phantom", this);

    // Bootstrap the PhantomJS scope
    m_page->mainFrame()->evaluateJavaScript(Utils::readResourceFileUtf8(":/bootstrap.js"));

    // Listen for stdin closing
    pStdinNotifier = new QSocketNotifier(STDIN_FILENO, QSocketNotifier::Read, this);
    connect(pStdinNotifier, SIGNAL(activated(int)), this, SLOT(onStdin()));
    pStdinNotifier->setEnabled(true);

    // Avoid printing qWarnings (the above notifier generates one at program exit)
    qInstallMsgHandler(messageOutput);
}
开发者ID:noblesamurai,项目名称:phantomjs,代码行数:17,代码来源:phantom.cpp

示例13: QObject

	Server::Server ()
	: QObject ()
	{
		qInstallMsgHandler (Write);
		const auto pid = QCoreApplication::applicationPid ();

		RegisterTypes ();

		auto sb = QDBusConnection::sessionBus ();
		const auto& serviceName = QString ("org.LeechCraft.Wrapper_%1").arg (pid);
		qDebug () << "registering service..." << sb.registerService (serviceName);
		qDebug () << "registering primary object..." << sb.registerObject ("/org/LeechCraft/Control",
				this, QDBusConnection::ExportAllContents);

		QLocalSocket socket;
		socket.connectToServer (QString ("lc_waiter_%1").arg (pid));
		qDebug () << "notifying master..." << socket.waitForConnected ();
	}
开发者ID:ROOAARR,项目名称:leechcraft,代码行数:18,代码来源:server.cpp

示例14: main

int main(int argc, char *argv[])
{
    qInstallMsgHandler(msgOutput);

    QApplication app(argc, argv);

    reditor::REditor * edit = new reditor::REditor();
    reditor::RMainWnd * mwnd = new reditor::RMainWnd(edit);
    edit->attachTo( static_cast<reditor::REditWnd *>(mwnd->centralWidget()) );
    edit->attachToMainWnd(mwnd); // TODO create reditor manager class and implement all slots there to make possible multiple editor windows
    mwnd->resize(800, 600);
    mwnd->show();
    // can't be moved earlier because it requires initiated OpenGL engine to load textures to GPU memory
    rscDB.load(reditor::RConfig::texturesDir(""), reditor::RConfig::modelsDir(""));
    mwnd->initObjPickers();

    return app.exec();
}
开发者ID:ddaroo,项目名称:RoomEdit,代码行数:18,代码来源:main.cpp

示例15: locker

void Logger::openLog(const QString &APath)
{
	QMutexLocker locker(&FMutex);
	LoggerData *q = instance()->d;
	if (!q->logFile.isOpen() && !APath.isEmpty())
	{
		QDir logDir(APath);
		QStringList logFiles = logDir.entryList(QStringList()<<"*.log",QDir::Files,QDir::Name);
		while (logFiles.count() > MAX_LOG_FILES)
			QFile::remove(logDir.absoluteFilePath(logFiles.takeFirst()));

#ifndef DEBUG_MODE
		qInstallMsgHandler(qtMessagesHandler);
#endif
		q->logFile.setFileName(logDir.absoluteFilePath(DateTime(QDateTime::currentDateTime()).toX85DateTime().replace(":","-") +".log"));
		q->logFile.open(QFile::WriteOnly|QFile::Truncate);
	}
}
开发者ID:ChALkeR,项目名称:vacuum-im,代码行数:18,代码来源:logger.cpp


注:本文中的qInstallMsgHandler函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。