void LogViewerDialog::initLogList() { addLogItem(guiDebugLogPath(), "Debug", "dialog-information"); addLogItem(guiWarningLogPath(), "Warning", "dialog-warning"); addLogItem(guiCriticalLogPath(), "Critical", "dialog-error"); addLogItem(guiFatalLogPath(), "Fatal", "dialog-fatal"); connect(ui_->logList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), SLOT(handleLogShow(QListWidgetItem*))); ui_->logList->setFixedWidth(100); }
void ViewLoading::onServerInfoReceived(unsigned char verMajor, unsigned char verMinor) { QString item(" v%1.%2\n"); item = item.arg(verMajor).arg(verMinor); addLogItem(item); }
void ViewLoading::onAppStateChanged(FCApp::StateInfo state, FCApp::StateInfo oldState) { if ( state.state != oldState.state ) { switch ( state.state ) { case AppStateLoading: break; case AppStateConnecting: addLogItem( ResourceManager::instance().getClientString( STR_LOAD_SEPERATOR ) ); break; case AppStateLogin: { openLoginDialog(); } break; default: break; } } else { handleSubStateChange(state); } }
void ViewLoading::openLoginDialog() { // Allow the user to attempt to login. Cancelling the login will quit the client DlgLogin* pLogin = new DlgLogin(this); int nResult = pLogin->exec(); if ( nResult == QDialog::Accepted) { addLogItem( ResourceManager::instance().getClientString( STR_LOGIN_ATTEMPTING ) ); emit attemptLogin( pLogin->getUsername(), pLogin->getPassword() ); } else { // we need to shutdown FCAPP->quit(); } }
Viewer::Viewer(QWidget *parent) : QWidget(parent), ui(new Ui::Viewer) { Q_INIT_RESOURCE(Viewer); ui->setupUi(this); wv = new QWebView(); ui->mainlayout->addWidget(wv); wv->load(QUrl("qrc:/Viewer.html")); // Logging: connect(this, SIGNAL(addLogItem(QString)), SLOT(insertLogItem(QString))); // Add pointer to me wv->page()->mainFrame()->addToJavaScriptWindowObject("Viewer", this); // Demo: connect(ui->testGraph, SIGNAL(clicked()), SLOT(doTestGraph())); }
void MessageHandler::logMessage(SyncOutMessage * msg) { Folder * folder; QString rel_path; QStringList msg_labels; for (int i = 0; i < msg->folderCount(); ++i) { folder = folders->byId(msg->folderIdAt(i)); if (!folder) continue; msg_labels << folder->label(); if (!i) rel_path = msg->stringAt(i).mid(folder->path().size()); //msg->labelFolder(i, folder->path().size(), folder->label()); } addLogItem(msg, rel_path, msg_labels); delete msg; }
void ViewLoading::handleSubStateChange(FCApp::StateInfo state) { switch ( state.state ) { case AppStateLoading: { switch ( state.stateStep ) { case AppState_Loading_Text: addLogItem(ResourceManager::instance().getClientString( STR_LOAD_START )); addLogItem( ResourceManager::instance().getClientString( STR_LOAD_TEXT ) ); break; case AppState_Loading_Graphics: addLogItem( ResourceManager::instance().getClientString( STR_LOAD_GFX ) ); break; case AppState_Loading_Sounds: addLogItem( ResourceManager::instance().getClientString( STR_LOAD_AUDIO ) ); break; default: break; } } break; case AppStateConnecting: { switch ( state.stateStep ) { case AppState_Connecting_Connecting: addLogItem( ResourceManager::instance().getClientString( STR_CONNECT_SERVER ) ); break; case AppState_Connecting_Retry: addLogItem( ResourceManager::instance().getClientString( STR_CONNECT_FAIL_RETRY ) ); break; case AppState_Connecting_Connected: addLogItem( ResourceManager::instance().getClientString( STR_CONNECT_OK ) ); break; case AppState_Connecting_FetchingInfo: addLogItem( ResourceManager::instance().getClientString( STR_CONNECT_FETCHING_SERVER_INFO ) ); break; case AppState_Connecting_FinalFail: addLogItem( ResourceManager::instance().getClientString( STR_CONNECT_FINAL_FAIL ) ); break; } } break; case AppStateLogin: { switch ( state.stateStep ) { case AppState_Login_LoginFailed: addLogItem( ResourceManager::instance().getClientString( STR_LOGIN_FAILED ) ); openLoginDialog(); break; case AppState_Login_LoginFailed_AccountInUse: addLogItem( ResourceManager::instance().getClientString( STR_LOGIN_FAILED_ACCOUNT_IN_USE ) ); break; case AppState_Login_LoginSucceeded: addLogItem( ResourceManager::instance().getClientString( STR_LOGIN_SUCCESSFUL ) ); break; } } break; default: break; } }