void RheiaTextLogger::Log( const wxString& msg, RheiaLogging::RheiaLogLevel level ) { if(m_window == NULL) return; wxRichTextCtrl* control = m_window->GetTextCtrl(); wxFont default_font(10, wxFONTFAMILY_SWISS , wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); control->BeginStyle(m_textattr[level]); /*control->SetFont( m_textattr[level].GetFont() ); control->BeginSuppressUndo(); control->BeginFontSize(m_textattr[level].GetFont().GetPointSize()); control->BeginParagraphSpacing(0,20); control->BeginAlignment( m_textattr[level].GetAlignment() ); control->BeginTextColour( m_textattr[level].GetTextColour() );*/ control->WriteText(msg); control->Newline(); /*control->EndTextColour(); control->EndAlignment(); control->EndParagraphSpacing(); control->EndFontSize(); control->EndSuppressUndo();*/ //control->SetFont(default_font); control->EndStyle(); control->EndAllStyles(); }
void ListCtrlLogger::UpdateSettings() { if (!control) return; ConfigManager* cfgman = Manager::Get()->GetConfigManager(_T("message_manager")); int size = cfgman->ReadInt(_T("/log_font_size"), platform::macosx ? 10 : 8); wxFont default_font(size, fixed ? wxFONTFAMILY_MODERN : wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); wxFont bold_font(default_font); wxFont italic_font(default_font); bold_font.SetWeight(wxFONTWEIGHT_BOLD); wxFont bigger_font(bold_font); bigger_font.SetPointSize(size + 2); wxFont small_font(default_font); small_font.SetPointSize(size - 4); italic_font.SetStyle(wxFONTSTYLE_ITALIC); wxColour default_text_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); for(unsigned int i = 0; i < num_levels; ++i) { style[i].font = default_font; style[i].colour = default_text_colour; } ColourManager *colours = Manager::Get()->GetColourManager(); style[caption].font = bigger_font; style[success].colour = colours->GetColour(wxT("logs_success_text")); style[failure].colour = colours->GetColour(wxT("logs_failure_text")); style[warning].font = italic_font; style[warning].colour = colours->GetColour(wxT("logs_warning_text")); style[error].colour = colours->GetColour(wxT("logs_error_text")); style[critical].font = bold_font; style[critical].colour = colours->GetColour(wxT("logs_critical_text_listctrl")); style[spacer].font = small_font; style[pagetitle] = style[caption]; // Tell control and items about the font change control->SetFont(default_font); for (int i = 0; i < control->GetItemCount(); ++i) { wxFont font = control->GetItemFont(i); font.SetPointSize(size); control->SetItemFont( i, font ); }//for } // end of UpdateSettings
// Initializes the STC or TextCtrl void editor_dialog::stc_or_textctrl_init() { // Make a default font for the STC or TextCtrl. Set the default point size up in // plucker_defines.h, as it varies too much with the OS. wxFont default_font( plkrDEFAULT_TEXTCTRL_FONT_POINTSIZE, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL //! \todo Remove the force to Courier after there is a font selector. #ifdef __WXGTK__ , FALSE, wxT( "Courier") #endif ); m_editor_textctrl->SetFont( default_font ); }
ThreadSearchLoggerList::ThreadSearchLoggerList(ThreadSearchView& threadSearchView, ThreadSearch& threadSearchPlugin, InsertIndexManager::eFileSorting fileSorting, wxPanel* pParent, long id) : ThreadSearchLoggerBase(threadSearchView, threadSearchPlugin, fileSorting), m_IndexOffset(0), m_SortColumn(-1), m_Ascending(true) { m_pListLog = new wxListCtrl(pParent, id, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER); m_pListLog->SetMinSize(wxSize(100,100)); int size = Manager::Get()->GetConfigManager(_T("message_manager"))->ReadInt(_T("/log_font_size"), platform::macosx ? 10 : 8); wxFont default_font(size, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); m_pListLog->SetFont(default_font); SetListColumns(); // Events are managed dynamically to be able to stop/start management when required. ConnectEvents(pParent); }
void RheiaTextLogger::UpdateSettings() { RheiaConfigurationManager* cfg = RheiaManager::Get()->GetConfigurationManager( wxT("RheiaTextLogger") ); bool isFirstTime = true; isFirstTime = (bool) cfg->ReadInt( wxT("/first_time") , (int) true ); if( isFirstTime ) { int size = 10; wxFont default_font(size, wxFONTFAMILY_SWISS , wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); wxFont bold_font(size, wxFONTFAMILY_SWISS , wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD); wxFont italic_font(size, wxFONTFAMILY_SWISS , wxFONTSTYLE_ITALIC, wxFONTWEIGHT_NORMAL); bold_font.SetWeight(wxFONTWEIGHT_BOLD); wxFont bigger_font(bold_font); bigger_font.SetPointSize(size + 1); wxFont small_font(default_font); small_font.SetPointSize(size - 4); for(unsigned int i = 0; i < (unsigned int) RheiaLogging::RheiaLogLevelNumber ; ++i) { m_textattr[i].SetFlags( wxTEXT_ATTR_FONT | wxTEXT_ATTR_ALIGNMENT ); m_textattr[i].SetFont(default_font); m_textattr[i].SetAlignment(wxTEXT_ALIGNMENT_LEFT); m_textattr[i].SetTextColour(*wxBLACK); m_textattr[i].SetBackgroundColour(*wxWHITE); } m_textattr[RheiaLogging::warning].SetFont(italic_font); m_textattr[RheiaLogging::warning].SetTextColour(*wxBLUE); m_textattr[RheiaLogging::success].SetAlignment(wxTEXT_ALIGNMENT_CENTRE); bigger_font.SetUnderlined(true); m_textattr[RheiaLogging::success].SetFont(bigger_font); m_textattr[RheiaLogging::success].SetTextColour(*wxBLUE); m_textattr[RheiaLogging::error].SetFont(bold_font); m_textattr[RheiaLogging::error].SetTextColour(*wxRED); m_textattr[RheiaLogging::fatalerror].SetFont(bold_font); m_textattr[RheiaLogging::fatalerror].SetTextColour(*wxWHITE); m_textattr[RheiaLogging::fatalerror].SetBackgroundColour(*wxRED); m_textattr[RheiaLogging::syserror].SetFont(bold_font); m_textattr[RheiaLogging::syserror].SetTextColour(*wxWHITE); m_textattr[RheiaLogging::syserror].SetBackgroundColour(*wxBLUE); m_textattr[RheiaLogging::info].SetFont(italic_font); m_textattr[RheiaLogging::status].SetFont(bold_font); m_textattr[RheiaLogging::status].SetTextColour(*wxGREEN); m_textattr[RheiaLogging::debug].SetFont(italic_font); m_textattr[RheiaLogging::debug].SetTextColour(*wxGREEN); m_textattr[RheiaLogging::trace].SetFont(italic_font); m_textattr[RheiaLogging::trace].SetTextColour(*wxGREEN); if( cfg != NULL ) { cfg->Write( wxT("/message") , m_textattr[RheiaLogging::message] ); cfg->Write( wxT("/warning") , m_textattr[RheiaLogging::warning] ); cfg->Write( wxT("/success") , m_textattr[RheiaLogging::success] ); cfg->Write( wxT("/error") , m_textattr[RheiaLogging::error] ); cfg->Write( wxT("/fatalerror") , m_textattr[RheiaLogging::fatalerror] ); cfg->Write( wxT("/info") , m_textattr[RheiaLogging::info] ); cfg->Write( wxT("/status") , m_textattr[RheiaLogging::status] ); cfg->Write( wxT("/syserror") , m_textattr[RheiaLogging::syserror] ); cfg->Write( wxT("/debug") , m_textattr[RheiaLogging::debug] ); cfg->Write( wxT("/trace") , m_textattr[RheiaLogging::trace] ); cfg->Write( wxT("/first_time") , (int) false ); } return; } m_textattr[RheiaLogging::message] = cfg->ReadTextAttr( wxT("/message") ); m_textattr[RheiaLogging::warning] = cfg->ReadTextAttr( wxT("/warning") ); m_textattr[RheiaLogging::success] = cfg->ReadTextAttr( wxT("/success") ); m_textattr[RheiaLogging::error] = cfg->ReadTextAttr( wxT("/error") ); m_textattr[RheiaLogging::fatalerror] = cfg->ReadTextAttr( wxT("/fatalerror") ); m_textattr[RheiaLogging::info] = cfg->ReadTextAttr( wxT("/info") ); m_textattr[RheiaLogging::status] = cfg->ReadTextAttr( wxT("/status") ); m_textattr[RheiaLogging::syserror] = cfg->ReadTextAttr( wxT("/syserror") ); m_textattr[RheiaLogging::debug] = cfg->ReadTextAttr( wxT("/debug") ); m_textattr[RheiaLogging::trace] = cfg->ReadTextAttr( wxT("/trace") ); }
void SettingsManager::ReloadFromPath(const std::string& path, bool merge) { if (path.empty()) { return; } if (!merge) { clusters_.clear(); connections_.clear(); recent_connections_.clear(); } QString inip; common::ConvertFromString(common::file_system::prepare_path(path), &inip); QSettings settings(inip, QSettings::IniFormat); DCHECK(settings.status() == QSettings::NoError); cur_style_ = settings.value(STYLE, common::qt::gui::defStyle).toString(); send_statistic_ = settings.value(SEND_STATISTIC, true).toBool(); accepted_eula_ = settings.value(ACCEPTED_EULA, false).toBool(); QFont font = default_font(); cur_font_ = settings.value(FONT, font).value<QFont>(); cur_language_ = settings.value(LANGUAGE, common::qt::translations::defLanguage).toString(); int view = settings.value(VIEW, kText).toInt(); views_ = static_cast<supportedViews>(view); QList<QVariant> clusters = settings.value(CLUSTERS).toList(); for (const auto& cluster : clusters) { QString string = cluster.toString(); std::string encoded = common::ConvertToString(string); std::string raw = common::utils::base64::decode64(encoded); IClusterSettingsBaseSPtr sett(ClusterConnectionSettingsFactory::GetInstance().CreateFromString(raw)); if (sett) { clusters_.push_back(sett); } } QList<QVariant> sentinels = settings.value(SENTINELS).toList(); for (const auto& sentinel : sentinels) { QString string = sentinel.toString(); std::string encoded = common::ConvertToString(string); std::string raw = common::utils::base64::decode64(encoded); ISentinelSettingsBaseSPtr sett(SentinelConnectionSettingsFactory::GetInstance().CreateFromString(raw)); if (sett) { sentinels_.push_back(sett); } } QList<QVariant> connections = settings.value(CONNECTIONS).toList(); for (const auto& connection : connections) { QString string = connection.toString(); std::string encoded = common::ConvertToString(string); std::string raw = common::utils::base64::decode64(encoded); IConnectionSettingsBaseSPtr sett(ConnectionSettingsFactory::GetInstance().CreateFromString(raw)); if (sett) { connections_.push_back(sett); } } QStringList rconnections = settings.value(RCONNECTIONS).toStringList(); for (const auto& rconnection : rconnections) { std::string encoded = common::ConvertToString(rconnection); std::string raw = common::utils::base64::decode64(encoded); QString qdata; if (common::ConvertFromString(raw, &qdata) && !qdata.isEmpty()) { recent_connections_.push_back(qdata); } } std::string dir_path = GetSettingsDirPath(); QString qdir; common::ConvertFromString(dir_path, &qdir); logging_dir_ = settings.value(LOGGINGDIR, qdir).toString(); auto_check_updates_ = settings.value(CHECKUPDATES, true).toBool(); auto_completion_ = settings.value(AUTOCOMPLETION, true).toBool(); auto_open_console_ = settings.value(AUTOOPENCONSOLE, true).toBool(); auto_connect_db_ = settings.value(AUTOCONNECTDB, true).toBool(); fast_view_keys_ = settings.value(FASTVIEWKEYS, true).toBool(); window_settings_ = settings.value(WINDOW_SETTINGS, QByteArray()).toByteArray(); QString qpython_path; std::string python_path; if (common::file_system::find_file_in_path(PYTHON_FILE_NAME, &python_path) && common::ConvertFromString(python_path, &qpython_path)) { } python_path_ = settings.value(PYTHON_PATH, qpython_path).toString(); config_version_ = settings.value(CONFIG_VERSION, PROJECT_VERSION_NUMBER).toUInt(); }
MainWidget::MainWidget(QWidget *parent,const char *name) :QWidget(parent,name) { login_user_width=160; QString str; QString sql; RDSqlQuery *q; // // HACK: Disable the Broken Custom SuSE Dialogs // setenv("QT_NO_KDE_INTEGRATION","1",1); // // Read Command Options // RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdlogin","\n"); delete cmd; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Generate Fonts // QFont default_font("Helvetica",12,QFont::Normal); default_font.setPixelSize(12); qApp->setFont(default_font); QFont button_font=QFont("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); QFont label_font=QFont("Helvetica",16,QFont::Bold); label_font.setPixelSize(12); QFont small_label_font=QFont("Helvetica",12,QFont::Bold); small_label_font.setPixelSize(12); QFont line_edit_font=QFont("Helvetica",12,QFont::Normal); line_edit_font.setPixelSize(12); // // Create And Set Icon // login_rivendell_map=new QPixmap(rivendell_xpm); setIcon(*login_rivendell_map); // // Text Validator // RDTextValidator *validator=new RDTextValidator(this,"validator"); // // Ensure that the system daemons are running // RDInitializeDaemons(); // // Load Configs // login_config=new RDConfig(); login_config->load(); str=QString(tr("RDLogin - Station:")); setCaption(QString().sprintf("%s %s",(const char *)str, (const char *)login_config->stationName())); // // Open Database // QString err(tr("rdlogin : "******"Can't Connect"),err); exit(0); } // // RIPC Connection // login_ripc=new RDRipc(login_config->stationName()); connect(login_ripc,SIGNAL(connected(bool)),this,SLOT(connectedData(bool))); connect(login_ripc,SIGNAL(userChanged()),this,SLOT(userData())); login_ripc->connectHost("localhost",RIPCD_TCP_PORT, login_config->password()); // // Station // login_station=new RDStation(login_config->stationName()); // // User Label // login_label=new QLabel(this,"login_label"); login_label->setFont(label_font); login_label->setAlignment(AlignCenter); login_label->setText(tr("Current User: unknown")); // // User Name // login_username_box=new QComboBox(this,"login_username_box"); login_username_box->setFont(line_edit_font); login_username_box->setFocus(); QFontMetrics fm(line_edit_font); sql="select LOGIN_NAME from USERS where ADMIN_CONFIG_PRIV=\"N\"\ order by LOGIN_NAME"; q=new RDSqlQuery(sql); while(q->next()) { login_username_box->insertItem(q->value(0).toString()); if(fm.width(q->value(0).toString())>login_user_width) { login_user_width=fm.width(q->value(0).toString()); } } delete q; if(login_user_width>900) { login_user_width=900; } login_username_label=new QLabel(login_username_box,tr("&Username:"******"login_username_label"); login_username_label->setFont(small_label_font); login_username_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix); // // Password // login_password_edit=new QLineEdit(this,"login_password_edit"); login_password_edit->setFont(line_edit_font); login_password_edit->setMaxLength(16); login_password_edit->setValidator(validator); login_password_edit->setEchoMode(QLineEdit::Password); login_password_label=new QLabel(login_password_edit,tr("&Password:"******"login_password_label"); login_password_label->setFont(small_label_font); login_password_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix); connect(login_password_edit,SIGNAL(returnPressed()),this,SLOT(loginData())); // // Login Button // login_button=new QPushButton(this,"login_button"); login_button->setFont(button_font); login_button->setText(tr("&Set User")); connect(login_button,SIGNAL(clicked()),this,SLOT(loginData())); // // Logout Button // logout_button=new QPushButton(this,"logout_button"); logout_button->setFont(button_font); logout_button->setText(tr("&Default\nUser")); connect(logout_button,SIGNAL(clicked()),this,SLOT(logoutData())); // // Cancel Button // cancel_button=new QPushButton(this,"cancel_button"); cancel_button->setFont(button_font); cancel_button->setText(tr("&Cancel")); connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); resizeEvent(NULL); }
void TextCtrlLogger::UpdateSettings() { if (!control) return; control->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); ConfigManager* cfgman = Manager::Get()->GetConfigManager(_T("message_manager")); int size = cfgman->ReadInt(_T("/log_font_size"), platform::macosx ? 10 : 8); wxFont default_font(size, fixed ? wxFONTFAMILY_MODERN : wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); wxFont bold_font(default_font); wxFont italic_font(default_font); bold_font.SetWeight(wxFONTWEIGHT_BOLD); wxFont bigger_font(bold_font); bigger_font.SetPointSize(size + 2); wxFont small_font(default_font); small_font.SetPointSize(size - 4); italic_font.SetStyle(wxFONTSTYLE_ITALIC); // might try alternatively //italic_font.SetStyle(wxFONTSTYLE_SLANT); wxColour default_text_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); for(unsigned int i = 0; i < num_levels; ++i) { style[i].SetFont(default_font); style[i].SetAlignment(wxTEXT_ALIGNMENT_DEFAULT); style[i].SetTextColour(default_text_colour); style[i].SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); // is it necessary to do that? //style[i].SetFlags(...); } style[caption].SetAlignment(wxTEXT_ALIGNMENT_CENTRE); bigger_font.SetUnderlined(true); style[caption].SetFont(bigger_font); ColourManager *colours = Manager::Get()->GetColourManager(); style[success].SetTextColour(colours->GetColour(wxT("logs_success_text"))); style[warning].SetFont(italic_font); style[warning].SetTextColour(colours->GetColour(wxT("logs_warning_text"))); style[error].SetFont(bold_font); style[error].SetTextColour(colours->GetColour(wxT("logs_error_text"))); style[critical].SetFont(bold_font); style[critical].SetTextColour(colours->GetColour(wxT("logs_critical_text"))); // we're setting both fore and background colors here style[critical].SetBackgroundColour(colours->GetColour(wxT("logs_critical_back"))); // so we don't have to mix in default colors style[spacer].SetFont(small_font); // Tell control about the font change control->SetFont(default_font); } // end of UpdateSettings
void TexView::IParseLine(int sol,int eol) { int size = eol-sol+1; vector<rgb_color> colorVec(size,prefs->fg_color); for(int k=0;k<size;k++) { colorVec[k] = prefs->fg_color; } int i; int offset = sol; int pos; int text_length = TextLength(); //Setup some defaults.... ITwoColorPlateau('\'',sol,eol,prefs->comma_color,colorVec); ITwoColorPlateau('`',sol,eol,prefs->comma_color,colorVec); ITwoColorPlateau('\\',sol,eol,prefs->punc_symbol_color,colorVec); for(i=sol;i<eol;i++) { if(ByteAt(i) == '[' || ByteAt(i) == ']') { if(i-1 >= 0 && ByteAt(i-1) == '\\') { colorVec[i-1-sol] = prefs->punc_symbol_color; } colorVec[i-sol] = prefs->punc_symbol_color; } else if(ByteAt(i) == '&' || ByteAt(i) == '{' || ByteAt(i) == '}')// { if(i-1 >= 0 && ByteAt(i-1) == '\\') { colorVec[i-1-sol] = prefs->punc_symbol_color; } colorVec[i-sol] = prefs->punc_symbol_color; } else if(ByteAt(i) == '$') { if(i-1 >= 0 && ByteAt(i-1) == '\\') { colorVec[i-1-sol] = prefs->fg_color; colorVec[i-sol] = prefs->fg_color; } } else if(ByteAt(i) == '\\' && i+1 < eol) { if(ByteAt(i+1) == '#') { colorVec[i-sol] = prefs->punc_symbol_color; colorVec[i+1-sol] = prefs->punc_symbol_color; }else if(ByteAt(i+1) == '\'' || ByteAt(i+1) == '`') { colorVec[i-sol] = prefs->fg_color; colorVec[i+1-sol] = prefs->fg_color; } } } offset = sol; while((pos = FindFirstOnLine('%',offset,eol))>= 0 && offset < eol) { if(pos - 1 >= 0 && ByteAt(pos-1) == '\\') { colorVec[pos-1-sol] = prefs->punc_symbol_color; colorVec[pos-sol] = prefs->punc_symbol_color; } else { for(i=pos;i<eol;i++) colorVec[i-sol] = prefs->comment_color; break; } offset= pos+1; } //START COLOURING*********************************** BFont default_font(be_fixed_font); default_font.SetSize(prefs->FontSize); int plLength=0; int plStart=0; for(i=sol;i<eol;i++) { if(i == sol) { plLength = 1; plStart = i; } else if(colorVec[i-sol] != colorVec[i-sol-1]) { //if(colorVec[i-sol-1] != old_colors[i-sol]) SetFontAndColor(plStart,plStart+plLength,&default_font,B_FONT_ALL,&colorVec[i-sol-1]); plLength = 1; plStart = i; } else { plLength++; } } if(plLength > 0) SetFontAndColor(plStart,plStart+plLength,&default_font,B_FONT_ALL,&colorVec[i-sol-1]); }
MainWidget::MainWidget(QWidget *parent,const char *name) :QWidget(parent,name) { // // HACK: Disable the Broken Custom SuSE Dialogs // #ifndef WIN32 setenv("QT_NO_KDE_INTEGRATION","1",1); #endif // WIN32 // // Read Command Options // bool cmd_generate = false; bool cmd_merge_music = false; bool cmd_merge_traffic = false; QString cmd_service = NULL; QDate cmd_date = QDate::currentDate().addDays(1); RDCmdSwitch *cmd= new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdlogmanager","\n"); for(unsigned i=0;i<cmd->keys();i++) { if (cmd->key(i)=="-g") cmd_generate = true; if (cmd->key(i)=="-m") cmd_merge_music = true; if (cmd->key(i)=="-t") cmd_merge_traffic = true; if (cmd->key(i)=="-s") if (i+1<cmd->keys()) { i++; cmd_service = cmd->key(i); } if (cmd->key(i)=="-d") if (i+1<cmd->keys()) { i++; cmd_date = QDate::currentDate().addDays(cmd->key(i).toInt()); } } delete cmd; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Ensure that the system daemons are running // #ifndef WIN32 RDInitializeDaemons(); #endif // WIN32 // // Load Local Configs // log_config=new RDConfig(); log_config->load(); setCaption(tr("RDLogManager")); // // Open Database // QString err; log_db=RDInitDb(&err); if(!log_db) { QMessageBox::warning(this,tr("Can't Connect"),err); exit(0); } new RDDbHeartbeat(log_config->mysqlHeartbeatInterval(),this); // // Allocate Global Resources // rdstation_conf=new RDStation(log_config->stationName()); // // CAE Connection // #ifndef WIN32 rdcae=new RDCae(parent,name); rdcae->connectHost("localhost",CAED_TCP_PORT,log_config->password()); #endif // WIN32 // // RIPC Connection // rdripc=new RDRipc(log_config->stationName()); connect(rdripc,SIGNAL(userChanged()),this,SLOT(userData())); rdripc->connectHost("localhost",RIPCD_TCP_PORT,log_config->password()); // // User // rduser=NULL; // // Generate Fonts // QFont default_font("Helvetica",12,QFont::Normal); default_font.setPixelSize(12); qApp->setFont(default_font); QFont button_font=QFont("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); QFont label_font=QFont("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); QFont day_font=QFont("Helvetica",12,QFont::Normal); day_font.setPixelSize(12); // // Create And Set Icon // log_rivendell_map=new QPixmap(rivendell_xpm); setIcon(*log_rivendell_map); // // Filters // event_filter=new QString(); clock_filter=new QString(); // // Title Label // QLabel *label=new QLabel(tr("RDLogManager"),this,"title_label"); label->setGeometry(0,5,sizeHint().width(),32); label->setFont(label_font); label->setAlignment(AlignHCenter); label=new QLabel(tr("Select an operation:"),this,"instruction_label"); label->setGeometry(0,25,sizeHint().width(),16); label->setFont(day_font); label->setAlignment(AlignCenter); // // Edit Events Button // log_events_button=new QPushButton(this,"events_button"); log_events_button->setGeometry(10,45,sizeHint().width()-20,50); log_events_button->setFont(button_font); log_events_button->setText(tr("Edit &Events")); connect(log_events_button,SIGNAL(clicked()),this,SLOT(eventsData())); // // Edit Clocks Button // log_clocks_button=new QPushButton(this,"clocks_button"); log_clocks_button->setGeometry(10,95,sizeHint().width()-20,50); log_clocks_button->setFont(button_font); log_clocks_button->setText(tr("Edit C&locks")); connect(log_clocks_button,SIGNAL(clicked()),this,SLOT(clocksData())); // // Edit Grids Button // log_grids_button=new QPushButton(this,"grid_button"); log_grids_button->setGeometry(10,145,sizeHint().width()-20,50); log_grids_button->setFont(button_font); log_grids_button->setText(tr("Edit G&rids")); connect(log_grids_button,SIGNAL(clicked()),this,SLOT(gridsData())); // // Generate Logs Button // log_logs_button=new QPushButton(this,"logs_button"); log_logs_button->setGeometry(10,195,sizeHint().width()-20,50); log_logs_button->setFont(button_font); log_logs_button->setText(tr("&Generate Logs")); connect(log_logs_button,SIGNAL(clicked()),this,SLOT(generateData())); // // Generate Reports Button // log_reports_button=new QPushButton(this,"reports_button"); log_reports_button->setGeometry(10,245,sizeHint().width()-20,50); log_reports_button->setFont(button_font); log_reports_button->setText(tr("Manage &Reports")); connect(log_reports_button,SIGNAL(clicked()),this,SLOT(reportsData())); // // Close Button // log_close_button=new QPushButton(this,"close_button"); log_close_button->setGeometry(10,sizeHint().height()-60, sizeHint().width()-20,50); log_close_button->setFont(button_font); log_close_button->setText(tr("&Close")); log_close_button->setDefault(true); connect(log_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget())); if (cmd_generate) { GenerateLog *generatelog=new GenerateLog(this,"list_grids",1,&cmd_service,&cmd_date); delete generatelog; } if (cmd_merge_music) { GenerateLog *generatelog=new GenerateLog(this,"list_grids",2,&cmd_service,&cmd_date); delete generatelog; } if (cmd_merge_traffic) { GenerateLog *generatelog=new GenerateLog(this,"list_grids",3,&cmd_service,&cmd_date); delete generatelog; } if (cmd_generate || cmd_merge_music ||cmd_merge_traffic ) quitMainWidget(); #ifndef WIN32 signal(SIGCHLD,SigHandler); #endif // WIN32 }
MainWidget::MainWidget(QWidget *parent) :QMainWindow(parent) { QString str1; QString str2; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); // // Load Local Configs // str1=QString("RDCastManager")+" v"+VERSION+" - "+tr("Host"); str2=QString(tr("User: [Unknown]")); setCaption(QString().sprintf("%s: %s, %s",(const char *)str1, (const char *)rda->config()->stationName(), (const char *)str2)); // // RIPC Connection // #ifndef WIN32 connect(rda->ripc(),SIGNAL(userChanged()),this,SLOT(userChangedData())); rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password()); #endif // WIN32 // // User // rda->setUser(RD_USER_LOGIN_NAME); // // Create Fonts // QFont default_font("Helvetica",12,QFont::Normal); default_font.setPixelSize(12); qApp->setFont(default_font); QFont button_font=QFont("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); // // Create Icons // cast_rivendell_map=new QPixmap(rivendell_xpm); setIcon(*cast_rivendell_map); cast_greencheckmark_map=new QPixmap(greencheckmark_xpm); cast_redx_map=new QPixmap(redx_xpm); // // Feed List // cast_feed_list=new RDListView(this); cast_feed_list->setFont(default_font); cast_feed_list->setAllColumnsShowFocus(true); cast_feed_list->setItemMargin(5); connect(cast_feed_list, SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)), this, SLOT(feedDoubleclickedData(QListViewItem *,const QPoint &,int))); cast_feed_list->addColumn(""); cast_feed_list->setColumnAlignment(0,Qt::AlignCenter); cast_feed_list->addColumn(tr("Key Name")); cast_feed_list->setColumnAlignment(1,Qt::AlignHCenter); cast_feed_list->addColumn(tr("Feed Name")); cast_feed_list->setColumnAlignment(2,Qt::AlignLeft); cast_feed_list->addColumn(tr("Description")); cast_feed_list->setColumnAlignment(3,Qt::AlignLeft); cast_feed_list->addColumn(tr("Casts")); cast_feed_list->setColumnAlignment(3,Qt::AlignCenter); // // Open Button // cast_open_button=new QPushButton(this); cast_open_button->setFont(button_font); cast_open_button->setText(tr("&View\nFeed")); connect(cast_open_button,SIGNAL(clicked()),this,SLOT(openData())); // // Close Button // cast_close_button=new QPushButton(this); cast_close_button->setFont(button_font); cast_close_button->setText(tr("&Close")); connect(cast_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget())); }
MainWidget::MainWidget(QWidget *parent,const char *name) :QWidget(parent,name) { // // Read Command Options // RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdselect","\n"); delete cmd; // // Read Configuration // monitor_config=new RDMonitorConfig(); monitor_config->load(); QDesktopWidget *dw=qApp->desktop(); int width=sizeHint().width(); int height=sizeHint().height(); switch(monitor_config->position()) { case RDMonitorConfig::UpperLeft: setGeometry(0,RDMONITOR_HEIGHT,width,sizeHint().height()); break; case RDMonitorConfig::UpperCenter: setGeometry((dw->size().width()-width)/2,RDMONITOR_HEIGHT,width,height); break; case RDMonitorConfig::UpperRight: setGeometry(dw->size().width()-width,RDMONITOR_HEIGHT,width,height); break; case RDMonitorConfig::LowerLeft: setGeometry(0,dw->size().height()-height+RDMONITOR_HEIGHT,width,height); break; case RDMonitorConfig::LowerCenter: setGeometry((dw->size().width()-width)/2, dw->size().height()-height+RDMONITOR_HEIGHT,width,height); break; case RDMonitorConfig::LowerRight: setGeometry(dw->size().width()-width, dw->size().height()-height+RDMONITOR_HEIGHT,width,height); break; case RDMonitorConfig::LastPosition: break; } // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); // // Generate Fonts // QFont default_font("Helvetica",12,QFont::Normal); default_font.setPixelSize(12); qApp->setFont(default_font); QFont button_font=QFont("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); QFont label_font=QFont("Helvetica",16,QFont::Bold); label_font.setPixelSize(16); // // Create And Set Icons // login_rivendell_map=new QPixmap(rivendell_xpm); setIcon(*login_rivendell_map); setCaption(tr("RDSelect")+" v"+VERSION); greencheckmark_map=new QPixmap(greencheckmark_xpm); redx_map=new QPixmap(redx_xpm); // // Load Configs // select_current_id=-1; char target[1500]; ssize_t n; if((n=readlink(RD_CONF_FILE,target,1500))>0) { target[n]=0; } else { target[0]=0; } QDir config_dir(RD_DEFAULT_RDSELECT_DIR); config_dir.setFilter(QDir::Files|QDir::Readable); config_dir.setNameFilter("*.conf"); select_filenames=config_dir.entryList(); for(unsigned i=0;i<select_filenames.size();i++) { select_filenames[i]= QString(RD_DEFAULT_RDSELECT_DIR)+"/"+select_filenames[i]; if(select_filenames[i]==target) { select_current_id=i; } select_configs.push_back(new RDConfig()); select_configs.back()->setFilename(select_filenames[i]); select_configs.back()->load(); } // // Current System Label // select_current_label=new QLabel(this); select_current_label->setFont(label_font); select_current_label->setAlignment(AlignCenter); // // Selector Box // select_box=new QListBox(this); select_box->setFont(default_font); connect(select_box,SIGNAL(doubleClicked(QListBoxItem *)), this,SLOT(doubleClickedData(QListBoxItem *))); for(unsigned i=0;i<select_configs.size();i++) { select_box->insertItem(select_configs[i]->label()); } select_label=new QLabel(select_box,tr("Available Systems"),this); select_label->setFont(button_font); // // Ok Button // ok_button=new QPushButton(this); ok_button->setFont(button_font); ok_button->setText(tr("Select")); connect(ok_button,SIGNAL(clicked()),this,SLOT(okData())); // // Cancel Button // cancel_button=new QPushButton(this,"cancel_button"); cancel_button->setFont(button_font); cancel_button->setText(tr("&Cancel")); connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); SetSystem(select_current_id); SetCurrentItem(select_current_id); select_box->clearSelection(); // // Check for Root User // setuid(geteuid()); // So the SETUID bit works as expected if(getuid()!=0) { QMessageBox::information(this,tr("RDSelect"), tr("Only root can run this utility!")); exit(256); } }
MainWidget::MainWidget(QWidget *parent) :Q3MainWindow(parent) { new RDApplication(RDApplication::Gui,"rdlogedit",RDLOGEDIT_USAGE); QString str1; QString str2; log_log_list=NULL; QString sql; RDSqlQuery *q; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); // // Ensure that the system daemons are running // #ifndef WIN32 RDInitializeDaemons(); #endif // WIN32 // // Load Local Configs // str1=QString("RDLogEdit")+"v"+VERSION+" - "+tr("Host"); str2=tr("User")+": ["+tr("Unknown")+"]"; setCaption(QString().sprintf("%s: %s, %s",(const char *)str1, (const char *)rda->config()->stationName(), (const char *)str2)); log_import_path=RDGetHomeDir(); #ifndef WIN32 rda->cae()->connectHost(); #endif // WIN32 // // RIPC Connection // #ifndef WIN32 connect(rda->ripc(),SIGNAL(connected(bool)),this,SLOT(connectedData(bool))); connect(rda->ripc(),SIGNAL(userChanged()),this,SLOT(userData())); rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password()); #endif // WIN32 // // Create Fonts // QFont default_font("Helvetica",12,QFont::Normal); default_font.setPixelSize(12); qApp->setFont(default_font); QFont button_font=QFont("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); // // Create Icons // log_rivendell_map=new QPixmap(rivendell_xpm); setIcon(*log_rivendell_map); log_greencheckmark_map=new QPixmap(greencheckmark_xpm); log_redx_map=new QPixmap(redx_xpm); log_whiteball_map=new QPixmap(whiteball_xpm); log_greenball_map=new QPixmap(greenball_xpm); log_redball_map=new QPixmap(redball_xpm); // // User // #ifndef WIN32 // // Load Audio Assignments // RDSetMixerPorts(rda->config()->stationName(),rda->cae()); #else rda->setUser(RD_USER_LOGIN_NAME); #endif // WIN32 // // Service Selector // log_service_box=new QComboBox(this); log_service_box->setFont(default_font); connect(log_service_box,SIGNAL(activated(const QString &)), this,SLOT(filterChangedData(const QString &))); log_service_box->insertItem(tr("ALL")); sql="select NAME from SERVICES order by NAME"; q=new RDSqlQuery(sql); while(q->next()) { log_service_box->insertItem(q->value(0).toString()); } delete q; log_service_label=new QLabel(log_service_box,tr("Service")+":",this); log_service_label->setFont(button_font); log_service_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Filter // log_filter_edit=new QLineEdit(this); log_filter_edit->setFont(default_font); connect(log_filter_edit,SIGNAL(textChanged(const QString &)), this,SLOT(filterChangedData(const QString &))); log_filter_label=new QLabel(log_filter_edit,tr("Filter")+":",this); log_filter_label->setFont(button_font); log_filter_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); log_filter_button=new QPushButton(tr("Clear"),this); log_filter_button->setFont(button_font); connect(log_filter_button,SIGNAL(clicked()),this,SLOT(filterClearedData())); // // Show Recent Checkbox // log_recent_check=new QCheckBox(this); connect(log_recent_check,SIGNAL(toggled(bool)),this,SLOT(recentData(bool))); log_recent_label= new QLabel(log_recent_check,tr("Show Only Recent Logs"),this); log_recent_label->setFont(button_font); // // Log List // log_log_list=new Q3ListView(this); log_log_list->setFont(default_font); log_log_list->setAllColumnsShowFocus(true); log_log_list->setItemMargin(5); connect(log_log_list, SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)), this, SLOT(logDoubleclickedData(Q3ListViewItem *,const QPoint &,int))); log_log_list->addColumn(""); log_log_list->setColumnAlignment(0,Qt::AlignCenter); log_log_list->addColumn(tr("LOG NAME")); log_log_list->setColumnAlignment(1,Qt::AlignHCenter); log_log_list->addColumn(tr("DESCRIPTION")); log_log_list->setColumnAlignment(2,Qt::AlignLeft); log_log_list->addColumn(tr("SERVICE")); log_log_list->setColumnAlignment(3,Qt::AlignLeft); log_log_list->addColumn(tr("MUSIC")); log_log_list->setColumnAlignment(4,Qt::AlignCenter); log_log_list->addColumn(tr("TRAFFIC")); log_log_list->setColumnAlignment(5,Qt::AlignCenter); log_log_list->addColumn(tr("TRACKS")); log_log_list->setColumnAlignment(6,Qt::AlignHCenter); log_log_list->addColumn(tr("VALID FROM")); log_log_list->setColumnAlignment(7,Qt::AlignHCenter); log_log_list->addColumn(tr("VALID TO")); log_log_list->setColumnAlignment(8,Qt::AlignHCenter); log_log_list->addColumn(tr("AUTO REFRESH")); log_log_list->setColumnAlignment(9,Qt::AlignHCenter); log_log_list->addColumn(tr("ORIGIN")); log_log_list->setColumnAlignment(10,Qt::AlignLeft); log_log_list->addColumn(tr("LAST LINKED")); log_log_list->setColumnAlignment(11,Qt::AlignLeft); log_log_list->addColumn(tr("LAST MODIFIED")); log_log_list->setColumnAlignment(12,Qt::AlignLeft); RefreshList(); // // Add Button // log_add_button=new QPushButton(this); log_add_button->setFont(button_font); log_add_button->setText(tr("&Add")); connect(log_add_button,SIGNAL(clicked()),this,SLOT(addData())); // // Edit Button // log_edit_button=new QPushButton(this); log_edit_button->setFont(button_font); log_edit_button->setText(tr("&Edit")); connect(log_edit_button,SIGNAL(clicked()),this,SLOT(editData())); // // Delete Button // log_delete_button=new QPushButton(this); log_delete_button->setFont(button_font); log_delete_button->setText(tr("&Delete")); connect(log_delete_button,SIGNAL(clicked()),this,SLOT(deleteData())); // // Tracker Button // log_track_button=new QPushButton(this); log_track_button->setFont(button_font); log_track_button->setText(tr("Voice\n&Tracker")); connect(log_track_button,SIGNAL(clicked()),this,SLOT(trackData())); #ifdef WIN32 log_track_button->hide(); #endif // // Log Report Button // log_report_button=new QPushButton(this); log_report_button->setFont(button_font); log_report_button->setText(tr("Log\nReport")); connect(log_report_button,SIGNAL(clicked()),this,SLOT(reportData())); // // Close Button // log_close_button=new QPushButton(this); log_close_button->setFont(button_font); log_close_button->setText(tr("&Close")); connect(log_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget())); #ifndef WIN32 // // Setup Signal Handling // ::signal(SIGCHLD,SigHandler); #endif // WIN32 }
MainWidget::MainWidget(QWidget *parent,const char *name) :QWidget(parent,name) { QString sql; QSqlQuery *q; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Create Fonts // QFont font=QFont("Helvetica",12,QFont::Bold); font.setPixelSize(12); QFont default_font("Helvetica",12,QFont::Normal); default_font.setPixelSize(12); QFont title_font=QFont("Helvetica",16,QFont::Bold); title_font.setPixelSize(16); qApp->setFont(default_font); // // Create And Set Icon // mdb_callcommander_map=new QPixmap(callcommander_xpm); setIcon(*mdb_callcommander_map); // // Reload Socket // admin_reload_socket=new Q3SocketDevice(Q3SocketDevice::Datagram); // // Load Configs // admin_config=new MldConfig(); admin_config->load(); // // Open Database // /* QStringList drivers=QSqlDatabase::drivers(); for(unsigned i=0;i<drivers.size();i++) { QMessageBox::information(this,"DRIVERS",drivers[i]); } */ OpenDb(admin_config->mysqlDbname(),admin_config->mysqlUsername(), admin_config->mysqlPassword(),admin_config->mysqlHostname(),true); // // Log In // QString password; Login *login=new Login(&admin_loginname,&password,true,this); if(login->exec()!=0) { exit(0); } sql=QString("select LOGIN_NAME from USERS where ")+ "(LOGIN_NAME=\""+EscapeString(admin_loginname)+"\")&&"+ "(PASSWORD=\""+EscapeString(password)+"\")"; q=new QSqlQuery(sql); if(q->size()<=0) { QMessageBox::information(this,"Login Failed","Invalid Login!"); exiting=true; delete q; } else { delete q; sql= QString().sprintf("select ADMIN_PRIV from USERS where LOGIN_NAME=\"%s\"", (const char *)admin_loginname); q=new QSqlQuery(sql); q->first(); if(q->value(0).toString().lower()!="y") { QMessageBox::information(this,"Login Failed", "This user does not have \nadministrative permissions!"); exiting=true; } delete q; setCaption(QString().sprintf("Call Administrator - User: %s", (const char *)admin_loginname)); } // // Title // QLabel *label=new QLabel("CallCommander",this,"main_title_label"); label->setGeometry(10,5,sizeHint().width()-20,20); label->setFont(title_font); label->setAlignment(Qt::AlignCenter); label=new QLabel("Database Administrator",this,"sub_title_label"); label->setGeometry(10,25,sizeHint().width()-20,20); label->setFont(default_font); label->setAlignment(Qt::AlignCenter); // // Manage Users Button // QPushButton *button=new QPushButton(this,"users_button"); button->setGeometry(10,50,120,60); button->setFont(font); button->setText("Manage\n&Users"); connect(button,SIGNAL(clicked()),this,SLOT(manageUsersData())); // // Manage Shows Button // button=new QPushButton(this,"shows_button"); button->setGeometry(150,50,120,60); button->setFont(font); button->setText("Manage\n&Shows"); connect(button,SIGNAL(clicked()),this,SLOT(manageShowsData())); // // Manage Directory Button // button=new QPushButton(this,"directory_button"); button->setGeometry(10,120,120,60); button->setFont(font); button->setText("Manage\n&Directory"); connect(button,SIGNAL(clicked()),this,SLOT(manageDirectoryData())); // // CallerID Source Button // button=new QPushButton(this,"callerid_button"); button->setGeometry(150,120,120,60); button->setFont(font); button->setText("Manage &CallerID\nSources"); connect(button,SIGNAL(clicked()),this,SLOT(manageCallerIdData())); // // Manage Virtual Systems Vutton // button=new QPushButton(this,"virtual_button"); button->setGeometry(10,190,120,60); button->setFont(font); button->setText("Manage &Virtual\nSystems"); connect(button,SIGNAL(clicked()),this,SLOT(manageVirtualData())); // // Logic Modules Button // button=new QPushButton(this,"logic_modules_button"); button->setGeometry(150,190,120,60); button->setFont(font); button->setText("Manage &Logic\nModules"); connect(button,SIGNAL(clicked()),this,SLOT(manageLogicModuleData())); // // System Info Button // button=new QPushButton(this,"sysinfo_button"); button->setGeometry(80,260,120,60); button->setFont(font); button->setText("System\n&Info"); connect(button,SIGNAL(clicked()),this,SLOT(showInfoData())); // // Quit Button // button=new QPushButton(this,"quit_button"); button->setGeometry(10,sizeHint().height()-70,sizeHint().width()-20,60); button->setFont(font); button->setText("&Quit"); connect(button,SIGNAL(clicked()),this,SLOT(quitMainWidget())); }