MainMenu::MainMenu() : Fl_Menu_Button(0,0,0,0, "Start") { layout_align(FL_ALIGN_LEFT); label_font(label_font()->bold()); label_size(label_size()+2); m_modified = 0; e_image = 0; m_open = false; bool showusername; pGlobalConfig.get("Panel", "ShowUsernameOnMenu", showusername, false); struct passwd *PWD; /* Search for an entry with a matching user ID. */ PWD = getpwuid(getuid()); if(showusername && PWD && PWD->pw_name && *PWD->pw_name) { label(PWD->pw_name); } else { label("EDE"); } tooltip(_("Welcome to the Equinox Desktop Environment.")); }
DiskGauge::DiskGauge(int samp_rate,int chans,QWidget *parent,const char *name) : QWidget(parent,name) { disk_sample_rate=samp_rate; disk_channels=chans; // // Generate Fonts // QFont label_font("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); disk_label=new QLabel("Free:",this,"free_label"); disk_label->setGeometry(0,0,50,sizeHint().height()); disk_label->setFont(label_font); disk_label->setAlignment(AlignRight|AlignVCenter); disk_bar=new QProgressBar(this); disk_bar->setPercentageVisible(false); disk_bar->setGeometry(55,0,sizeHint().width()-55,sizeHint().height()); disk_space_label=new QLabel(this); disk_space_label->setFont(label_font); disk_space_label->setAlignment(AlignCenter); struct statfs diskstat; statfs(RDConfiguration()->audioRoot().ascii(),&diskstat); disk_bar->setTotalSteps(GetMinutes(diskstat.f_blocks,diskstat.f_bsize)); update(); QTimer *timer=new QTimer(this,"update_timer"); connect(timer,SIGNAL(timeout()),this,SLOT(update())); timer->start(DISK_GAUGE_UPDATE_INTERVAL); }
void Fl_TooltipBox::layout() { fl_font(label_font(), label_size()); int ww, hh; ww = MAX_WIDTH; fl_measure(tip, ww, hh, FL_ALIGN_LEFT|FL_ALIGN_WRAP|FL_ALIGN_INSIDE); ww += 6; hh += 6; // find position on the screen of the widget: int ox = Fl::event_x_root(); //int ox = X+W/2; int oy = Y + H+2; for (Fl_Widget* p = widget; p; p = p->parent()) { //ox += p->x(); oy += p->y(); } if (ox+ww > Fl::w()) ox = Fl::w() - ww; if (ox < 0) ox = 0; if (H > 30) { oy = Fl::event_y_root()+13; if (oy+hh > Fl::h()) oy -= 23+hh; } else { if (oy+hh > Fl::h()) oy -= (4+hh+H); } if (oy < 0) oy = 0; resize(ox, oy, ww, hh); Fl_Menu_Window::layout(); }
void Icon::update_all() { Fl_Config &iconConfig = *cfg; iconConfig.read_file(false); iconConfig.set_section("Desktop Entry"); // Icon Label: icon_name = get_localized_name(iconConfig); tooltip(icon_name); label(icon_name); label_color(label_foreground); label_size(label_fontsize); lwidth = label_maxwidth; // This is a bit strange, but otherwise we get mysterious crashes... lheight= 0; fl_font(label_font(), label_size()); fl_measure(icon_name, lwidth, lheight, FL_ALIGN_WRAP); lwidth += 4; // height+= 4; // Icon file: iconConfig.read("Icon", icon_file, "folder.png"); update_icon(); redraw(); //desktop->redraw(); }
void Icon::draw() { Fl_Flags f=0; Fl_Image *im = icon_im; if(focused()) { f=FL_SELECTED; } if(im) im->draw(0, 0, w(), h(),f); else { fl_color(FL_RED); fl_rect(0,0,w(),h()); fl_color(FL_BLACK); fl_rectf(1,1,w()-2,h()-2); fl_color(FL_WHITE); fl_font(label_font()->bold(), 10); fl_draw("NO ICON FOUND!", 1, 1, w()-2, h()-2, FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_WRAP); } int X = w()-(w()/2)-(lwidth/2); int Y = h()+2; if(!label_trans) { fl_color(label_background); fl_rectf(X,Y,lwidth,lheight); } if(focused()) { focus_box()->draw(X, Y, lwidth, lheight, color(), 0); } fl_font(label_font(), label_size()); // A little shadow, from Dejan's request :) // SUCKS! /*fl_color(fl_darker(label_color())); fl_draw(label(), X-1, Y+1, lwidth, lheight, flags()); fl_draw(label(), X, Y+1, lwidth, lheight, flags()); */ fl_color(label_color()); fl_draw(label(), X, Y, lwidth, lheight, flags()); }
void Icon::update_label_size(void) { lwidth = globals->label_maxwidth; lheight= 0; fl_font(label_font(), label_size()); fl_measure(label(), lwidth, lheight, FL_ALIGN_WRAP); lwidth += 8; lheight += 4; }
void Icon::draw(void) { Fl_Flags f = 0; if(is_focused()) f = FL_SELECTED; if(icon_img) icon_img->draw(0, 0, w(), h(),f); else { fl_color(FL_RED); fl_rect(0,0,w(),h()); fl_color(FL_BLACK); fl_rectf(1,1,w()-2,h()-2); fl_color(FL_WHITE); fl_font(label_font()->bold(), 10); fl_draw(_("NO ICON FOUND!"), 1, 1, w()-2, h()-2, FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_WRAP); return; } if(globals->label_draw) { int X = w()-(w()/2)-(lwidth/2); int Y = h()+2; if(!globals->label_transparent) { fl_color(globals->label_background); fl_rectf(X,Y,lwidth,lheight); } if(is_focused()) focus_box()->draw(X, Y, lwidth, lheight, color(), 0); fl_font(label_font(), label_size()); fl_color(label_color()); fl_draw(label(), X, Y, lwidth, lheight, flags()); } }
HostDialog::HostDialog(Config *config,QWidget *parent) : QDialog(parent) { host_config=config; host_id=-1; QFont check_font("helvetica",12,QFont::Bold); check_font.setPixelSize(12); QFont label_font("helvetica",14,QFont::Bold); label_font.setPixelSize(14); QFont button_font("helvetica",16,QFont::Bold); button_font.setPixelSize(16); host_label_label=new QLabel(tr("Label")+":",this); host_label_label->setFont(label_font); host_label_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); host_label_edit=new QLineEdit(this); host_hostname_label=new QLabel(tr("Hostname")+":",this); host_hostname_label->setFont(label_font); host_hostname_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); host_hostname_edit=new QLineEdit(this); host_password_label=new QLabel(tr("Password")+":",this); host_password_label->setFont(label_font); host_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); host_password_edit=new QLineEdit(this); host_password_edit->setEchoMode(QLineEdit::Password); host_color_label=new QLabel(tr("Color")+":",this); host_color_label->setFont(label_font); host_color_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); host_color_box=new ColorBox(this); host_autoconnect_check=new QCheckBox(this); host_autoconnect_label=new QLabel(tr("Autoconnect"),this); host_autoconnect_label->setFont(check_font); host_autoconnect_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); host_ok_button=new QPushButton(tr("OK"),this); host_ok_button->setFont(button_font); connect(host_ok_button,SIGNAL(clicked()),this,SLOT(okData())); host_cancel_button=new QPushButton(tr("Cancel"),this); host_cancel_button->setFont(button_font); connect(host_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); }
OptionListView::OptionListView( nnet::SerializablePtr object, QWidget* parent, const char* name, WFlags fl ) : ObjectView( object, parent, name, fl ), optionList( object ) { if( !name ) { setName( "OptionListView" ); } OptionListViewLayout = new QVBoxLayout( this, 11, 6, "OptionListViewLayout" ); label = new QLabel( this, "label" ); QFont label_font( label->font() ); label_font.setFamily( "Helvetica" ); label->setFont( label_font ); OptionListViewLayout->addWidget( label ); selected = new QListBox( this, "selected" ); OptionListViewLayout->addWidget( selected ); languageChange(); resize( QSize( 243, 118 ).expandedTo( minimumSizeHint() ) ); clearWState( WState_Polished ); // if ( optionList->max() == 0 ) { // selected->setSelectionMode( QListBox::NoSelection ); // } else if ( optionList->max() == 1 ) { // selected->setSelectionMode( QListBox::Single ); // } else { selected->setSelectionMode( QListBox::Multi ); // } // signals and slots connections connect( selected, SIGNAL( rightButtonClicked( QListBoxItem*, const QPoint& ) ), this, SLOT( rightClickedSlot() ) ); connect( selected, SIGNAL( clicked( QListBoxItem* ) ), this, SLOT( newSelection( QListBoxItem* ) ) ); label->setText( optionList->name().c_str() ); refreshView(); }
void MainMenu::draw() { Fl_Boxtype box = this->box(); Fl_Flags flags; Fl_Color color = this->color(); Fl_Color lcolor = label_color(); if (!active_r()) flags = FL_INACTIVE; else if (m_open) flags = FL_VALUE; else flags = 0; if (belowmouse()) { flags = flags|FL_HIGHLIGHT; color = fl_lighter(color); lcolor = fl_lighter(label_color()); if(!color) color = this->color(); if(!lcolor) color = this->label_color(); } box->draw(0, 0, this->w(), this->h(), color, flags); int X=0, Y=0, W=w(), H=h(); box->inset(X,Y,W,H); if(image()) { int imY = (h()/2)-(image()->height()/2); image()->draw(6, imY, image()->width(), image()->height(), flags); X+=image()->width()+6; } else { X += 4; W -= 4; } fl_font(label_font(), label_size()); label_type()->draw(label(), X, Y, W-X, H, lcolor, flags|FL_ALIGN_LEFT); }
void MainMenu::layout() { fl_font(label_font(), label_size()); int W = int(fl_width(label())) + 12; int H = h(); int im_size = H-6; if(!e_image || (e_image && e_image->height()!=im_size)) { if(e_image) delete e_image; if(ede_pix.height()==im_size) { e_image=0; image(ede_pix); } else { e_image = ede_pix.scale(im_size, im_size); image(e_image); } } if(image()) W+=image()->width(); w(W); Fl_Menu_Button::layout(); }
FileChooserView::FileChooserView( nnet::SerializablePtr object, QWidget* parent, const char* name, WFlags fl ) : ObjectView( object, parent, name, fl ), cstr( object ) { if( !name ) { setName( "FileChooserView" ); } FileChooserViewLayout = new QHBoxLayout( this, 11, 6, "FileChooserViewLayout" ); label = new QLabel( this, "label" ); QFont label_font( label->font() ); label_font.setFamily( "Helvetica" ); label->setFont( label_font ); label->setAlignment( int( QLabel::AlignVCenter ) ); FileChooserViewLayout->addWidget( label ); edit = new QPushButton( cstr->get ().c_str(), this, "edit" ); QFont edit_font( edit->font() ); edit_font.setFamily( "Helvetica" ); edit_font.setPointSize( 10 ); edit->setFont( edit_font ); FileChooserViewLayout->addWidget( edit ); languageChange(); resize( QSize( 189, 50 ).expandedTo( minimumSizeHint() ) ); clearWState( WState_Polished ); connect( edit, SIGNAL( clicked() ), this, SLOT( pickFile() ) ); label->setText( cstr->name().c_str() ); refreshView(); }
DiskGauge::DiskGauge(int samp_rate,int chans,QWidget *parent) : QWidget(parent) { disk_sample_rate=samp_rate; disk_channels=chans; // // Generate Fonts // QFont label_font("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); disk_label=new QLabel("Free:",this); disk_label->setGeometry(0,0,50,sizeHint().height()); disk_label->setFont(label_font); disk_label->setAlignment(AlignRight|AlignVCenter); disk_label->setDisabled(true); disk_bar=new QProgressBar(this); disk_bar->setPercentageVisible(false); disk_bar->setGeometry(55,0,sizeHint().width()-55,sizeHint().height()); disk_bar->setDisabled(true); disk_space_label=new QLabel(this); disk_space_label->setFont(label_font); disk_space_label->setAlignment(AlignCenter); disk_space_label->setDisabled(true); /* update(); */ disk_timer=new QTimer(this); connect(disk_timer,SIGNAL(timeout()),this,SLOT(update())); disk_timer->start(100); }
// Anybody can call this to force the label to draw anywhere, this is // used by Fl_Group and Fl_Tabs to draw outside labels: void Fl_Widget::draw_label(int X, int Y, int W, int H, Fl_Flags flags) const { fl_font(label_font(), float(label_size())); if (!active_r()) flags.set(FL_INACTIVE); Fl_Color color; // Figure out if alignment puts the label inside the widget: if (!(this->flags()&15) || (this->flags() & FL_ALIGN_INSIDE)) { // yes, inside label is affected by selection or highlight: if (flags&FL_SELECTED) color = selection_text_color(); else if (flags&FL_HIGHLIGHT && highlight_label_color()) color = highlight_label_color(); else color = label_color(); if (focused()) flags.set(FL_SELECTED); } else { color = label_color(); } if (flags & FL_ALIGN_CLIP) fl_push_clip(X, Y, W, H); if (image_) { fl_color(fl_inactive(color, flags)); if(flags & FL_ALIGN_TILED || flags & FL_ALIGN_SCALE) { image_->draw(X, Y, W, H, flags); } else { int w = W; int h = H; image_->measure(w, h); // If all the flags are off, draw the image and label centered "nicely" // by measuring their total size and centering that rectangle: if (!(flags & (FL_ALIGN_LEFT|FL_ALIGN_RIGHT|FL_ALIGN_TOP|FL_ALIGN_BOTTOM| FL_ALIGN_INSIDE)) && !label_.empty()) { int d = (H-int(h+fl_height()))>>1; if (d >= 0) { // put the image atop the text Y += d; H -= d; flags.set(FL_ALIGN_TOP); } else { // put image to left int text_w = W; int text_h = H; fl_measure(label_.c_str(), text_w, text_h, flags); int d = (W-(h+text_w))>>1; if (d > 0) {X += d; W -= d;} flags.set(FL_ALIGN_LEFT); } } int cx,cy; // point in image to put at X,Y if (flags & FL_ALIGN_RIGHT) { cx = w-W; if (flags & FL_ALIGN_LEFT && cx < 0) cx = 0; } else if (flags & FL_ALIGN_LEFT) cx = 0; else cx = w/2-W/2; if (flags & FL_ALIGN_BOTTOM) { cy = h-H; if (flags & FL_ALIGN_TOP && cy < 0) cy = 0; } else if (flags & FL_ALIGN_TOP) cy = 0; else cy = h/2-H/2; image_->draw(X-cx, Y-cy, W, H, 0,0,0,0,flags); // figure out the rectangle that remains for text: if (flags & FL_ALIGN_LEFT) { X += (w+2); W -= (w+4); } else if (flags & FL_ALIGN_RIGHT) W -= (w+4); else if (flags & FL_ALIGN_TOP) {Y += h; H -= h;} else if (flags & FL_ALIGN_BOTTOM) H -= h; else { /*flags |= FL_ALIGN_TOP;*/ Y += (h-cy); H -= (h-cy); } } }
StreamDialog::StreamDialog(QWidget *parent) : QDialog(parent) { // // Fonts // QFont label_font("helvetica",14,QFont::Bold); label_font.setPixelSize(14); setWindowTitle("GlassGui - "+tr("Stream Metadata Settings")); // // Stream Name // gui_stream_name_label=new QLabel(tr("Name")+":",this); gui_stream_name_label->setFont(label_font); gui_stream_name_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); gui_stream_name_edit=new QLineEdit(this); // // Stream Description // gui_stream_description_label=new QLabel(tr("Description")+":",this); gui_stream_description_label->setFont(label_font); gui_stream_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); gui_stream_description_edit=new QLineEdit(this); // // Stream URL // gui_stream_url_label=new QLabel(tr("URL")+":",this); gui_stream_url_label->setFont(label_font); gui_stream_url_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); gui_stream_url_edit=new QLineEdit(this); // // Stream Genre // gui_stream_genre_label=new QLabel(tr("Genre")+":",this); gui_stream_genre_label->setFont(label_font); gui_stream_genre_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); gui_stream_genre_edit=new QLineEdit(this); // // Stream Icq // gui_stream_icq_label=new QLabel(tr("ICQ ID")+":",this); gui_stream_icq_label->setFont(label_font); gui_stream_icq_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); gui_stream_icq_edit=new QLineEdit(this); // // Stream AOL Instant Messager ID // gui_stream_aim_label=new QLabel(tr("AOL IM ID")+":",this); gui_stream_aim_label->setFont(label_font); gui_stream_aim_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); gui_stream_aim_edit=new QLineEdit(this); // // Internet Relay Chat ID // gui_stream_irc_label=new QLabel(tr("IRC ID")+":",this); gui_stream_irc_label->setFont(label_font); gui_stream_irc_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); gui_stream_irc_edit=new QLineEdit(this); // // Timestamp Offset // gui_stream_timestamp_offset_label=new QLabel(tr("Timestamp Offset")+":",this); gui_stream_timestamp_offset_label->setFont(label_font); gui_stream_timestamp_offset_label-> setAlignment(Qt::AlignRight|Qt::AlignVCenter); gui_stream_timestamp_offset_spin=new SpinBox(this); gui_stream_timestamp_offset_spin->setRange(-300,300); gui_stream_timestamp_offset_unit=new QLabel(tr("seconds"),this); gui_stream_timestamp_offset_unit->setFont(label_font); gui_stream_timestamp_offset_unit-> setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Close Button // gui_close_button=new QPushButton(tr("Close"),this); gui_close_button->setFont(label_font); connect(gui_close_button,SIGNAL(clicked()),this,SLOT(hide())); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); setMinimumSize(sizeHint()); }
HpiWidget::HpiWidget(QWidget *parent) : QWidget(parent) { #ifdef ASIHPI hpi_adapter_index=0; hpi_input_index=0; hpi_mixer_handle=0; // // Fonts // QFont label_font("helvetica",14,QFont::Bold); label_font.setPixelSize(14); QFont readout_font("helvetica",14,QFont::Normal); readout_font.setPixelSize(14); // // Source // hpi_source_label=new QLabel(tr("Input Source")+":",this); hpi_source_label->setFont(label_font); hpi_source_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); hpi_source_box=new ComboBox(this); connect(hpi_source_box,SIGNAL(activated(int)), this,SLOT(sourceActivatedData(int))); // // Input Type // hpi_type_label=new QLabel(tr("Input Type")+":",this); hpi_type_label->setFont(label_font); hpi_type_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); hpi_type_box=new ComboBox(this); connect(hpi_type_box,SIGNAL(activated(int)), this,SLOT(typeActivatedData(int))); // // Input Mode // hpi_mode_label=new QLabel(tr("Input Mode")+":",this); hpi_mode_label->setFont(label_font); hpi_mode_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); hpi_mode_box=new ComboBox(this); connect(hpi_mode_box,SIGNAL(activated(int)), this,SLOT(modeActivatedData(int))); // // Input Gain // hpi_volume_label=new QLabel(tr("Input Gain")+":",this); hpi_volume_label->setFont(label_font); hpi_volume_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); hpi_volume_slider=new QSlider(Qt::Horizontal,this); connect(hpi_volume_slider,SIGNAL(valueChanged(int)), this,SLOT(volumeChangedData(int))); hpi_volume_readout_label=new QLabel(this); hpi_volume_readout_label->setFont(readout_font); hpi_volume_readout_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); hpi_view=new HpiInputListView(this); connect(hpi_view,SIGNAL(clicked(const QModelIndex &)), this,SLOT(listClickedData(const QModelIndex &))); #endif // ASIHPI }
RDCutDialog::RDCutDialog(QString *cutname,QString *filter,QString *group, QString *schedcode,bool show_clear,bool allow_add, bool exclude_tracks,QWidget *parent) : QDialog(parent,"",true) { cut_cutname=cutname; cut_exclude_tracks=exclude_tracks; cut_group=group; cut_schedcode=schedcode; cut_allow_clear=show_clear; if(filter==NULL) { cut_filter=new QString(); local_filter=true; } else { cut_filter=filter; local_filter=false; } setCaption(tr("Select Cut")); // // Create Icons // cut_playout_map=new QPixmap(play_xpm); cut_macro_map=new QPixmap(rml5_xpm); // // Generate Fonts // QFont label_font("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); QFont progress_font("Helvetica",16,QFont::Bold); progress_font.setPixelSize(16); // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Progress Dialog // cut_progress_dialog= new Q3ProgressDialog(tr("Please Wait..."),"Cancel",10,this, "cut_progress_dialog",false, Qt::WStyle_Customize|Qt::WStyle_NormalBorder); cut_progress_dialog->setCaption(" "); QLabel *label=new QLabel(tr("Please Wait..."),cut_progress_dialog); label->setAlignment(Qt::AlignCenter); label->setFont(progress_font); cut_progress_dialog->setLabel(label); cut_progress_dialog->setCancelButton(NULL); cut_progress_dialog->setMinimumDuration(2000); // // Filter Selector // cut_filter_edit=new QLineEdit(this); label=new QLabel(cut_filter_edit,tr("Cart Filter:"),this); label->setGeometry(10,10,85,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); label->setFont(label_font); connect(cut_filter_edit,SIGNAL(textChanged(const QString &)), this,SLOT(filterChangedData(const QString &))); // // Filter Search Button // cut_search_button=new QPushButton(this); cut_search_button->setGeometry(sizeHint().width()-140,8,60,24); cut_search_button->setText(tr("&Search")); cut_search_button->setFont(label_font); connect(cut_search_button,SIGNAL(clicked()),this,SLOT(searchButtonData())); // // Filter Clear Button // cut_clear_button=new QPushButton(this); cut_clear_button->setGeometry(sizeHint().width()-70,8,60,24); cut_clear_button->setFont(label_font); cut_clear_button->setText(tr("C&lear")); connect(cut_clear_button,SIGNAL(clicked()),this,SLOT(clearData())); // // Group Selector // cut_group_box=new QComboBox(this); cut_group_box->setGeometry(100,40,140,20); label=new QLabel(cut_filter_edit,tr("Group:"),this); label->setGeometry(10,40,85,20); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); label->setFont(label_font); connect(cut_group_box,SIGNAL(activated(const QString &)), this,SLOT(groupActivatedData(const QString &))); // // Scheduler Code Selector // cut_schedcode_box=new QComboBox(this); cut_schedcode_box->setGeometry(380,40,sizeHint().width()-390,20); cut_schedcode_label=new QLabel(cut_schedcode_box,tr("Scheduler Code:"),this); cut_schedcode_label->setGeometry(260,40,115,20); cut_schedcode_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); cut_schedcode_label->setFont(label_font); connect(cut_schedcode_box,SIGNAL(activated(const QString &)), this,SLOT(groupActivatedData(const QString &))); // // Search Limit Checkbox // cart_limit_box=new QCheckBox(this); cart_limit_box->setGeometry(100,72,15,15); cart_limit_box->setChecked(true); label=new QLabel(cart_limit_box,tr("Show Only First")+ QString().sprintf(" %d ", RD_LIMITED_CART_SEARCH_QUANTITY)+tr("Matches"),this); label->setGeometry(120,70,300,20); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); label->setFont(label_font); connect(cart_limit_box,SIGNAL(stateChanged(int)), this,SLOT(limitChangedData(int))); // // Cart List // cut_cart_list=new RDListView(this); cut_cart_list->setGeometry(10,120,300,200); cut_cart_list->setAllColumnsShowFocus(true); cut_cart_list->setItemMargin(5); connect(cut_cart_list,SIGNAL(selectionChanged()), this,SLOT(selectionChangedData())); connect(cut_cart_list,SIGNAL(clicked(Q3ListViewItem *)), this,SLOT(cartClickedData(Q3ListViewItem *))); label=new QLabel(cut_cart_list,tr("Carts"),this); label->setGeometry(15,100,100,20); label->setFont(label_font); cut_cart_list->addColumn(""); cut_cart_list->setColumnAlignment(0,Qt::AlignHCenter); cut_cart_list->addColumn(tr("Number")); cut_cart_list->setColumnAlignment(1,Qt::AlignHCenter); cut_cart_list->addColumn(tr("Title")); cut_cart_list->setColumnAlignment(2,Qt::AlignLeft); cut_cart_list->addColumn(tr("Group")); cut_cart_list->setColumnAlignment(3,Qt::AlignCenter); // // Cut List // cut_cut_list=new Q3ListView(this); cut_cut_list->setGeometry(320,120,sizeHint().width()-330,200); cut_cut_list->setAllColumnsShowFocus(true); cut_cut_list->setItemMargin(5); label=new QLabel(cut_cut_list,tr("Cuts"),this); label->setGeometry(325,100,100,20); label->setFont(label_font); cut_cut_list->addColumn(tr("Description")); cut_cut_list->setColumnAlignment(0,Qt::AlignLeft); cut_cut_list->addColumn(tr("Number")); cut_cut_list->setColumnAlignment(1,Qt::AlignLeft); QPushButton *button=NULL; // // Add Button // button=new QPushButton(tr("&Add New\nCart"),this); button->setGeometry(10,sizeHint().height()-60,80,50); button->setFont(label_font); connect(button,SIGNAL(clicked()),this,SLOT(addButtonData())); if(!allow_add) { button->hide(); } // // Clear Button // button=new QPushButton(tr("&Clear"),this); button->setFont(label_font); connect(button,SIGNAL(clicked()),this,SLOT(clearButtonData())); if(!show_clear) { button->hide(); } if(allow_add) { button->setGeometry(100,sizeHint().height()-60,80,50); } else { button->setGeometry(10,sizeHint().height()-60,80,50); } // // OK Button // cut_ok_button=new QPushButton(tr("&OK"),this); cut_ok_button-> setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); cut_ok_button->setFont(label_font); cut_ok_button->setDefault(true); connect(cut_ok_button,SIGNAL(clicked()),this,SLOT(okData())); // // Cancel Button // cut_cancel_button=new QPushButton(tr("&Cancel"),this); cut_cancel_button-> setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50); cut_cancel_button->setFont(label_font); connect(cut_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); // // Populate Data // if(cut_cutname->isEmpty()) { cut_ok_button->setDisabled(true); } switch(rda->station()->filterMode()) { case RDStation::FilterAsynchronous: cut_search_button->setDefault(true); cut_filter_edit->setGeometry(100,10,sizeHint().width()-250,20); break; case RDStation::FilterSynchronous: cut_ok_button->setDefault(true); cut_search_button->hide(); cut_filter_edit->setGeometry(100,10,sizeHint().width()-180,20); } BuildGroupList(); cut_filter_edit->setText(*cut_filter); RefreshCarts(); RefreshCuts(); SelectCut(*cut_cutname); }
MainWidget::MainWidget(QWidget *parent) :QMainWindow(parent) { moji_db=NULL; // // Create Fonts // QFont font("Helvetica",12,QFont::Normal); font.setPixelSize(12); setFont(font); QFont label_font("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); // // Set Window Title // setCaption(tr("MojiHunter - Qt3")); // // Dialogs // moji_text_viewer=new TextViewer(this); // // DB Type // moji_db_type_box=new QComboBox(this); moji_db_type_label= new QLabel(moji_db_type_box,tr("DB Type")+":",this); moji_db_type_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); moji_db_type_label->setFont(label_font); moji_db_type_box->insertItem("QODBC3"); moji_db_type_box->insertItem("QOCI8"); moji_db_type_box->insertItem("QQSQL7"); moji_db_type_box->insertItem("QTDS7"); moji_db_type_box->insertItem("QMYSQL3"); moji_db_type_box->insertItem("QDB2"); moji_db_type_box->insertItem("QSQLITE"); moji_db_type_box->insertItem("QIBASE"); // // DB Hostname // moji_db_hostname_edit=new QLineEdit(this); moji_db_hostname_label= new QLabel(moji_db_hostname_edit,tr("DB Host")+":",this); moji_db_hostname_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); moji_db_hostname_label->setFont(label_font); // // DB Database Name // moji_db_dbname_edit=new QLineEdit(this); moji_db_dbname_label= new QLabel(moji_db_dbname_edit,tr("DB Database Name")+":",this); moji_db_dbname_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); moji_db_dbname_label->setFont(label_font); // // DB Username // moji_db_username_edit=new QLineEdit(this); moji_db_username_label= new QLabel(moji_db_username_edit,tr("DB User")+":",this); moji_db_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); moji_db_username_label->setFont(label_font); // // DB Password // moji_db_password_edit=new QLineEdit(this); moji_db_password_edit->setEchoMode(QLineEdit::Password); moji_db_password_label= new QLabel(moji_db_password_edit,tr("DB Password")+":",this); moji_db_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); moji_db_password_label->setFont(label_font); // // DB Character Set // moji_charset_edit=new QLineEdit(this); moji_charset_label= new QLabel(moji_charset_edit,tr("Character Set")+":",this); moji_charset_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); moji_charset_label->setFont(label_font); // // Process Button // moji_process_button=new QPushButton(tr("Process"),this); moji_process_button->setFont(label_font); moji_process_button->setDisabled(true); connect(moji_process_button,SIGNAL(clicked()), this,SLOT(processClickedData())); // // View SQL Button // moji_sql_button=new QPushButton(tr("View SQL"),this); moji_sql_button->setFont(label_font); moji_sql_button->setDisabled(true); connect(moji_sql_button,SIGNAL(clicked()), this,SLOT(sqlClickedData())); // // Input Text // moji_input_text=new QTextEdit(this); moji_input_text->setFont(font); connect(moji_input_text,SIGNAL(textChanged()),this,SLOT(inputChangedData())); moji_input_label=new QLabel(moji_input_text,tr("Input Text"),this); moji_input_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); moji_input_label->setFont(label_font); // // Result // moji_result_text=new QTextEdit(this); moji_result_text->setFont(font); moji_result_text->setReadOnly(true); moji_result_label=new QLabel(moji_result_text,tr("Result"),this); moji_result_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); moji_result_label->setFont(label_font); LoadDefaults(); setMinimumSize(sizeHint()); }
FilterDialog::FilterDialog(QWidget *parent,const char *name) : QDialog(parent,name,true) { setCaption("Call Manager - Call Filter"); // // Generate Fonts // QFont label_font("helvetica",12,QFont::Bold); label_font.setPixelSize(12); // // The Date Range // edit_startdate_edit=new QDateEdit(this); edit_startdate_edit->setGeometry(205,10,100,22); QPushButton *button=new QPushButton(this); button->setGeometry(310,10,22,22); button->setText("..."); connect(button,SIGNAL(clicked()),this,SLOT(selectStartDateData())); QLabel *label=new QLabel(edit_startdate_edit,"Show calls on dates from", this,"edit_startdate_label"); label->setGeometry(10,10,190,22); label->setFont(label_font); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); edit_enddate_edit=new QDateEdit(this); edit_enddate_edit->setGeometry(362,10,100,22); button=new QPushButton(this); button->setGeometry(467,10,22,22); button->setText("..."); connect(button,SIGNAL(clicked()),this,SLOT(selectEndDateData())); label=new QLabel(edit_enddate_edit,"to",this,"edit_enddate_label"); label->setGeometry(337,10,20,22); label->setFont(label_font); label->setAlignment(Qt::AlignCenter); // // The Time Range // edit_starttime_edit=new QTimeEdit(this); edit_starttime_edit->setGeometry(205,35,100,22); label=new QLabel(edit_starttime_edit,"and between the times of", this,"edit_starttime_label"); label->setGeometry(10,35,190,22); label->setFont(label_font); label->setAlignment(Qt::AlignVCenter|Qt::AlignRight); edit_endtime_edit=new QTimeEdit(this); edit_endtime_edit->setGeometry(345,35,100,22); label=new QLabel(edit_endtime_edit,"and",this,"edit_endtime_label"); label->setGeometry(310,35,30,22); label->setFont(label_font); label->setAlignment(Qt::AlignCenter); // // Load Data // edit_startdate_edit->setDate(start_datetime.date()); edit_enddate_edit->setDate(end_datetime.date()); edit_starttime_edit->setTime(start_datetime.time()); edit_endtime_edit->setTime(end_datetime.time()); // // OK Button // button=new QPushButton(this,"ok_button"); button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); button->setDefault(true); button->setFont(label_font); button->setText("&OK"); connect(button,SIGNAL(clicked()),this,SLOT(okData())); // // Cancel Button // button=new QPushButton(this,"cancel_button"); button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50); button->setFont(label_font); button->setText("&Cancel"); connect(button,SIGNAL(clicked()),this,SLOT(cancelData())); }
MainWidget::MainWidget(QWidget *parent,const char *name) :QWidget(parent,name) { elo_speed=ELO_DEFAULT_SPEED; bool elo_workaround=false; // // Generate Fonts // QFont header_font("Helvetica",14,QFont::Bold); header_font.setPixelSize(12); QFont label_font("Helvetica",14,QFont::Bold); label_font.setPixelSize(12); // // Process Command Switches // if(qApp->argc()<2) { QMessageBox::warning(this,"EloMon",ELO_USAGE); exiting=true; return; } if(qApp->argc()>2) { bool arg_found=false; for(int i=1;i<(qApp->argc()-1);i++) { if(!strcmp(qApp->argv()[i],"-b")) { // Baud Rate if(sscanf(qApp->argv()[++i],"%d",&elo_speed)!=1) { QMessageBox::warning(this,"EloMon","Invalid TTY speed."); exiting=true; return; } arg_found=true; } if(!strcmp(qApp->argv()[i],"-W")) { // Input Device Bug Workaround elo_workaround=true; arg_found=true; } if(!arg_found) { QMessageBox::warning(this,"EloMon",ELO_USAGE); exiting=true; return; } } } setCaption("EloMon"); // // Press Section // QLabel *label=new QLabel("Press",this,"press_label"); label->setGeometry(10,10,100,20); label->setFont(header_font); label->setAlignment(AlignLeft|AlignVCenter); elo_pressx_edit=new QLineEdit(this,"elo_pressx_edit"); elo_pressx_edit->setGeometry(40,30,40,14); elo_pressx_edit->setReadOnly(true); label=new QLabel("X:",this); label->setGeometry(15,30,20,14); label->setFont(label_font); label->setAlignment(AlignRight|AlignVCenter); elo_pressy_edit=new QLineEdit(this,"elo_pressy_edit"); elo_pressy_edit->setGeometry(115,30,40,14); elo_pressy_edit->setReadOnly(true); label=new QLabel("Y:",this); label->setGeometry(90,30,20,14); label->setFont(label_font); label->setAlignment(AlignRight|AlignVCenter); elo_pressz_edit=new QLineEdit(this,"elo_pressz_edit"); elo_pressz_edit->setGeometry(190,30,40,14); elo_pressz_edit->setReadOnly(true); label=new QLabel("Z:",this); label->setGeometry(165,30,20,14); label->setFont(label_font); label->setAlignment(AlignRight|AlignVCenter); // // Release Section // label=new QLabel("Release",this,"release_label"); label->setGeometry(10,55,100,20); label->setFont(header_font); label->setAlignment(AlignLeft|AlignVCenter); elo_releasex_edit=new QLineEdit(this,"elo_releasex_edit"); elo_releasex_edit->setGeometry(40,75,40,14); elo_releasex_edit->setReadOnly(true); label=new QLabel("X:",this); label->setGeometry(15,75,20,14); label->setFont(label_font); label->setAlignment(AlignRight|AlignVCenter); elo_releasey_edit=new QLineEdit(this,"elo_releasey_edit"); elo_releasey_edit->setGeometry(115,75,40,14); elo_releasey_edit->setReadOnly(true); label=new QLabel("Y:",this); label->setGeometry(90,75,20,14); label->setFont(label_font); label->setAlignment(AlignRight|AlignVCenter); elo_releasez_edit=new QLineEdit(this,"elo_releasez_edit"); elo_releasez_edit->setGeometry(190,75,40,14); elo_releasez_edit->setReadOnly(true); label=new QLabel("Z:",this); label->setGeometry(165,75,20,14); label->setFont(label_font); label->setAlignment(AlignRight|AlignVCenter); // // Close Button // QPushButton *button=new QPushButton("&Close",this,"close_button"); button->setGeometry(sizeHint().width()-70,sizeHint().height()-45,60,35); button->setFont(header_font); connect(button,SIGNAL(clicked()),qApp,SLOT(quit())); // // Touch Screen Driver // elo_driver=new EloDriver(this,"elo_controller"); elo_driver->enableWorkaround(elo_workaround); elo_driver->setName(qApp->argv()[qApp->argc()-1]); elo_driver->setSpeed(elo_speed); switch(elo_driver->open()) { case EloDriver::Ok: break; case EloDriver::NoFile: QMessageBox::warning(this,"EloCal","Unable to open specified device!"); exiting=true; return; case EloDriver::NoDevice: QMessageBox::warning(this,"EloCal","Specified device does not exist!"); exiting=true; return; case EloDriver::NotTouchscreen: QMessageBox::warning(this,"EloCal", "Specified device is not a touchscreen!"); exiting=true; return; } connect(elo_driver,SIGNAL(touchPressEvent(TouchEvent *)), this,SLOT(touchPressData(TouchEvent *))); connect(elo_driver,SIGNAL(touchReleaseEvent(TouchEvent *)), this,SLOT(touchReleaseData(TouchEvent *))); }
DeckMon::DeckMon(QString station,unsigned channel, QWidget *parent,const char *name) : QFrame(parent,name) { mon_station=station; mon_channel=channel; setFrameStyle(Box|Raised); setLineWidth(1); setMidLineWidth(2); // // Generate Fonts // QFont small_font=QFont("Helvetica",6,QFont::Bold); small_font.setPixelSize(6); QFont label_font("Helvetica",12,QFont::Normal); label_font.setPixelSize(12); // // Station/Channel // mon_station_label=new QLabel(this,"mon_station_label"); mon_station_label->setFont(label_font); if((mon_channel>0)&&(mon_channel<(MAX_DECKS+1))) { mon_station_label-> setText(QString(). sprintf("%s : %uR",(const char *)mon_station,mon_channel)); } if((mon_channel>128)&&(mon_channel<(MAX_DECKS+129))) { mon_station_label-> setText(QString(). sprintf("%s : %uP",(const char *)mon_station,mon_channel-128)); } // // Monitor Button // mon_monitor_button=new QPushButton(this,"mon_monitor_button"); mon_monitor_button->setFont(small_font); mon_monitor_button->setText(tr("MON")); mon_monitor_palette=new QPalette(QColor(BUTTON_MONITOR_FLASHING_COLOR), backgroundColor()); if((mon_channel>128)&&(mon_channel<(MAX_DECKS+129))) { mon_monitor_button->hide(); } connect(mon_monitor_button,SIGNAL(clicked()), this,SLOT(monitorButtonData())); // // Abort Button // mon_abort_button=new QPushButton(this,"mon_abort_button"); mon_abort_button->setFont(small_font); mon_abort_button->setText(tr("ABORT")); mon_abort_button->setDisabled(true); connect(mon_abort_button,SIGNAL(clicked()),this,SLOT(abortButtonData())); // // Cut // mon_cut_label=new QLabel(this,"mon_cut_label"); mon_cut_label->setFont(label_font); // // Status // mon_status_label=new QLabel(tr("OFFLINE"),this,"mon_status_label"); mon_status_label->setFont(label_font); // // Audio Meter // mon_left_meter=new RDPlayMeter(RDSegMeter::Right,this,"mon_left_meter"); mon_left_meter->setMode(RDSegMeter::Peak); mon_left_meter->setRange(-4600,-800); mon_left_meter->setHighThreshold(-1600); mon_left_meter->setClipThreshold(-1100); mon_left_meter->setLabel(tr("L")); mon_right_meter=new RDPlayMeter(RDSegMeter::Right,this,"mon_right_meter"); mon_right_meter->setMode(RDSegMeter::Peak); mon_right_meter->setRange(-4600,-800); mon_right_meter->setHighThreshold(-1600); mon_right_meter->setClipThreshold(-1100); mon_right_meter->setLabel(tr("R")); }
RDWaveDataDialog::RDWaveDataDialog(const QString &caption,QWidget *parent) : QDialog(parent,"",true) { wave_caption=caption; setCaption(caption+" - "+tr("Edit Cart Label")); // // Fonts // QFont label_font("helvetica",12,QFont::Bold); label_font.setPixelSize(12); // // Dialogs // wave_schedcodes_dialog=new RDSchedCodesDialog(this); // // Title // wave_title_label=new QLabel(tr("Title")+":",this); wave_title_label->setFont(label_font); wave_title_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_title_edit=new QLineEdit(this); wave_title_edit->setMaxLength(255); // // Artist // wave_artist_label=new QLabel(tr("Artist")+":",this); wave_artist_label->setFont(label_font); wave_artist_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_artist_edit=new QLineEdit(this); wave_artist_edit->setMaxLength(255); // // Year // wave_year_label=new QLabel(tr("Year")+":",this); wave_year_label->setFont(label_font); wave_year_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_year_edit=new QLineEdit(this); wave_year_edit->setMaxLength(4); wave_year_edit->setValidator(new QIntValidator(1980,8000,this)); // // Usage // wave_usage_label=new QLabel(tr("Usage")+":",this); wave_usage_label->setFont(label_font); wave_usage_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_usage_box=new QComboBox(this); for(int i=0;i<(int)RDCart::UsageLast;i++) { wave_usage_box->insertItem(RDCart::usageText((RDCart::UsageCode)i)); } // // Scheduler Codes // wave_sched_button=new QPushButton(tr("Scheduler Codes"),this); wave_sched_button->setFont(label_font); connect(wave_sched_button,SIGNAL(clicked()),this,SLOT(schedClickedData())); // // Song ID // wave_songid_label=new QLabel(tr("Song ID")+":",this); wave_songid_label->setFont(label_font); wave_songid_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_songid_edit=new QLineEdit(this); wave_songid_edit->setMaxLength(32); // // Beats Per Minute // wave_bpm_label=new QLabel(tr("Beats per Minute")+":",this); wave_bpm_label->setFont(label_font); wave_bpm_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_bpm_spin=new QSpinBox(this); wave_bpm_spin->setRange(0,300); wave_bpm_spin->setSpecialValueText(tr("Unknown")); // // Album // wave_album_label=new QLabel(tr("Album")+":",this); wave_album_label->setFont(label_font); wave_album_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_album_edit=new QLineEdit(this); wave_album_edit->setMaxLength(255); // // Label // wave_label_label=new QLabel(tr("Label")+":",this); wave_label_label->setFont(label_font); wave_label_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_label_edit=new QLineEdit(this); wave_label_edit->setMaxLength(64); // // Client // wave_client_label=new QLabel(tr("Client")+":",this); wave_client_label->setFont(label_font); wave_client_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_client_edit=new QLineEdit(this); wave_client_edit->setMaxLength(64); // // Agency // wave_agency_label=new QLabel(tr("Agency")+":",this); wave_agency_label->setFont(label_font); wave_agency_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_agency_edit=new QLineEdit(this); wave_agency_edit->setMaxLength(64); // // Publisher // wave_publisher_label=new QLabel(tr("Publisher")+":",this); wave_publisher_label->setFont(label_font); wave_publisher_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_publisher_edit=new QLineEdit(this); wave_publisher_edit->setMaxLength(64); // // Composer // wave_composer_label=new QLabel(tr("Composer")+":",this); wave_composer_label->setFont(label_font); wave_composer_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_composer_edit=new QLineEdit(this); wave_composer_edit->setMaxLength(64); // // Conductor // wave_conductor_label=new QLabel(tr("Conductor")+":",this); wave_conductor_label->setFont(label_font); wave_conductor_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_conductor_edit=new QLineEdit(this); wave_conductor_edit->setMaxLength(64); // // User Defined // wave_userdef_label=new QLabel(tr("User Defined")+":",this); wave_userdef_label->setFont(label_font); wave_userdef_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); wave_userdef_edit=new QLineEdit(this); wave_userdef_edit->setMaxLength(255); // // OK Button // wave_ok_button=new QPushButton(tr("OK"),this); wave_ok_button->setFont(label_font); connect(wave_ok_button,SIGNAL(clicked()),this,SLOT(okData())); // // Cancel Button // wave_cancel_button=new QPushButton(tr("Cancel"),this); wave_cancel_button->setFont(label_font); connect(wave_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); }
MainWidget::MainWidget(QWidget *parent,const char *name) :QWidget(parent,name) { setCaption(tr("RDAlsaConfig")); // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); // // Generate Fonts // QFont font("Helvetica",12,QFont::Normal); font.setPixelSize(12); QFont label_font("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); // // Available Devices // alsa_system_list=new QListBox(this); alsa_system_list->setFont(font); alsa_system_label= new QLabel(alsa_system_list,tr("Available Sound Devices"),this); alsa_system_label->setFont(label_font); alsa_system_label->setAlignment(AlignLeft|AlignVCenter); // // Up Button // alsa_up_button= new RDTransportButton(RDTransportButton::Up,this,"alsa_up_button"); connect(alsa_up_button,SIGNAL(clicked()),this,SLOT(upData())); // // Down Button // alsa_down_button= new RDTransportButton(RDTransportButton::Down,this,"alsa_down_button"); connect(alsa_down_button,SIGNAL(clicked()),this,SLOT(downData())); // // Selected Devices // alsa_config_list=new QListBox(this); alsa_config_list->setFont(font); alsa_config_label=new QLabel(alsa_config_list,tr("Active Sound Devices"),this); alsa_config_label->setFont(label_font); alsa_config_label->setAlignment(AlignLeft|AlignVCenter); // // Save Button // alsa_save_button=new QPushButton(tr("Save"),this); alsa_save_button->setFont(label_font); connect(alsa_save_button,SIGNAL(clicked()),this,SLOT(saveData())); // // Cancel Button // alsa_cancel_button=new QPushButton(tr("Cancel"),this); alsa_cancel_button->setFont(label_font); connect(alsa_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); // // Load Available Devices and Configuration // alsa_alsa=new RDAlsa(); alsa_alsa->load(alsa_filename); LoadList(alsa_system_list,alsa_config_list); // // Daemon Management // if(alsa_manage_daemons) { if(geteuid()!=0) { QMessageBox::warning(this,tr("RDAlsaConfig error"), tr("The \"--manage-daemons\" switch requires root permissions.")); exit(256); } if(system("/etc/init.d/rivendell status")==0) { int r=QMessageBox::warning(this,tr("RDAlsaConfig warning"), tr("Rivendell audio will be interrupted while running this program.\nContinue?"), QMessageBox::Yes,QMessageBox::No); if(r!=QMessageBox::Yes) { exit(256); } } } StopDaemons(); }
RDAddCart::RDAddCart(QString *group,RDCart::Type *type,QString *title, const QString &username,RDSystem *system, QWidget *parent,const char *name) : QDialog(parent,name,true) { QString sql; RDSqlQuery *q; cart_system=system; cart_group=group; cart_type=type; cart_title=title; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); setCaption("Add Cart"); // // Generate Fonts // QFont label_font("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); // // Group // cart_group_box=new QComboBox(this,"cart_group_box"); cart_group_box->setGeometry(145,11,160,19); QLabel *cart_group_label= new QLabel(cart_group_box,tr("&Group:"),this, "cart_group_label"); cart_group_label->setGeometry(10,11,130,19); cart_group_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix); cart_group_label->setFont(label_font); sql=QString().sprintf("select GROUP_NAME from USER_PERMS \ where USER_NAME=\"%s\" order by GROUP_NAME", (const char *)username); q=new RDSqlQuery(sql); while(q->next()) { cart_group_box->insertItem(q->value(0).toString()); if(q->value(0).toString()==*cart_group) { cart_group_box->setCurrentItem(cart_group_box->count()-1); } } delete q; connect(cart_group_box,SIGNAL(activated(const QString &)), this,SLOT(groupActivatedData(const QString &))); // // Cart Number // cart_number_edit=new QLineEdit(this,"cart_number_edit"); cart_number_edit->setGeometry(145,32,60,19); cart_number_edit->setMaxLength(6); QIntValidator *validator=new QIntValidator(this,"validator"); validator->setRange(1,999999); cart_number_edit->setValidator(validator); QLabel *cart_number_label= new QLabel(cart_number_edit,tr("&New Cart Number:"),this, "cart_number_label"); cart_number_label->setGeometry(10,32,130,19); cart_number_label->setFont(label_font); cart_number_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix); // // Cart Type // cart_type_box=new QComboBox(this,"cart_type_box"); cart_type_box->setGeometry(145,53,100,19); QLabel *cart_type_label= new QLabel(cart_type_box,tr("&New Cart Type:"),this, "cart_type_label"); cart_type_label->setGeometry(10,53,130,19); cart_type_label->setFont(label_font); cart_type_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix); if((*cart_type==RDCart::All)||(*cart_type==RDCart::Audio)) { cart_type_box->insertItem(tr("Audio")); } if((*cart_type==RDCart::All)||(*cart_type==RDCart::Macro)) { cart_type_box->insertItem(tr("Macro")); } if(*cart_type==RDCart::All) { sql= QString().sprintf("select DEFAULT_CART_TYPE from GROUPS\ where NAME=\"%s\"", (const char *)*cart_group); q=new RDSqlQuery(sql); if(q->first()) { cart_type_box->setCurrentItem(q->value(0).toUInt()-1); } delete q; }
MainWidget::MainWidget(QWidget *parent) : QWidget(parent) { QString hostname="localhost"; unsigned port=LPCORE_CONNECTION_TCP_PORT; QString username; QString password; bool track_state=false; bool ok=false; // // Fonts // QFont label_font("helvetica",12,QFont::Bold); label_font.setPixelSize(12); // // Read Command Options // LPCmdSwitch *cmd= new LPCmdSwitch(qApp->argc(),qApp->argv(),"lpcore",LPCORE_USAGE); for(unsigned i=0;i<cmd->keys();i++) { if(cmd->key(i)=="--hostname") { hostname=cmd->value(i); cmd->setProcessed(i,true); } if(cmd->key(i)=="--port") { port=cmd->value(i).toUInt(&ok); if((!ok)||(port>0xFFFF)) { fprintf(stderr,"invalid port value\n"); exit(256); } cmd->setProcessed(i,true); } if(cmd->key(i)=="--username") { username=cmd->value(i); cmd->setProcessed(i,true); } if(cmd->key(i)=="--password") { password=cmd->value(i); cmd->setProcessed(i,true); } if(cmd->key(i)=="--track-state") { track_state=true; cmd->setProcessed(i,true); } if(!cmd->processed(i)) { fprintf(stderr,"unknown option \"%s\"\n", (const char *)cmd->key(i).toAscii()); exit(256); } } delete cmd; // // Open Syslog // openlog("lpcore",LOG_PERROR,LOG_USER); // // Connection // lp_connection=new LPConnection(track_state,this); connect(lp_connection,SIGNAL(messageReceived(const LPMessage &)), this,SLOT(messageReceivedData(const LPMessage &))); connect(lp_connection,SIGNAL(watchdogStateChanged(bool)), this,SLOT(watchdogStateChangedData(bool))); connect(lp_connection,SIGNAL(loggedIn(LPConnection::Result)), this,SLOT(loggedInData(LPConnection::Result))); connect(lp_connection, SIGNAL(socketError(QAbstractSocket::SocketError,const QString &)), this, SLOT(socketErrorData(QAbstractSocket::SocketError,const QString &))); // // Context Selector // lp_context_label=new QLabel(tr("Context")+":",this); lp_context_label->setFont(label_font); lp_context_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); lp_context_box=new QComboBox(this); lp_context_box->insertItem(-1,tr("Global")); lp_context_box->insertItem(-1,tr("Isolated")); lp_context_box->setCurrentIndex(1); connect(lp_context_box,SIGNAL(activated(int)), this,SLOT(contextChangedData(int))); lp_clear_button=new QPushButton(tr("Clear"),this); lp_clear_button->setFont(label_font); // // Send Widget // lp_send_edit=new QLineEdit(this); lp_send_edit->setDisabled(true); connect(lp_send_edit,SIGNAL(returnPressed()),this,SLOT(returnPressedData())); // // Receive Widget // lp_recv_edit=new QTextEdit(this); lp_recv_edit->setReadOnly(true); connect(lp_clear_button,SIGNAL(clicked()),lp_recv_edit,SLOT(clear())); contextChangedData(lp_context_box->currentIndex()); lp_connection->connectToHost(hostname,port,username,password); UpdateWindowTitle(); }
MyFrame::MyFrame() : wxFrame(NULL, wxID_ANY, wxT("wxRibbon Sample Application"), wxDefaultPosition, wxSize(800, 600), wxDEFAULT_FRAME_STYLE) { m_ribbon = new wxRibbonBar(this,-1,wxDefaultPosition, wxDefaultSize, wxRIBBON_BAR_FLOW_HORIZONTAL | wxRIBBON_BAR_SHOW_PAGE_LABELS | wxRIBBON_BAR_SHOW_PANEL_EXT_BUTTONS | wxRIBBON_BAR_SHOW_TOGGLE_BUTTON | wxRIBBON_BAR_SHOW_HELP_BUTTON ); { wxRibbonPage* home = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Examples"), ribbon_xpm); wxRibbonPanel *toolbar_panel = new wxRibbonPanel(home, wxID_ANY, wxT("Toolbar"), wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_NO_AUTO_MINIMISE | wxRIBBON_PANEL_EXT_BUTTON); wxRibbonToolBar *toolbar = new wxRibbonToolBar(toolbar_panel, ID_MAIN_TOOLBAR); toolbar->AddToggleTool(wxID_JUSTIFY_LEFT, align_left_xpm); toolbar->AddToggleTool(wxID_JUSTIFY_CENTER , align_center_xpm); toolbar->AddToggleTool(wxID_JUSTIFY_RIGHT, align_right_xpm); toolbar->AddSeparator(); toolbar->AddHybridTool(wxID_NEW, wxArtProvider::GetBitmap(wxART_NEW, wxART_OTHER, wxSize(16, 15))); toolbar->AddTool(wxID_OPEN, wxArtProvider::GetBitmap(wxART_FILE_OPEN, wxART_OTHER, wxSize(16, 15)), "Open something"); toolbar->AddTool(wxID_SAVE, wxArtProvider::GetBitmap(wxART_FILE_SAVE, wxART_OTHER, wxSize(16, 15)), "Save something"); toolbar->AddTool(wxID_SAVEAS, wxArtProvider::GetBitmap(wxART_FILE_SAVE_AS, wxART_OTHER, wxSize(16, 15)), "Save something as ..."); toolbar->EnableTool(wxID_OPEN, false); toolbar->EnableTool(wxID_SAVE, false); toolbar->EnableTool(wxID_SAVEAS, false); toolbar->AddSeparator(); toolbar->AddDropdownTool(wxID_UNDO, wxArtProvider::GetBitmap(wxART_UNDO, wxART_OTHER, wxSize(16, 15))); toolbar->AddDropdownTool(wxID_REDO, wxArtProvider::GetBitmap(wxART_REDO, wxART_OTHER, wxSize(16, 15))); toolbar->AddSeparator(); toolbar->AddTool(wxID_ANY, wxArtProvider::GetBitmap(wxART_REPORT_VIEW, wxART_OTHER, wxSize(16, 15))); toolbar->AddTool(wxID_ANY, wxArtProvider::GetBitmap(wxART_LIST_VIEW, wxART_OTHER, wxSize(16, 15))); toolbar->AddSeparator(); toolbar->AddHybridTool(ID_POSITION_LEFT, position_left_xpm, "Align ribbonbar vertically\non the left\nfor demonstration purposes"); toolbar->AddHybridTool(ID_POSITION_TOP, position_top_xpm, "Align the ribbonbar horizontally\nat the top\nfor demonstration purposes"); toolbar->AddSeparator(); toolbar->AddHybridTool(wxID_PRINT, wxArtProvider::GetBitmap(wxART_PRINT, wxART_OTHER, wxSize(16, 15)), "This is the Print button tooltip\ndemonstrating a tooltip"); toolbar->SetRows(2, 3); wxRibbonPanel *selection_panel = new wxRibbonPanel(home, wxID_ANY, wxT("Selection"), wxBitmap(selection_panel_xpm)); wxRibbonButtonBar *selection = new wxRibbonButtonBar(selection_panel); selection->AddButton(ID_SELECTION_EXPAND_V, wxT("Expand Vertically"), wxBitmap(expand_selection_v_xpm), "This is a tooltip for Expand Vertically\ndemonstrating a tooltip"); selection->AddButton(ID_SELECTION_EXPAND_H, wxT("Expand Horizontally"), wxBitmap(expand_selection_h_xpm), wxEmptyString); selection->AddButton(ID_SELECTION_CONTRACT, wxT("Contract"), wxBitmap(auto_crop_selection_xpm), wxBitmap(auto_crop_selection_small_xpm)); wxRibbonPanel *shapes_panel = new wxRibbonPanel(home, wxID_ANY, wxT("Shapes"), wxBitmap(circle_small_xpm)); wxRibbonButtonBar *shapes = new wxRibbonButtonBar(shapes_panel); shapes->AddButton(ID_CIRCLE, wxT("Circle"), wxBitmap(circle_xpm), wxBitmap(circle_small_xpm), wxNullBitmap, wxNullBitmap, wxRIBBON_BUTTON_NORMAL, "This is a tooltip for the circle button\ndemonstrating another tooltip"); shapes->AddButton(ID_CROSS, wxT("Cross"), wxBitmap(cross_xpm), wxEmptyString); shapes->AddHybridButton(ID_TRIANGLE, wxT("Triangle"), wxBitmap(triangle_xpm)); shapes->AddButton(ID_SQUARE, wxT("Square"), wxBitmap(square_xpm), wxEmptyString); shapes->AddDropdownButton(ID_POLYGON, wxT("Other Polygon"), wxBitmap(hexagon_xpm), wxEmptyString); wxRibbonPanel *sizer_panel = new wxRibbonPanel(home, wxID_ANY, wxT("Panel with Sizer"), wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_DEFAULT_STYLE); wxArrayString as; as.Add("Item 1 using a box sizer now"); as.Add("Item 2 using a box sizer now"); wxComboBox* sizer_panelcombo = new wxComboBox(sizer_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, as, wxCB_READONLY); wxComboBox* sizer_panelcombo2 = new wxComboBox(sizer_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, as, wxCB_READONLY); sizer_panelcombo->Select(0); sizer_panelcombo2->Select(1); sizer_panelcombo->SetMinSize(wxSize(150, -1)); sizer_panelcombo2->SetMinSize(wxSize(150, -1)); //not using wxWrapSizer(wxHORIZONTAL) as it reports an incorrect min height wxSizer* sizer_panelsizer = new wxBoxSizer(wxVERTICAL); sizer_panelsizer->AddStretchSpacer(1); sizer_panelsizer->Add(sizer_panelcombo, 0, wxALL|wxEXPAND, 2); sizer_panelsizer->Add(sizer_panelcombo2, 0, wxALL|wxEXPAND, 2); sizer_panelsizer->AddStretchSpacer(1); sizer_panel->SetSizer(sizer_panelsizer); wxFont label_font(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_LIGHT); m_bitmap_creation_dc.SetFont(label_font); wxRibbonPage* scheme = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Appearance"), eye_xpm); m_ribbon->GetArtProvider()->GetColourScheme(&m_default_primary, &m_default_secondary, &m_default_tertiary); wxRibbonPanel *provider_panel = new wxRibbonPanel(scheme, wxID_ANY, wxT("Art"), wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_NO_AUTO_MINIMISE); wxRibbonButtonBar *provider_bar = new wxRibbonButtonBar(provider_panel, wxID_ANY); provider_bar->AddButton(ID_DEFAULT_PROVIDER, wxT("Default Provider"), wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, wxSize(32, 32))); provider_bar->AddButton(ID_AUI_PROVIDER, wxT("AUI Provider"), aui_style_xpm); provider_bar->AddButton(ID_MSW_PROVIDER, wxT("MSW Provider"), msw_style_xpm); wxRibbonPanel *primary_panel = new wxRibbonPanel(scheme, wxID_ANY, wxT("Primary Colour"), colours_xpm); m_primary_gallery = PopulateColoursPanel(primary_panel, m_default_primary, ID_PRIMARY_COLOUR); wxRibbonPanel *secondary_panel = new wxRibbonPanel(scheme, wxID_ANY, wxT("Secondary Colour"), colours_xpm); m_secondary_gallery = PopulateColoursPanel(secondary_panel, m_default_secondary, ID_SECONDARY_COLOUR); } { wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("UI Updated"), ribbon_xpm); wxRibbonPanel *panel = new wxRibbonPanel(page, wxID_ANY, wxT("Enable/Disable"), ribbon_xpm); wxRibbonButtonBar *bar = new wxRibbonButtonBar(panel, wxID_ANY); bar->AddButton(ID_DISABLED, wxT("Disabled"), ribbon_xpm); bar->AddButton(ID_ENABLE, wxT("Enable"), ribbon_xpm); bar->AddButton(ID_DISABLE, wxT("Disable"), ribbon_xpm); bar->AddButton(ID_UI_ENABLE_UPDATED, wxT("Enable UI updated"), ribbon_xpm); bar->EnableButton(ID_DISABLED, false); m_bEnabled = true; panel = new wxRibbonPanel(page, wxID_ANY, wxT("Toggle"), ribbon_xpm); bar = new wxRibbonButtonBar(panel, wxID_ANY); bar->AddButton(ID_CHECK, wxT("Toggle"), ribbon_xpm); bar->AddToggleButton(ID_UI_CHECK_UPDATED, wxT("Toggled UI updated"), ribbon_xpm); m_bChecked = true; panel = new wxRibbonPanel(page, wxID_ANY, wxT("Change text"), ribbon_xpm); bar = new wxRibbonButtonBar(panel, wxID_ANY); bar->AddButton(ID_CHANGE_TEXT1, wxT("One"), ribbon_xpm); bar->AddButton(ID_CHANGE_TEXT2, wxT("Two"), ribbon_xpm); bar->AddButton(ID_UI_CHANGE_TEXT_UPDATED, wxT("Zero"), ribbon_xpm); //Also set the general disabled text colour: wxRibbonArtProvider* artProvider = m_ribbon->GetArtProvider(); wxColour tColour = artProvider->GetColor(wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR); artProvider->SetColor(wxRIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR, tColour.MakeDisabled()); } new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Empty Page"), empty_xpm); { wxRibbonPage* page = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Another Page"), empty_xpm); wxRibbonPanel *panel = new wxRibbonPanel(page, wxID_ANY, wxT("Page manipulation"), ribbon_xpm); wxRibbonButtonBar *bar = new wxRibbonButtonBar(panel, wxID_ANY); bar->AddButton(ID_REMOVE_PAGE, wxT("Remove"), wxArtProvider::GetBitmap(wxART_DELETE, wxART_OTHER, wxSize(24, 24))); bar->AddButton(ID_HIDE_PAGES, wxT("Hide Pages"), ribbon_xpm); bar->AddButton(ID_SHOW_PAGES, wxT("Show Pages"), ribbon_xpm); } new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Highlight Page"), empty_xpm); m_ribbon->AddPageHighlight(m_ribbon->GetPageCount()-1); m_ribbon->Realize(); m_logwindow = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_LEFT | wxTE_BESTWRAP | wxBORDER_NONE); m_togglePanels = new wxToggleButton(this, ID_TOGGLE_PANELS, "&Toggle panels"); m_togglePanels->SetValue(true); wxSizer *s = new wxBoxSizer(wxVERTICAL); s->Add(m_ribbon, 0, wxEXPAND); s->Add(m_logwindow, 1, wxEXPAND); s->Add(m_togglePanels, wxSizerFlags().Border()); SetSizer(s); }
MainWidget::MainWidget(QWidget *parent) :Q3MainWindow(parent) { // // Set Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Create Fonts // QFont font("Helvetica",10,QFont::Normal); font.setPixelSize(10); setFont(font); QFont main_font("Helvetica",12,QFont::Bold); main_font.setPixelSize(12); QFont label_font("Helvetica",10,QFont::Bold); label_font.setPixelSize(10); // // Create And Set Icon // rivendell_map=new QPixmap(rivendell_xpm); setIcon(*rivendell_map); setCaption(QString("RMLSend")+" v"+VERSION+" - "+tr("Macro Command Utility")); host=new QLineEdit(this,"host"); host->setGeometry(80,10,180,25); host->setFont(main_font); QLabel *label=new QLabel(host,"Sent To:",this,"host_label"); label->setGeometry(10,16,65,14); label->setFont(label_font); label->setAlignment(Qt::AlignRight); for(unsigned i=0;i<rdcmdswitch->keys();i++) { if(rdcmdswitch->key(i)=="--to-host") { rdcmdswitch->setProcessed(i,true); host->setText(rdcmdswitch->value(i)); } } port_box=new QComboBox(this,"port_box"); port_box->setGeometry(305,10,130,25); port_box->setEditable(false); label=new QLabel(port_box,"Dest:",this,"port_label"); label->setGeometry(270,16,30,14); label->setFont(label_font); label->setAlignment(Qt::AlignRight); port_box->insertItem(tr("RML")); port_box->insertItem(tr("RML (no echo)")); port_box->insertItem(tr("Set Port")); port_box->setCurrentItem(1); connect(port_box,SIGNAL(activated(int)),this,SLOT(destChangedData(int))); port_edit=new QLineEdit(this,"port_edit"); port_edit->setGeometry(sizeHint().width()-60,10,50,25); port_edit->setFont(main_font); port_edit->setDisabled(true); port_edit_label=new QLabel(port_edit,tr("UDP Port:"),this,"port_edit_label"); port_edit_label->setGeometry(sizeHint().width()-130,16,65,14); port_edit_label->setFont(label_font); port_edit_label->setAlignment(Qt::AlignRight); port_edit_label->setDisabled(true); command=new QLineEdit(this,"command"); command->setGeometry(80,40,sizeHint().width()-90,25); command->setFont(main_font); label=new QLabel(command,tr("Command:"),this,"host_label"); label->setGeometry(10,46,65,14); label->setFont(label_font); label->setAlignment(Qt::AlignRight); response=new QLineEdit(this,"response"); response->setGeometry(80,70,sizeHint().width()-90,25); response->setFont(main_font); response_label=new QLabel(response,tr("Response:"),this,"response_label"); response_label->setGeometry(10,76,65,14); response_label->setFont(label_font); response_label->setAlignment(Qt::AlignRight); send=new QPushButton(tr("&Send Command"),this,"send"); send->setGeometry(10,sizeHint().height()-50,120,40); send->setFont(main_font); connect(send,SIGNAL(clicked()),this,SLOT(sendCommand())); quit=new QPushButton("&Quit",this,"quit"); quit->setGeometry(sizeHint().width()-80,sizeHint().height()-50,70,40); quit->setFont(main_font); quit->setDefault(true); connect(quit,SIGNAL(clicked()),qApp,SLOT(quit())); udp_command=new Q3SocketDevice(Q3SocketDevice::Datagram); udp_response=new Q3SocketDevice(Q3SocketDevice::Datagram); udp_response->bind(QHostAddress(),RD_RML_REPLY_PORT); udp_response->setBlocking(false); timer=new QTimer(this,"timer"); connect(timer,SIGNAL(timeout()),this,SLOT(readResponse())); countdown=-1; timer->start(100); // // Populate Data // bool ok; unsigned port; for(unsigned i=0;i<rdcmdswitch->keys();i++) { if(rdcmdswitch->key(i)=="--to-port") { rdcmdswitch->setProcessed(i,true); port=rdcmdswitch->value(i).toUInt(&ok); if(ok&&(port<0xFFFF)) { switch(rdcmdswitch->value(i).toUInt()) { case RD_RML_ECHO_PORT: port_box->setCurrentItem(0); break; case RD_RML_NOECHO_PORT: port_box->setCurrentItem(1); break; default: port_box->setCurrentItem(2); port_edit->setText(rdcmdswitch->value(i)); break; } } } } destChangedData(port_box->currentItem()); }
MainWidget::MainWidget(QWidget *parent,const char *name) : QMainWindow(parent,name) { key_ysize=70; // // Read Command Options // RDConfig *config=new RDConfig(); QString map_filename=config->filename(); delete config; RDCmdSwitch *cmd= new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdsoftkeys",RDSOFTKEYS_USAGE); for(unsigned i=0;i<cmd->keys();i++) { if(cmd->key(i)=="--map-file") { map_filename=cmd->value(i); } } delete cmd; // // Generate Font // QFont font("Helvetica",12,QFont::Bold); font.setPixelSize(12); QFont label_font("Helvetica",18,QFont::Bold); label_font.setPixelSize(18); setCaption(QString("RDSoftKeys")+" v"+VERSION); // // Create And Set Icon // key_icon_map=new QPixmap(rivendell_xpm); setIcon(*key_icon_map); // // RML Send Socket // key_socket=new QSocketDevice(QSocketDevice::Datagram); // // Create Buttons // QPushButton *button; QString rmlcmd; int n=0; QString color_name; QColor color; QString str1; QString str2; int h=0; int s=0; int v=0; QSignalMapper *mapper=new QSignalMapper(this); connect(mapper,SIGNAL(mapped(int)),this,SLOT(buttonData(int))); RDProfile *profile=new RDProfile(); profile->setSource(map_filename); key_columns= profile->intValue("SoftKeys","Columns",RDSOFTKEYS_DEFAULT_COLUMNS); unsigned col=0; unsigned row=0; while(!(rmlcmd=profile->stringValue("SoftKeys",QString(). sprintf("Command%d",n+1),"")).isEmpty()) { for(unsigned i=0;i<rmlcmd.length();i++) { if(rmlcmd.at(i)==':') { key_macros.push_back(rmlcmd.right(rmlcmd.length()-(i+1))); key_addrs.push_back(rmlcmd.left(i)); button=new QPushButton(this); button->setGeometry(10+90*col,10+60*row,80,50); button-> setText(WrapText(button,profile-> stringValue("SoftKeys",QString(). sprintf("Legend%d",n+1), QString().sprintf("Button %d",n+1)))); if(!(color_name=profile->stringValue("SoftKeys", QString().sprintf("Color%d",n+1),"")). isEmpty()) { color=QColor(color_name); QPalette pal=QPalette(color,backgroundColor()); color.getHsv(&h,&s,&v); if((h>180)&&(h<300)) { v=255; } else { if(v<168) { v=255; } else { v=0; } } s=0; color.setHsv(h,s,v); pal.setColor(QPalette::Active,QColorGroup::ButtonText,color); pal.setColor(QPalette::Inactive,QColorGroup::ButtonText,color); button->setPalette(pal); } mapper->setMapping(button,n); connect(button,SIGNAL(clicked()),mapper,SLOT(map())); if(++col==key_columns) { col=0; row++; key_ysize+=60; } } } n++; } if((key_macros.size()%key_columns)==0) { key_ysize-=60; } // // Set Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); }
DeckMon::DeckMon(QString station,unsigned channel,QWidget *parent) : QFrame(parent) { mon_station=station; mon_channel=channel; setFrameStyle(Box|Raised); setLineWidth(1); setMidLineWidth(2); // // Generate Fonts // QFont small_font=QFont("Helvetica",6,QFont::Bold); small_font.setPixelSize(6); QFont label_font("Helvetica",12,QFont::Normal); label_font.setPixelSize(12); QFont event_font("Helvetica",12,QFont::Bold); event_font.setPixelSize(12); // // Generate Palettes // mon_red_palette=palette(); mon_red_palette.setColor(QColorGroup::Background,Qt::darkRed); mon_red_palette.setColor(QColorGroup::Foreground,Qt::white); mon_dark_palette=palette(); mon_dark_palette. setColor(QColorGroup::Background,palette().color(QPalette::Active,QColorGroup::Mid)); mon_dark_palette.setColor(QColorGroup::Foreground,Qt::white); // // Station/Channel // mon_station_label=new QLabel(this); mon_station_label->setFont(label_font); if((mon_channel>0)&&(mon_channel<(MAX_DECKS+1))) { mon_station_label-> setText(QString(). sprintf("%s : %uR",(const char *)mon_station,mon_channel)); } if((mon_channel>128)&&(mon_channel<(MAX_DECKS+129))) { mon_station_label-> setText(QString(). sprintf("%s : %uP",(const char *)mon_station,mon_channel-128)); } // // Monitor Button // mon_monitor_button=new QPushButton(this); mon_monitor_button->setFont(small_font); mon_monitor_button->setText(tr("MON")); mon_monitor_palette=new QPalette(QColor(BUTTON_MONITOR_FLASHING_COLOR), backgroundColor()); if((mon_channel>128)&&(mon_channel<(MAX_DECKS+129))) { mon_monitor_button->hide(); } connect(mon_monitor_button,SIGNAL(clicked()), this,SLOT(monitorButtonData())); // // Abort Button // mon_abort_button=new QPushButton(this); mon_abort_button->setFont(small_font); mon_abort_button->setText(tr("ABORT")); mon_abort_button->setDisabled(true); connect(mon_abort_button,SIGNAL(clicked()),this,SLOT(abortButtonData())); // // Cut // mon_cut_label=new QLabel(this); mon_cut_label->setFont(label_font); // // Event Indicator // mon_event_label=new QLabel(this); mon_event_label->setFont(event_font); mon_event_label->setAlignment(Qt::AlignCenter); mon_event_label->setFrameStyle(QFrame::Panel|QFrame::Sunken); mon_event_label->setPalette(mon_dark_palette); mon_event_label->setText("--"); mon_event_timer=new QTimer(this); connect(mon_event_timer,SIGNAL(timeout()),this,SLOT(eventResetData())); // // Status // mon_status_label=new QLabel(tr("OFFLINE"),this); mon_status_label->setFont(label_font); // // Audio Meter // mon_left_meter=new RDPlayMeter(RDSegMeter::Right,this); mon_left_meter->setMode(RDSegMeter::Peak); mon_left_meter->setRange(-4600,-800); mon_left_meter->setHighThreshold(-1600); mon_left_meter->setClipThreshold(-1100); mon_left_meter->setLabel(tr("L")); mon_right_meter=new RDPlayMeter(RDSegMeter::Right,this); mon_right_meter->setMode(RDSegMeter::Peak); mon_right_meter->setRange(-4600,-800); mon_right_meter->setHighThreshold(-1600); mon_right_meter->setClipThreshold(-1100); mon_right_meter->setLabel(tr("R")); }
ServerDialog::ServerDialog(QWidget *parent) : QDialog(parent) { // // Fonts // QFont label_font("helvetica",14,QFont::Bold); label_font.setPixelSize(14); setWindowTitle("GlassGui - "+tr("Server Settings")); // // Server Type // srv_server_type_label=new QLabel(tr("Type")+":",this); srv_server_type_label->setFont(label_font); srv_server_type_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); srv_server_type_box=new ComboBox(this); for(int i=0; i<Connector::LastServer; i++) { srv_server_type_box-> insertItem(i,Connector::serverTypeText((Connector::ServerType)i),i); } connect(srv_server_type_box,SIGNAL(activated(int)), this,SLOT(serverTypeChanged(int))); // // Verbose Logging // srv_verbose_check=new QCheckBox(this); srv_verbose_label=new QLabel(tr("Enable verbose logging"),this); srv_verbose_label->setFont(label_font); srv_verbose_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); // // Server Location // srv_server_location_label=new QLabel(tr("Server URL")+":",this); srv_server_location_label->setFont(label_font); srv_server_location_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); srv_server_location_edit=new QLineEdit(this); connect(srv_server_location_edit,SIGNAL(textEdited(const QString &)), this,SLOT(locationChanged(const QString &))); // // Server Username // srv_server_username_label=new QLabel(tr("User Name")+":",this); srv_server_username_label->setFont(label_font); srv_server_username_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); srv_server_username_edit=new QLineEdit(this); // // Server Password // srv_server_password_label=new QLabel(tr("Password")+":",this); srv_server_password_label->setFont(label_font); srv_server_password_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); srv_server_password_edit=new QLineEdit(this); srv_server_password_edit->setEchoMode(QLineEdit::Password); // // Server Script Up // srv_server_script_up_label=new QLabel(tr("CONNECTED Script")+":",this); srv_server_script_up_label->setFont(label_font); srv_server_script_up_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); srv_server_script_up_edit=new QLineEdit(this); // // Server Script Down // srv_server_script_down_label=new QLabel(tr("DISCONNECTED Script")+":",this); srv_server_script_down_label->setFont(label_font); srv_server_script_down_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); srv_server_script_down_edit=new QLineEdit(this); // // Close Button // srv_close_button=new QPushButton(tr("Close"),this); srv_close_button->setFont(label_font); connect(srv_close_button,SIGNAL(clicked()),this,SLOT(hide())); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); setMinimumSize(sizeHint()); }