示例#1
0
文件: main.cpp 项目: KDE/ktp-text-ui
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    KLocalizedString::setApplicationDomain("ktp-log-viewer");

    KAboutData aboutData("ktp-log-viewer",
                         i18n("KDE IM Log Viewer"),
                         QStringLiteral(KTP_TEXT_UI_VERSION_STRING));
    aboutData.addAuthor(i18n("David Edmundson"), i18n("Developer"), "*****@*****.**");
    aboutData.addAuthor(i18n("Daniele E. Domenichelli"), i18n("Developer"), "*****@*****.**");
    aboutData.addAuthor(i18n("Dan Vrátil"), i18n("Developer"), "*****@*****.**");
    aboutData.setProductName("telepathy/log-viewer"); //set the correct name for bug reporting
    aboutData.setOrganizationDomain(QByteArray("kde.org"));
    aboutData.setLicense(KAboutLicense::GPL_V2);

    KAboutData::setApplicationData(aboutData);

    // register to DBus
    const KDBusService dbusService(KDBusService::Multiple);

    QCommandLineParser parser;
    parser.addHelpOption();
    parser.addVersionOption();

    QCommandLineOption accountId(QStringLiteral("accountID"), i18n("The UID of the account to preselect"));
    QCommandLineOption contactId(QStringLiteral("contactID"), i18n("The UID of the contact to preselect"));

    parser.addOption(accountId);
    parser.addOption(contactId);

    parser.process(app);

    Tp::registerTypes();

    Tp::AccountFactoryPtr  accountFactory = Tp::AccountFactory::create(
                                                QDBusConnection::sessionBus(),
                                                Tp::Features() << Tp::Account::FeatureCore
                                                    << Tp::Account::FeatureAvatar
                                                    << Tp::Account::FeatureProfile);

    Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(
                                                QDBusConnection::sessionBus(),
                                                Tp::Features() << Tp::Connection::FeatureCore
                                                    << Tp::Connection::FeatureSelfContact
                                                    << Tp::Connection::FeatureRoster);

    Tp::ContactFactoryPtr contactFactory = KTp::ContactFactory::create(
                                                Tp::Features()  << Tp::Contact::FeatureAlias
                                                    << Tp::Contact::FeatureAvatarData
                                                    << Tp::Contact::FeatureSimplePresence
                                                    << Tp::Contact::FeatureCapabilities);

    Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());

    LogViewer *logViewer = new LogViewer(accountFactory, connectionFactory, channelFactory, contactFactory);
    logViewer->show();

    return app.exec();
}
示例#2
0
void showLogViewer(void)
{
    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    QString logDir = getTempDirectory() + "logs";
    QString progressLog;
    QString fullLog;

    // wait for a log file to be available
    int tries = 10;
    while (tries--)
    {
        if (QFile::exists(logDir + "/progress.log"))
            progressLog = logDir + "/progress.log";

        if (QFile::exists(logDir + "/mythburn.log"))
            fullLog = logDir + "/mythburn.log";

        // we wait for both the progress.log and mythburn.log
        if ((!progressLog.isEmpty()) && (!fullLog.isEmpty()))
            break;

        // or we wait for a log from mytharchivehelper
        if (progressLog.isEmpty() && fullLog.isEmpty())
        {
            QStringList logFiles;
            QStringList filters;
            filters << "*.log";

            QDir d(logDir);
            logFiles = d.entryList(filters, QDir::Files | QDir::Readable, QDir::Time);

            if (logFiles.count())
            {
                // the first log file should be the newest one available
                progressLog = logDir + '/' + logFiles[0];
                break;
            }
        }

        sleep(1);
    }

    // do any logs exist?
    if ((!progressLog.isEmpty()) || (!fullLog.isEmpty()))
    {
        LogViewer *viewer = new LogViewer(mainStack);
        viewer->setFilenames(progressLog, fullLog);
        if (viewer->Create())
            mainStack->AddScreen(viewer);
    }
    else
        showWarningDialog(QCoreApplication::translate("LogViewer",
            "Cannot find any logs to show!"));
}
示例#3
0
int main(int argc, char *argv[])
{
	QApplication app(argc, argv);
	
	if (argc != 2)
	{
		usage(argv[0]);
	}
	
	LogViewer win;
	
	win.readFrames(argv[1]);
	win.showMaximized();
	
	return app.exec();
}
示例#4
0
void showLogViewer(void)
{
    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    QString logDir = getTempDirectory() + "logs";

    // do any logs exist?
    if (QFile::exists(logDir + "/progress.log") || QFile::exists(logDir + "/mythburn.log"))
    {
        LogViewer *viewer = new LogViewer(mainStack);
        viewer->setFilenames(logDir + "/progress.log", logDir + "/mythburn.log");
        if (viewer->Create())
            mainStack->AddScreen(viewer);
    }
    else
        showWarningDialog(QObject::tr("Cannot find any logs to show!"));
}
示例#5
0
文件: main.cpp 项目: berndhs/qxmpp
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
  
    // Set up logging 
    QXmppLogger *logger = QXmppLogger::getLogger();
    logger->setLoggingType(QXmppLogger::SignalLogging);

    LogViewer viewer;
    QObject::connect(logger, SIGNAL(message(QXmppLogger::MessageType,QString)),
            &viewer, SLOT(log(QXmppLogger::MessageType,QString)));
    viewer.show();

    // Connect to server
    QXmppClient client;
    // client.connectToServer("*****@*****.**", "passwd");
    client.connectToServer("*****@*****.**", "qxmpp123");

    return a.exec();
}
示例#6
0
/*!
 * This function is called when someone clicks "View Logs". It creates and
 * shows a new LogViewer with the log files of all the jobs that have valid
 * logs.
 */
void GamessQFrame::OnViewlogsClick( wxCommandEvent& event )
{
	wxArrayString filenames;
	int index = jobListCtrl->GetNextItem(-1, wxLIST_NEXT_ALL,
			wxLIST_STATE_SELECTED);
	if (index == -1) {
		return;
	}
	while (index != -1) {
		Job *job = mJobList.Item(index)->GetData();
		if (CanViewLogs(job)) {
			wxFileName name = (mQueueManager.GetFileName(job->GetId()));
			name.SetExt(wxT("log"));
			filenames.Add(name.GetFullPath());
		}
		index = jobListCtrl->GetNextItem(index, wxLIST_NEXT_ALL,
				wxLIST_STATE_SELECTED);
	}
	LogViewer *viewer = new LogViewer(this, filenames);
	viewer->Show();
}
示例#7
0
void MainWindow::SetCurrentLogViewer(LogViewer &logViewer)
{
	HWND hOldPane = m_splitter.GetSplitterPane(SPLIT_PANE_RIGHT);
	if (hOldPane != logViewer)
	{
		CWindow oldViewer;
		oldViewer.Attach(hOldPane);
		oldViewer.ShowWindow(SW_HIDE);
		logViewer.ShowWindow(SW_SHOW);
		m_splitter.SetSplitterPane(SPLIT_PANE_RIGHT, logViewer);
	}
}
示例#8
0
void MetaWindow::displayLogView(){
  LogViewer *viewer = new LogViewer();
  viewer->show();
}
示例#9
0
void MainWindow::InitLogViewer(LogViewer &logViewer)
{
	logViewer.Create(m_splitter, rcDefault);
	logViewer.SetFont(m_logViewerFont);
}