Widget::Widget() : QWidget(), m_label(new QLabel) { setLayout(new QVBoxLayout); layout()->addWidget(m_label); setWindowFlags(Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint | Qt::WindowDoesNotAcceptFocus | Qt::Tool); setAttribute(Qt::WA_TranslucentBackground); m_label->setTextInteractionFlags(Qt::TextSelectableByKeyboard); m_label->setTextFormat(Qt::PlainText); m_label->setWordWrap(true); layout()->setMargin(0); setMaximumWidth(1000); setMaximumHeight(1000); setMinimumWidth(500); setMinimumHeight(128); m_label->setAlignment(Qt::AlignLeft | Qt::AlignTop); m_label->setMargin(5); QFont font; font.setPixelSize(15); setFont(font); //connect(qApp->clipboard(), &QClipboard::dataChanged, this, &Widget::onClipboardUpdated); connect(qApp->clipboard(), &QClipboard::dataChanged, &m_updateTimer, [=]() { m_updateTimer.start(10); }); connect(&m_updateTimer, &QTimer::timeout, this, &Widget::onClipboardUpdated); m_updateTimer.setSingleShot(true); m_timer.setSingleShot(true); connect(&m_timer, &QTimer::timeout, this, &QWidget::hide); QString stylesheet( "QLabel {\n" " border: 3px solid white;\n" " background-color: rgba(0, 0, 0, 128);\n" " selection-color: black;\n" " selection-background-color: white;\n" "}\n" ); const QString configLocation = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); QDir configDir(configLocation); if (!configDir.exists()) { configDir.mkpath(configLocation); } QString stylePath = configDir.absoluteFilePath("pastenotifier.qss"); QFile styleFile(stylePath); if (styleFile.exists()) { if (styleFile.open(QIODevice::ReadOnly)) { qDebug() << "Loading stylesheet" << stylePath; stylesheet = QString::fromLocal8Bit(styleFile.readAll()); } else { qWarning() << "Unable to open qss file:" << stylePath << styleFile.errorString(); } } else { if (styleFile.open(QIODevice::WriteOnly)) { styleFile.write(stylesheet.toUtf8()); } else { qWarning() << "Unable to open qss file for writing:" << stylePath << styleFile.errorString(); } } QAction *showAction = new QAction(this); connect(showAction, &QAction::triggered, [=](){ setWindowOpacity(1); show(); m_timer.start(5000); }); showAction->setObjectName("showpastenotifier"); KGlobalAccel::setGlobalShortcut(showAction, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_V)); setStyleSheet(stylesheet); onClipboardUpdated(); }
EditPerms::EditPerms(QString object_name,ObjectType type, QWidget *parent,const char *name) : QDialog(parent,name,true) { QString sql; RDSqlQuery *q; QString str; sel_type=type; sel_name=object_name; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); str=QString(tr("Service Associations")); setCaption(QString().sprintf("%s - %s", (const char *)sel_name,(const char *)str)); // // Create Fonts // QFont font=QFont("Helvetica",12,QFont::Bold); font.setPixelSize(12); // // Services Selector // svc_object_sel=new RDListSelector(this,"svc_object_sel"); svc_object_sel->setGeometry(10,10,380,130); svc_object_sel->sourceSetLabel(tr("Available Services")); svc_object_sel->destSetLabel(tr("Enabled Services")); // // Ok Button // QPushButton *ok_button=new QPushButton(this,"ok_button"); ok_button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); ok_button->setDefault(true); ok_button->setFont(font); ok_button->setText(tr("&OK")); connect(ok_button,SIGNAL(clicked()),this,SLOT(okData())); // // Cancel Button // QPushButton *cancel_button=new QPushButton(this,"cancel_button"); cancel_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60, 80,50); cancel_button->setFont(font); cancel_button->setText(tr("&Cancel")); connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); // // Populate Fields // switch(sel_type) { case EditPerms::ObjectEvent: object_type="EVENT"; break; case EditPerms::ObjectClock: object_type="CLOCK"; break; } // FIXME: should this be filtered based on the user if usersec is enabled? sql=QString().sprintf("select SERVICE_NAME from %s_PERMS \ where %s_NAME=\"%s\"", (const char *)object_type, (const char *)object_type, (const char *)object_name); q=new RDSqlQuery(sql); while(q->next()) { svc_object_sel->destInsertItem(q->value(0).toString()); } delete q; sql=QString().sprintf("select NAME from SERVICES"); q=new RDSqlQuery(sql); while(q->next()) { if(svc_object_sel->destFindItem(q->value(0).toString())==0) { svc_object_sel->sourceInsertItem(q->value(0).toString()); } } delete q; }
StartupView::StartupView( QWidget * parent ) : QWidget( parent ) { m_templateListModel = std::shared_ptr<TemplateListModel>( new TemplateListModel() ); setStyleSheet("openstudio--StartupView { background: #E6E6E6; }"); #ifdef Q_OS_MAC setWindowFlags(Qt::FramelessWindowHint); #else setWindowFlags(Qt::CustomizeWindowHint); #endif auto recentProjectsView = new QWidget(); recentProjectsView->setStyleSheet("QWidget { background: #F2F2F2; }"); auto recentProjectsLayout = new QVBoxLayout(); recentProjectsLayout->setContentsMargins(10,10,10,10); QLabel * recentProjectsLabel = new QLabel("Recent Projects"); recentProjectsLabel->setStyleSheet("QLabel { font: bold }"); recentProjectsLayout->addWidget(recentProjectsLabel,0,Qt::AlignTop); recentProjectsView->setLayout(recentProjectsLayout); auto openButton = new QToolButton(); openButton->setText("Open File"); openButton->setStyleSheet("QToolButton { font: bold; }"); openButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QIcon openIcon(":/images/open_file.png"); openButton->setIcon(openIcon); openButton->setIconSize(QSize(40,40)); connect(openButton, &QToolButton::clicked, this, &StartupView::openClicked); auto importButton = new QToolButton(); importButton->setText("Import Idf"); importButton->setStyleSheet("QToolButton { font: bold; }"); importButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QIcon importIcon(":/images/import_file.png"); importButton->setIcon(importIcon); importButton->setIconSize(QSize(40,40)); connect(importButton, &QToolButton::clicked, this, &StartupView::importClicked); /* QToolButton * importSDDButton = new QToolButton(); importSDDButton->setText("Import SDD"); importSDDButton->setStyleSheet("QToolButton { font: bold; }"); importSDDButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QIcon importSDDIcon(":/images/import_file.png"); importSDDButton->setIcon(importSDDIcon); importSDDButton->setIconSize(QSize(40,40)); connect(importSDDButton, &QToolButton::clicked, this, &StartupView::importSDDClicked); */ auto projectChooserView = new QWidget(); projectChooserView->setFixedWidth(238); projectChooserView->setStyleSheet("QWidget { background: #F2F2F2; }"); auto projectChooserLayout = new QVBoxLayout(); projectChooserLayout->setContentsMargins(10,10,10,10); QLabel * projectChooserLabel = new QLabel("Create New From Template"); projectChooserLabel->setStyleSheet("QLabel { font: bold }"); projectChooserLayout->addWidget(projectChooserLabel,0,Qt::AlignTop); m_listView = new QListView(); m_listView->setViewMode(QListView::IconMode); m_listView->setModel(m_templateListModel.get()); m_listView->setFocusPolicy(Qt::NoFocus); m_listView->setFlow(QListView::LeftToRight); m_listView->setUniformItemSizes(true); m_listView->setSelectionMode(QAbstractItemView::SingleSelection); projectChooserLayout->addWidget(m_listView); projectChooserView->setLayout(projectChooserLayout); m_projectDetailView = new QWidget(); m_projectDetailView->setStyleSheet("QWidget { background: #F2F2F2; }"); auto projectDetailLayout = new QVBoxLayout(); projectDetailLayout->setContentsMargins(10,10,10,10); m_projectDetailView->setLayout(projectDetailLayout); auto footerView = new QWidget(); footerView->setObjectName("FooterView"); footerView->setStyleSheet("QWidget#FooterView { background: #E6E6E6; }"); footerView->setMaximumHeight(50); footerView->setMinimumHeight(50); auto cancelButton = new QPushButton(); cancelButton->setObjectName("StandardGrayButton"); cancelButton->setMinimumSize(QSize(99,28)); #ifdef OPENSTUDIO_PLUGIN cancelButton->setText("Cancel"); connect(cancelButton, &QPushButton::clicked, this, &StartupView::hide); #else #ifdef Q_OS_MAC cancelButton->setText("Quit"); #else cancelButton->setText("Exit"); #endif connect(cancelButton, &QPushButton::clicked, OpenStudioApp::instance(), &OpenStudioApp::quit); #endif cancelButton->setStyleSheet("QPushButton { font: bold; }"); auto chooseButton = new QPushButton(); chooseButton->setObjectName("StandardBlueButton"); chooseButton->setText("Choose"); chooseButton->setMinimumSize(QSize(99,28)); connect(chooseButton, &QPushButton::clicked, this, &StartupView::newFromTemplateSlot); chooseButton->setStyleSheet("QPushButton { font: bold; }"); auto hFooterLayout = new QHBoxLayout(); hFooterLayout->setSpacing(25); hFooterLayout->setContentsMargins(0,0,0,0); hFooterLayout->addStretch(); hFooterLayout->addWidget(cancelButton); hFooterLayout->addWidget(chooseButton); footerView->setLayout(hFooterLayout); auto hLayout = new QHBoxLayout(); auto vLayout = new QVBoxLayout(); auto vOpenLayout = new QVBoxLayout(); vOpenLayout->addWidget(recentProjectsView); vOpenLayout->addWidget(openButton); vOpenLayout->addWidget(importButton); //vOpenLayout->addWidget(importSDDButton); hLayout->addLayout(vOpenLayout); hLayout->addWidget(projectChooserView); hLayout->addWidget(m_projectDetailView,1); vLayout->addSpacing(50); vLayout->addLayout(hLayout); vLayout->addWidget(footerView); setLayout(vLayout); connect(m_listView, &QListView::clicked, this, &StartupView::showDetailsForItem); m_listView->setCurrentIndex(m_templateListModel->index(0,0)); showDetailsForItem(m_templateListModel->index(0,0)); }
RDButtonDialog::RDButtonDialog(QString station_name, const QString &label_template, RDCartDialog *cart_dialog,const QString &svcname, QWidget *parent) : QDialog(parent,"",true) { // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); setCaption(tr("Edit Button")); edit_station_name=station_name; edit_label_template=label_template; edit_cart_dialog=cart_dialog; edit_svcname=svcname; // // Create Fonts // QFont font=QFont("Helvetica",12,QFont::Normal); font.setPixelSize(12); QFont label_font=QFont("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); QFont button_font=QFont("Helvetica",14,QFont::Bold); button_font.setPixelSize(14); QFont counter_font=QFont("Helvetica",24,QFont::Bold); counter_font.setPixelSize(24); // // Button Label // edit_label_edit=new QLineEdit(this,"edit_label_edit"); edit_label_edit->setGeometry(60,10,300,20); edit_label_edit->setFont(font); QLabel *label=new QLabel(edit_label_edit,tr("Label:"), this,"edit_label_label"); label->setGeometry(10,12,45,16); label->setFont(label_font); label->setAlignment(Qt::AlignRight); // // Button Cart // edit_cart_edit=new QLineEdit(this,"edit_cart_edit"); edit_cart_edit->setGeometry(60,34,300,20); edit_cart_edit->setFont(font); edit_cart_edit->setReadOnly(true); label=new QLabel(edit_cart_edit,tr("Cart:"),this,"edit_cart_label"); label->setGeometry(10,36,45,16); label->setFont(label_font); label->setAlignment(Qt::AlignRight); // // Set Cart Button // QPushButton *button=new QPushButton(this,"cart_button"); button->setGeometry(55,60,80,50); button->setFont(label_font); button->setText(tr("Set\nCart")); connect(button,SIGNAL(clicked()),this,SLOT(setCartData())); // // Clear Button // button=new QPushButton(this,"cart_button"); button->setGeometry(145,60,80,50); button->setFont(label_font); button->setText(tr("Clear")); connect(button,SIGNAL(clicked()),this,SLOT(clearCartData())); // // Color Button // edit_color_button=new QPushButton(this,"edit_color_button"); edit_color_button->setGeometry(sizeHint().width()-135,60,80,50); edit_color_button->setFont(label_font); edit_color_button->setText(tr("Set\nColor")); connect(edit_color_button,SIGNAL(clicked()),this,SLOT(setColorData())); // // 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(tr("&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(tr("&Cancel")); connect(button,SIGNAL(clicked()),this,SLOT(cancelData())); }
AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *const options, RecentlyUsed *const recentlyUsed, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences) : QDialog(parent), m_options(options), m_recentlyUsed(recentlyUsed), m_sysinfo(sysinfo), m_preferences(preferences), m_defaults(new OptionsModel(sysinfo)), ui(new Ui::AddJobDialog()), m_monitorConfigChanges(true) { //Init the dialog, from the .ui file ui->setupUi(this); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); //Fix dialog size ui->buttonSaveTemplate->setMaximumHeight(20); ui->buttonDeleteTemplate->setMaximumHeight(20); resize(width(), minimumHeight()); setMinimumSize(size()); setMaximumHeight(height()); //Init combobox items ui->cbxTuning ->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED)); ui->cbxProfile->addItem(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED)); //Hide optional controls ui->checkBoxApplyToAll->setVisible(false); //Monitor combobox changes connect(ui->cbxEncoderType, SIGNAL(currentIndexChanged(int)), this, SLOT(encoderIndexChanged(int))); connect(ui->cbxEncoderVariant, SIGNAL(currentIndexChanged(int)), this, SLOT(variantIndexChanged(int))); connect(ui->cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(modeIndexChanged(int))); //Activate buttons connect(ui->buttonBrowseSource, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); connect(ui->buttonBrowseOutput, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); connect(ui->buttonSaveTemplate, SIGNAL(clicked()), this, SLOT(saveTemplateButtonClicked())); connect(ui->buttonDeleteTemplate, SIGNAL(clicked()), this, SLOT(deleteTemplateButtonClicked())); //Setup validator ui->editCustomX264Params->installEventFilter(this); ui->editCustomX264Params->setValidator(new StringValidatorX264(ui->labelNotificationX264, ui->iconNotificationX264)); ui->editCustomX264Params->clear(); ui->editCustomAvs2YUVParams->installEventFilter(this); ui->editCustomAvs2YUVParams->setValidator(new StringValidatorAvs2YUV(ui->labelNotificationAvs2YUV, ui->iconNotificationAvs2YUV)); ui->editCustomAvs2YUVParams->clear(); //Install event filter ui->labelHelpScreenX264->installEventFilter(this); ui->labelHelpScreenAvs2YUV->installEventFilter(this); //Monitor for options changes connect(ui->cbxEncoderType, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged())); connect(ui->cbxEncoderArch, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged())); connect(ui->cbxEncoderVariant, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged())); connect(ui->cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged())); connect(ui->spinQuantizer, SIGNAL(valueChanged(double)), this, SLOT(configurationChanged())); connect(ui->spinBitrate, SIGNAL(valueChanged(int)), this, SLOT(configurationChanged())); connect(ui->cbxPreset, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged())); connect(ui->cbxTuning, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged())); connect(ui->cbxProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged())); connect(ui->editCustomX264Params, SIGNAL(textChanged(QString)), this, SLOT(configurationChanged())); connect(ui->editCustomAvs2YUVParams, SIGNAL(textChanged(QString)), this, SLOT(configurationChanged())); //Create context menus ADD_CONTEXTMENU_ACTION(ui->editCustomX264Params, QIcon(":/buttons/page_edit.png"), tr("Open the Text-Editor"), editorActionTriggered); ADD_CONTEXTMENU_ACTION(ui->editCustomAvs2YUVParams, QIcon(":/buttons/page_edit.png"), tr("Open the Text-Editor"), editorActionTriggered); ADD_CONTEXTMENU_SEPARATOR(ui->editCustomX264Params); ADD_CONTEXTMENU_SEPARATOR(ui->editCustomAvs2YUVParams); ADD_CONTEXTMENU_ACTION(ui->editCustomX264Params, QIcon(":/buttons/page_copy.png"), tr("Copy to Clipboard"), copyActionTriggered); ADD_CONTEXTMENU_ACTION(ui->editCustomAvs2YUVParams, QIcon(":/buttons/page_copy.png"), tr("Copy to Clipboard"), copyActionTriggered); ADD_CONTEXTMENU_ACTION(ui->editCustomX264Params, QIcon(":/buttons/page_paste.png"), tr("Paste from Clipboard"), pasteActionTriggered); ADD_CONTEXTMENU_ACTION(ui->editCustomAvs2YUVParams, QIcon(":/buttons/page_paste.png"), tr("Paste from Clipboard"), pasteActionTriggered); //Setup template selector loadTemplateList(); connect(ui->cbxTemplate, SIGNAL(currentIndexChanged(int)), this, SLOT(templateSelected())); }
void ComponentDock::setupHTools() { htools = new QFrame(this); auto vlayout = new QVBoxLayout(htools); vlayout->setMargin(2); vlayout->setSpacing(0); auto hlayoutTitle = new QHBoxLayout(); hlabel = new QLabel(htools); hlabel->setText("Components Editor "); hlabel->setStyleSheet("color: lightGray;"); hlayoutTitle->addWidget(hlabel); auto sepBrush = QBrush(Qt::gray, Qt::BrushStyle::Dense6Pattern); QPalette sepPalette; sepPalette.setBrush(QPalette::Background, sepBrush); auto seprator = new QLabel(htools); seprator->setAutoFillBackground(true); seprator->setPalette(sepPalette); seprator->setMaximumHeight(10); hlayoutTitle->addWidget(seprator, 1, Qt::AlignBottom); auto btnClose = new QToolButton(htools); btnClose->setText("X"); btnClose->setStyleSheet("color: lightGray\n"); btnClose->setAutoRaise(true); btnClose->setMaximumWidth(16); btnClose->setMaximumHeight(16); hlayoutTitle->addWidget(btnClose); connect(btnClose, &QToolButton::clicked, this, &QDockWidget::hide); vlayout->addLayout(hlayoutTitle); auto hlayout = new QHBoxLayout(htools); hlayout->setMargin(0); auto btnAddComps = new QToolButton(htools); btnAddComps->setMenu(mtypes); btnAddComps->setDefaultAction(addDefComp); btnAddComps->setIcon(QIcon(":/icons/add")); btnAddComps->setPopupMode(QToolButton::MenuButtonPopup); btnAddComps->setToolButtonStyle(Qt::ToolButtonIconOnly); hlayout->addWidget(btnAddComps); hlayout->addStretch(1); // lua table name llabel = new QLabel(htools); hlayout->addWidget(llabel); vlayout->addLayout(hlayout); auto hlayout2 = new QHBoxLayout(htools); hlayout2->setMargin(0); auto lblLayer = new QLabel(this); lblLayer->setText("Layer: "); hlayout2->addWidget(lblLayer); spnLayer = new QSpinBox(this); spnLayer->setMinimum(0); spnLayer->setMaximum(KENTITY_LAYER_SIZE); connect(spnLayer, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &ComponentDock::layerChanged); hlayout2->addWidget(spnLayer, 1); hlayout2->addSpacing(5); auto lblOrder = new QLabel(this); lblOrder->setText("Z: "); hlayout2->addWidget(lblOrder); spnZOrder = new QSpinBox(this); spnZOrder->setMinimum(0); spnZOrder->setMaximum(9999999); spnZOrder->setValue(0); connect(spnZOrder, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &ComponentDock::zorderChanged); hlayout2->addWidget(spnZOrder, 1); hlayout2->addSpacing(5); // static chkStatic = new QCheckBox(this); chkStatic->setText("Static"); connect(chkStatic, &QCheckBox::stateChanged, this, &ComponentDock::staticChanged); hlayout2->addWidget(chkStatic); hlayout2->addSpacing(5); vlayout->addLayout(hlayout2); auto hlayout3 = new QHBoxLayout(htools); hlayout3->setMargin(0); hlayout3->setSpacing(0); auto btnCollpaseAll = new QToolButton(htools); btnCollpaseAll->setIcon(QIcon(":/icons/col")); btnCollpaseAll->setToolButtonStyle(Qt::ToolButtonIconOnly); connect(btnCollpaseAll, &QToolButton::clicked, comTree, &QTreeWidget::collapseAll); hlayout3->addWidget(btnCollpaseAll); hlayout3->addSpacing(5); ledit = new QLineEdit(htools); ledit->setPlaceholderText("Search"); ledit->addAction(QIcon(":/icons/search"), QLineEdit::ActionPosition::TrailingPosition); ledit->setStyleSheet("background-color: gray;"); connect(ledit, &QLineEdit::textChanged, this, &ComponentDock::actSearch); hlayout3->addWidget(ledit, 1); vlayout->addLayout(hlayout3); htools->setLayout(vlayout); setTitleBarWidget(htools); }
MainWidget::MainWidget(QWidget *parent,const char *name) :QWidget(parent,name) { gpi_scroll_mode=false; // // Read Command Options // RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdgpimon","\n"); delete cmd; // // 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 list_font("helvetica",12,QFont::Normal); list_font.setPixelSize(12); QFont main_font("helvetica",12,QFont::Bold); main_font.setPixelSize(12); QFont title_font("helvetica",14,QFont::Bold); title_font.setPixelSize(14); // // Create And Set Icon // gpi_rivendell_map=new QPixmap(rivendell_xpm); setIcon(*gpi_rivendell_map); // // Load Local Configs // gpi_config=new RDConfig(); gpi_config->load(); // // Open Database // gpi_db=QSqlDatabase::addDatabase(gpi_config->mysqlDriver()); if(!gpi_db) { QMessageBox::warning(this,tr("Database Error"), tr("Can't Connect","Unable to connect to mySQL Server!")); exit(0); } gpi_db->setDatabaseName(gpi_config->mysqlDbname()); gpi_db->setUserName(gpi_config->mysqlUsername()); gpi_db->setPassword(gpi_config->mysqlPassword()); gpi_db->setHostName(gpi_config->mysqlHostname()); if(!gpi_db->open()) { QMessageBox::warning(this,tr("Can't Connect"), tr("Unable to connect to mySQL Server!")); gpi_db->removeDatabase(gpi_config->mysqlDbname()); exit(0); } new RDDbHeartbeat(gpi_config->mysqlHeartbeatInterval(),this); // // RIPC Connection // gpi_ripc=new RDRipc(gpi_config->stationName()); gpi_ripc->setIgnoreMask(true); connect(gpi_ripc,SIGNAL(userChanged()),this,SLOT(userData())); connect(gpi_ripc,SIGNAL(gpiStateChanged(int,int,bool)), this,SLOT(gpiStateChangedData(int,int,bool))); connect(gpi_ripc,SIGNAL(gpoStateChanged(int,int,bool)), this,SLOT(gpoStateChangedData(int,int,bool))); connect(gpi_ripc,SIGNAL(gpiMaskChanged(int,int,bool)), this,SLOT(gpiMaskChangedData(int,int,bool))); connect(gpi_ripc,SIGNAL(gpoMaskChanged(int,int,bool)), this,SLOT(gpoMaskChangedData(int,int,bool))); connect(gpi_ripc,SIGNAL(gpiCartChanged(int,int,int,int)), this,SLOT(gpiCartChangedData(int,int,int,int))); connect(gpi_ripc,SIGNAL(gpoCartChanged(int,int,int,int)), this,SLOT(gpoCartChangedData(int,int,int,int))); gpi_ripc->connectHost("localhost",RIPCD_TCP_PORT,gpi_config->password()); // // RDStation // gpi_station=new RDStation(gpi_config->stationName()); // // RDMatrix; // gpi_matrix=NULL; // // Type Selector // gpi_type_box=new QComboBox(this); gpi_type_box->setGeometry(80,10,120,21); gpi_type_box->insertItem(tr("GPI (Inputs)")); gpi_type_box->insertItem(tr("GPO (Outputs)")); QLabel *label=new QLabel(gpi_type_box,tr("Show:"),this); label->setGeometry(20,10,55,21); label->setFont(main_font); label->setAlignment(AlignRight|AlignVCenter); connect(gpi_type_box,SIGNAL(activated(int)), this,SLOT(matrixActivatedData(int))); // // Matrix Selector // gpi_matrix_box=new QComboBox(this); gpi_matrix_box->setGeometry(280,10,80,21); for(int i=0;i<MAX_MATRICES;i++) { gpi_matrix_box->insertItem(QString().sprintf("%d",i)); } label=new QLabel(gpi_matrix_box,tr("Matrix:"),this); label->setGeometry(220,10,55,21); label->setFont(main_font); label->setAlignment(AlignRight|AlignVCenter); connect(gpi_matrix_box,SIGNAL(activated(int)), this,SLOT(matrixActivatedData(int))); // // GPI Indicators // for(int i=0;i<GPIMON_ROWS;i++) { for(int j=0;j<GPIMON_COLS;j++) { gpi_labels[i*GPIMON_COLS+j]=new GpiLabel(this); gpi_labels[i*GPIMON_COLS+j]->setGeometry(10+64*j,40+78*i, gpi_labels[i*GPIMON_COLS+j]-> sizeHint().width(), gpi_labels[i*GPIMON_COLS+j]-> sizeHint().height()); } } // // Up Button // gpi_up_button= new RDTransportButton(RDTransportButton::Up,this); gpi_up_button->setGeometry(10,360,80,50); connect(gpi_up_button,SIGNAL(clicked()),this,SLOT(upData())); // // Down Button // gpi_down_button= new RDTransportButton(RDTransportButton::Down,this); gpi_down_button->setGeometry(100,360,80,50); connect(gpi_down_button,SIGNAL(clicked()),this,SLOT(downData())); // // Color Key // label=new QLabel(tr("Green = ON Cart"),this); label->setGeometry(200,370,300,12); label->setFont(main_font); label->setAlignment(AlignLeft|AlignVCenter); QPalette p=palette(); p.setColor(QPalette::Active,QColorGroup::Foreground,darkGreen); p.setColor(QPalette::Inactive,QColorGroup::Foreground,darkGreen); p.setColor(QPalette::Disabled,QColorGroup::Foreground,darkGreen); label->setPalette(p); label=new QLabel(tr("Red = OFF Cart"),this); label->setGeometry(200,392,300,12); label->setFont(main_font); label->setAlignment(AlignLeft|AlignVCenter); p.setColor(QPalette::Active,QColorGroup::Foreground,darkRed); p.setColor(QPalette::Inactive,QColorGroup::Foreground,darkRed); p.setColor(QPalette::Disabled,QColorGroup::Foreground,darkRed); label->setPalette(p); // // Events Log // label=new QLabel(tr("Events Log"),this); label->setFont(title_font); label->setAlignment(Qt::AlignCenter); label->setGeometry(110,423,sizeHint().width()-220,30); gpi_events_date_edit=new QDateEdit(this); gpi_events_date_edit->setGeometry(155,453,90,20); gpi_events_date_edit->setDate(QDate::currentDate()); connect(gpi_events_date_edit,SIGNAL(valueChanged(const QDate &)), this,SLOT(eventsDateChangedData(const QDate &))); gpi_events_date_label=new QLabel(gpi_events_date_edit,tr("Date")+":",this); gpi_events_date_label->setGeometry(100,453,50,20); gpi_events_date_label->setFont(main_font); gpi_events_date_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); gpi_events_state_box=new QComboBox(this); gpi_events_state_box->setGeometry(280,453,55,20); gpi_events_state_box->insertItem(tr("On")); gpi_events_state_box->insertItem(tr("Off")); gpi_events_state_box->insertItem(tr("Both")); connect(gpi_events_state_box,SIGNAL(activated(int)), this,SLOT(eventsStateChangedData(int))); gpi_events_state_label=new QLabel(gpi_events_state_box,tr("State")+":",this); gpi_events_state_label->setGeometry(225,453,50,20); gpi_events_state_label->setFont(main_font); gpi_events_state_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); gpi_events_list=new RDListView(this); gpi_events_list->setFont(main_font); gpi_events_list->setGeometry(110,480,sizeHint().width()-220,230); gpi_events_list->setItemMargin(5); gpi_events_list->setSelectionMode(QListView::NoSelection); gpi_events_list->addColumn("Time"); gpi_events_list->setColumnAlignment(0,Qt::AlignHCenter); gpi_events_list->setColumnSortType(1,RDListView::TimeSort); gpi_events_list->addColumn(tr("Line")); gpi_events_list->setColumnAlignment(1,Qt::AlignHCenter); gpi_events_list->setColumnSortType(1,RDListView::GpioSort); gpi_events_list->addColumn(tr("State")); gpi_events_list->setColumnAlignment(2,Qt::AlignHCenter); gpi_events_scroll_button=new QPushButton(tr("Scroll"),this); gpi_events_scroll_button->setGeometry(sizeHint().width()-100,510,80,50); gpi_events_scroll_button->setFont(main_font); connect(gpi_events_scroll_button,SIGNAL(clicked()), this,SLOT(eventsScrollData())); gpi_scroll_color=palette(); gpi_scroll_color.setColor(QPalette::Active,QColorGroup::ButtonText, Qt::white); gpi_scroll_color.setColor(QPalette::Active,QColorGroup::Button, Qt::blue); gpi_scroll_color.setColor(QPalette::Active,QColorGroup::Background, lightGray); gpi_scroll_color.setColor(QPalette::Inactive,QColorGroup::ButtonText, Qt::white); gpi_scroll_color.setColor(QPalette::Inactive,QColorGroup::Button, Qt::blue); gpi_scroll_color.setColor(QPalette::Inactive,QColorGroup::Background, lightGray); gpi_events_report_button=new QPushButton(tr("Report"),this); gpi_events_report_button->setGeometry(sizeHint().width()-100,570,80,50); gpi_events_report_button->setFont(main_font); connect(gpi_events_report_button,SIGNAL(clicked()), this,SLOT(eventsReportData())); // // Start Up Timer // gpi_events_startup_timer=new QTimer(this); connect(gpi_events_startup_timer,SIGNAL(timeout()),this,SLOT(startUpData())); gpi_events_startup_timer->start(GPIMON_START_UP_DELAY,true); }
EditCartEvent::EditCartEvent(int id,std::vector<int> *adds,QWidget *parent) : QDialog(parent,"",true) { QString sql; RDSqlQuery *q; QString temp; int cartnum; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Generate Fonts // 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",10,QFont::Normal); day_font.setPixelSize(10); edit_deck=NULL; edit_added_events=adds; setCaption(tr("Edit Cart Event")); // // Text Validator // RDTextValidator *validator=new RDTextValidator(this); // // The Recording Record // edit_recording=new RDRecording(id); if((cartnum=edit_recording->macroCart())>=0) { edit_cart=new RDCart(cartnum); } else { edit_cart=NULL; } // // Active Button // edit_active_button=new QCheckBox(this); edit_active_button->setGeometry(10,11,20,20); QLabel *label=new QLabel(edit_active_button,tr("Event Active"),this); label->setGeometry(30,11,125,20); label->setFont(label_font); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); // // Station // edit_station_box=new QComboBox(this); edit_station_box->setGeometry(200,10,140,23); label=new QLabel(edit_station_box,tr("Location:"),this); label->setGeometry(125,10,70,23); label->setFont(label_font); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); // // Start Time // edit_starttime_edit=new Q3TimeEdit(this); edit_starttime_edit->setGeometry(sizeHint().width()-90,12,80,20); label=new QLabel(edit_starttime_edit,tr("Start Time:"),this); label->setGeometry(sizeHint().width()-175,12,80,20); label->setFont(label_font); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); // // Description // edit_description_edit=new QLineEdit(this); edit_description_edit->setGeometry(115,43,sizeHint().width()-125,20); edit_description_edit->setValidator(validator); label=new QLabel(edit_description_edit,tr("Description:"),this); label->setGeometry(10,43,100,20); label->setFont(label_font); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic); // // Cart Number // edit_destination_edit=new QLineEdit(this); edit_destination_edit->setGeometry(115,70,60,20); edit_destination_edit->setReadOnly(false); label=new QLabel(edit_destination_edit,tr("Cart Number:"),this); label->setGeometry(10,73,100,19); label->setFont(label_font); label->setAlignment(Qt::AlignRight|Qt::TextShowMnemonic); QPushButton *button=new QPushButton(this); button->setGeometry(185,68,60,24); button->setFont(day_font); button->setText(tr("&Select")); connect(button,SIGNAL(clicked()),this,SLOT(selectCartData())); // // Button Label // label=new QLabel(tr("Active Days"),this); label->setGeometry(47,101,90,19); label->setFont(label_font); label->setAlignment(Qt::AlignHCenter|Qt::TextShowMnemonic); // // Monday Button // edit_mon_button=new QCheckBox(this); edit_mon_button->setGeometry(20,120,20,20); label=new QLabel(edit_mon_button,tr("Monday"),this); label->setGeometry(40,120,115,20); label->setFont(day_font); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); // // Tuesday Button // edit_tue_button=new QCheckBox(this); edit_tue_button->setGeometry(115,120,20,20); label=new QLabel(edit_tue_button,tr("Tuesday"),this); label->setGeometry(135,120,115,20); label->setFont(day_font); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); // // Wednesday Button // edit_wed_button=new QCheckBox(this); edit_wed_button->setGeometry(215,120,20,20); label=new QLabel(edit_wed_button,tr("Wednesday"),this); label->setGeometry(235,120,115,20); label->setFont(day_font); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); // // Thursday Button // edit_thu_button=new QCheckBox(this); edit_thu_button->setGeometry(335,120,20,20); label=new QLabel(edit_thu_button,tr("Thursday"),this); label->setGeometry(355,120,115,20); label->setFont(day_font); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); // // Friday Button // edit_fri_button=new QCheckBox(this); edit_fri_button->setGeometry(440,120,20,20); label=new QLabel(edit_fri_button,tr("Friday"),this); label->setGeometry(460,120,40,20); label->setFont(day_font); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); // // Saturday Button // edit_sat_button=new QCheckBox(this); edit_sat_button->setGeometry(130,145,20,20); label=new QLabel(edit_sat_button,tr("Saturday"),this); label->setGeometry(150,145,60,20); label->setFont(day_font); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); // // Sunday Button // edit_sun_button=new QCheckBox(this); edit_sun_button->setGeometry(300,145,20,20); label=new QLabel(edit_sun_button,tr("Sunday"),this); label->setGeometry(320,145,60,20); label->setFont(day_font); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); // // OneShot Button // edit_oneshot_box=new QCheckBox(this); edit_oneshot_box->setGeometry(20,180,15,15); label=new QLabel(edit_oneshot_box,tr("Make OneShot"),this); label->setGeometry(40,178,115,20); label->setFont(label_font); label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic); // // Save As Button // button=new QPushButton(this); button->setGeometry(sizeHint().width()-300,sizeHint().height()-60,80,50); button->setFont(button_font); button->setText(tr("&Save As\nNew")); connect(button,SIGNAL(clicked()),this,SLOT(saveasData())); if(adds==NULL) { button->hide(); } // // Ok Button // button=new QPushButton(this); button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); button->setDefault(true); button->setFont(button_font); button->setText(tr("&OK")); connect(button,SIGNAL(clicked()),this,SLOT(okData())); // // Cancel Button // button=new QPushButton(this); button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50); button->setFont(button_font); button->setText(tr("&Cancel")); connect(button,SIGNAL(clicked()),this,SLOT(cancelData())); // // Populate Data // q=new RDSqlQuery("select NAME from STATIONS where NAME!=\"DEFAULT\""); while(q->next()) { edit_station_box->insertItem(q->value(0).toString()); if(edit_recording->station()==q->value(0).toString()) { edit_station_box->setCurrentItem(edit_station_box->count()-1); } } delete q; edit_active_button->setChecked(edit_recording->isActive()); edit_starttime_edit->setTime(edit_recording->startTime()); edit_description_edit->setText(edit_recording->description()); if(edit_cart!=NULL) { edit_destination_edit-> setText(QString().sprintf("%06d",edit_cart->number())); } edit_mon_button->setChecked(edit_recording->mon()); edit_tue_button->setChecked(edit_recording->tue()); edit_wed_button->setChecked(edit_recording->wed()); edit_thu_button->setChecked(edit_recording->thu()); edit_fri_button->setChecked(edit_recording->fri()); edit_sat_button->setChecked(edit_recording->sat()); edit_sun_button->setChecked(edit_recording->sun()); edit_oneshot_box->setChecked(edit_recording->oneShot()); }
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()); }
void CoverArtWidget::setCover(const QImage &aCover) { label.setPixmap(QPixmap::fromImage(aCover)); setMaximumWidth(aCover.width() + 5); setMaximumHeight(aCover.height() + 25); }
ListLogs::ListLogs(QString *logname,QString *svcname,LogPlay *log, QWidget *parent,const char *name) : QDialog(parent,name,true) { // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Generate Fonts // QFont button_font("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); list_logname=logname; list_svcname=svcname; list_log=log; setCaption(tr("Select a Log")); // // Log List // list_log_list=new QListView(this,"list_log_list"); list_log_list->setGeometry(10,10, sizeHint().width()-20,sizeHint().height()-80); list_log_list->setAllColumnsShowFocus(true); list_log_list->setItemMargin(5); connect(list_log_list, SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)), this, SLOT(doubleClickedData(QListViewItem *,const QPoint &,int))); list_log_list->addColumn(tr("NAME")); list_log_list->setColumnAlignment(0,Qt::AlignLeft); list_log_list->addColumn(tr("DESCRIPTION")); list_log_list->setColumnAlignment(1,Qt::AlignLeft); list_log_list->addColumn(tr("SERVICE")); list_log_list->setColumnAlignment(2,Qt::AlignLeft); // // Load Button // QPushButton *button=new QPushButton(this,"load_button"); button->setGeometry(10,sizeHint().height()-60,80,50); button->setFont(button_font); button->setText(tr("Load")); connect(button,SIGNAL(clicked()),this,SLOT(loadButtonData())); // // Unload Button // list_unload_button=new QPushButton(this,"list_unload_button"); list_unload_button->setGeometry(100,sizeHint().height()-60,80,50); list_unload_button->setFont(button_font); list_unload_button->setText(tr("Unload")); connect(list_unload_button,SIGNAL(clicked()),this,SLOT(unloadButtonData())); // // Save Button // button=new QPushButton(this,"save_button"); button->setGeometry(210,sizeHint().height()-60,80,50); button->setFont(button_font); button->setText(tr("Save")); connect(button,SIGNAL(clicked()),this,SLOT(saveButtonData())); // // Save As Button // QPushButton *saveas_button=new QPushButton(this,"saveas_button"); saveas_button->setGeometry(300,sizeHint().height()-60,80,50); saveas_button->setFont(button_font); saveas_button->setText(tr("Save &As")); connect(saveas_button,SIGNAL(clicked()),this,SLOT(saveAsButtonData())); // // Cancel Button // button=new QPushButton(this,"cancel_button"); button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50); button->setFont(button_font); button->setText(tr("Cancel")); button->setDefault(true); connect(button,SIGNAL(clicked()),this,SLOT(cancelButtonData())); RefreshList(); // // Set Control Perms // saveas_button->setEnabled(rduser->createLog()); }
RDImportAudio::RDImportAudio(QString cutname,QString *path, RDSettings *settings,bool *import_metadata, RDWaveData *wavedata,RDCut *clipboard, RDStation *station,RDUser *user, bool *running,RDConfig *config, QWidget *parent,const char *name) : QDialog(parent) { import_config=config; import_default_settings=settings; import_path=path; import_settings=settings; import_cutname=cutname; import_import_metadata=import_metadata; import_wavedata=wavedata; import_clipboard=clipboard; import_running=running; import_station=station; import_user=user; import_file_filter=RD_AUDIO_FILE_FILTER; import_import_conv=NULL; import_export_conv=NULL; import_operation=NULL; setCaption(tr("Import/Export Audio File")); // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Generate Fonts // 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 mode_font=QFont("Helvetica",14,QFont::Bold); mode_font.setPixelSize(14); // // Mode Group // import_mode_group=new QButtonGroup(this); import_mode_group->hide(); connect(import_mode_group,SIGNAL(clicked(int)), this,SLOT(modeClickedData(int))); // // Input Mode Button // import_importmode_button=new QRadioButton(tr("Import File"), this); import_mode_group->insert(import_importmode_button); import_importmode_button->setGeometry(10,10,sizeHint().width()-40,15); import_importmode_button->setFont(mode_font); import_importmode_button->setChecked(true); // // Input Filename // import_in_filename_edit=new QLineEdit(this); import_in_filename_edit->setGeometry(85,30,sizeHint().width()-180,20); connect(import_in_filename_edit,SIGNAL(textChanged(const QString &)), this,SLOT(filenameChangedData(const QString &))); import_in_filename_label= new QLabel(import_in_filename_edit,tr("Filename:"),this); import_in_filename_label->setGeometry(10,30,70,20); import_in_filename_label->setFont(label_font); import_in_filename_label->setAlignment(AlignVCenter|AlignRight); // // Input File Selector Button // import_in_selector_button=new QPushButton(tr("&Select"),this); import_in_selector_button->setGeometry(sizeHint().width()-85,27,70,26); connect(import_in_selector_button,SIGNAL(clicked()), this,SLOT(selectInputFileData())); // // Input Metadata // import_in_metadata_box=new QCheckBox(tr("Import file metadata"),this); import_in_metadata_box->setGeometry(95,56,160,15); import_in_metadata_box->setChecked(*import_import_metadata); import_in_metadata_box->setFont(label_font); // // Input Channels // import_channels_box=new QComboBox(this); import_channels_box->setGeometry(310,54,50,20); import_channels_label= new QLabel(import_channels_box,tr("Channels:"),this); import_channels_label->setGeometry(230,54,75,20); import_channels_label->setFont(label_font); import_channels_label->setAlignment(AlignRight|AlignVCenter); // // Autotrim Check Box // import_autotrim_box=new QCheckBox(tr("Autotrim"),this); import_autotrim_box->setGeometry(95,82,80,15); import_autotrim_box->setChecked(true); import_autotrim_box->setFont(label_font); connect(import_autotrim_box,SIGNAL(toggled(bool)), this,SLOT(autotrimCheckData(bool))); // // Autotrim Level // import_autotrim_spin=new QSpinBox(this); import_autotrim_spin->setGeometry(235,80,40,20); import_autotrim_spin->setRange(-99,0); import_autotrim_label=new QLabel(import_autotrim_spin,tr("Level:"),this); import_autotrim_label->setGeometry(185,80,45,20); import_autotrim_label->setFont(label_font); import_autotrim_label->setAlignment(AlignRight|AlignVCenter); import_autotrim_unit=new QLabel(tr("dBFS"),this); import_autotrim_unit->setGeometry(280,80,40,20); import_autotrim_unit->setFont(label_font); import_autotrim_unit->setAlignment(AlignLeft|AlignVCenter); // // Output Mode Button // import_exportmode_button=new QRadioButton(tr("Export File"),this); import_mode_group->insert(import_exportmode_button); import_exportmode_button->setGeometry(10,120,sizeHint().width()-40,15); import_exportmode_button->setFont(mode_font); // // Output Filename // import_out_filename_edit=new QLineEdit(this); import_out_filename_edit->setGeometry(85,140,sizeHint().width()-180,20); connect(import_out_filename_edit,SIGNAL(textChanged(const QString &)), this,SLOT(filenameChangedData(const QString &))); import_out_filename_edit->setReadOnly(true); import_out_filename_label= new QLabel(import_out_filename_edit,tr("Filename:"),this); import_out_filename_label->setGeometry(10,140,70,20); import_out_filename_label->setFont(label_font); import_out_filename_label->setAlignment(AlignVCenter|AlignRight); // // Output File Selector Button // import_out_selector_button=new QPushButton(tr("&Select"),this); import_out_selector_button->setGeometry(sizeHint().width()-85,137,70,26); connect(import_out_selector_button,SIGNAL(clicked()), this,SLOT(selectOutputFileData())); // // Output Metadata // import_out_metadata_box=new QCheckBox(tr("Export file metadata"),this); import_out_metadata_box->setGeometry(95,161,sizeHint().width()-210,15); import_out_metadata_box->setChecked(*import_import_metadata); import_out_metadata_box->setFont(label_font); // // Output Format // import_format_edit=new QLineEdit(this); import_format_edit->setGeometry(85,181,sizeHint().width()-180,20); import_format_edit->setReadOnly(true); import_format_edit->setText(import_settings->description()); import_format_label=new QLabel(import_out_filename_edit,tr("Format:"),this); import_format_label->setGeometry(10,181,70,20); import_format_label->setFont(label_font); import_format_label->setAlignment(AlignVCenter|AlignRight); // // Output Format Selector Button // import_out_format_button=new QPushButton(tr("S&et"),this); import_out_format_button->setGeometry(sizeHint().width()-85,178,70,26); connect(import_out_format_button,SIGNAL(clicked()), this,SLOT(selectOutputFormatData())); // // Progress Bar // import_bar=new RDBusyBar(this); import_bar->setGeometry(10,230,sizeHint().width()-20,20); // // Normalize Check Box // import_normalize_box=new QCheckBox(tr("Normalize"),this); import_normalize_box->setGeometry(10,262,113,15); import_normalize_box->setChecked(true); import_normalize_box->setFont(label_font); connect(import_normalize_box,SIGNAL(toggled(bool)), this,SLOT(normalizeCheckData(bool))); // // Normalize Level // import_normalize_spin=new QSpinBox(this); import_normalize_spin->setGeometry(160,260,40,20); import_normalize_spin->setRange(-30,0); import_normalize_label=new QLabel(import_normalize_spin,tr("Level:"),this); import_normalize_label->setGeometry(110,260,45,20); import_normalize_label->setFont(label_font); import_normalize_label->setAlignment(AlignRight|AlignVCenter); import_normalize_unit=new QLabel(tr("dBFS"),this); import_normalize_unit->setGeometry(205,260,40,20); import_normalize_unit->setFont(label_font); import_normalize_unit->setAlignment(AlignLeft|AlignVCenter); // // Import Button // import_import_button=new QPushButton(tr("&Import"),this); import_import_button-> setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); import_import_button->setFont(button_font); connect(import_import_button,SIGNAL(clicked()),this,SLOT(importData())); // // Cancel Button // import_cancel_button=new QPushButton(tr("&Cancel"),this); import_cancel_button-> setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50); import_cancel_button->setFont(button_font); import_cancel_button->setDefault(true); connect(import_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData())); // // Populate Data // import_normalize_spin->setValue(settings->normalizationLevel()/100); import_autotrim_spin->setValue(settings->autotrimLevel()/100); import_channels_box->insertItem("1"); import_channels_box->insertItem("2"); import_channels_box->setCurrentItem(settings->channels()-1); filenameChangedData(""); modeClickedData(import_mode_group->selectedId()); }
void ChatEdit::setAutoResize(bool resize) { if (!resize) setMaximumHeight(QWIDGETSIZE_MAX); m_autoResize = resize; }
RImageDock::RImageDock(OGLWidget* newOGLWidget, QWidget *parent) :QWidget(parent) { widgetTitle = QString(""); frameIndex = 0; this->oglWidget = newOGLWidget; matImage = newOGLWidget->matImageListRGB.at(frameIndex); naxis1 = matImage.cols; naxis2 = matImage.rows; bscale = newOGLWidget->rMatImageList.at(0).getBscale(); qDebug() << "RImageDock::matImage.channels()" << matImage.channels(); // Convert to gray before getting the Max and Min cvtColor(matImage, matImageGray, CV_RGB2GRAY); dataMin = 0; dataMax = 0; cv::minMaxLoc(matImageGray, &dataMin, &dataMax); dataRange = dataMax - dataMin; qDebug() << "rImageDock::dataMin =" << dataMin; qDebug() << "rImageDock::dataMax =" << dataMax; gamma = 1; // String number format parameters if (dataRange < 0.1) { format = 'g'; precision = 2; } else if (dataRange < 10) { format = 'f'; precision = 3; } else { format = 'f'; precision = 0; } newMin = dataMin; newMax = dataMax; // Set the slider steps // We need to differiente between scientific calibrated data values and // uncalibrated, unphysical values scaled only within [0-65535] // We know this from the bscale values. // We deal typically with uncalibrated 8 bits [0-256], 16 bits [0=65535] // or calibrated 32 bits data, whose unit will depend on bscale. // if bscale = 1, we stick to a 16 bits range. This includes the 8-bits case (maybe this will change) colorRange = 65536.0f; sliderMin = 1; sliderMax = sliderMin + colorRange -1; if (bscale == 1) { sliderScaleStep = 1.0f; qDebug() << "rImageDock:: sliderScaleStep =" << sliderScaleStep; // Set initial constrast stretching factors alpha = 1.0f / colorRange; beta = 0.0f; } else // Stretch the data into their physical range at 16-bits precision. { sliderScaleStep = dataRange/colorRange; // Set initial constrast stretching factors alpha = (float) (1.0f / dataRange); beta = (float) (-newMin / dataRange); } oglWidget->setAlpha(alpha); oglWidget->setBeta(beta); // Create the Sliders and Layout of the dock widget. //QLabels setup QLabel *labelHigh = new QLabel("High"); QLabel *labelLow = new QLabel("Low"); QLabel *labelGamma = new QLabel("Gamma"); //QSliders setup sliderHigh = new QSlider(Qt::Horizontal); sliderLow = new QSlider(Qt::Horizontal); sliderGamma = new QSlider(Qt::Horizontal); float gammaRange = 40; maxGamma = 2.1; minGamma = 0.1; sliderGammaStep = (maxGamma - minGamma)/gammaRange; // set sliders range sliderHigh->setRange((int)sliderMin, (int)sliderMax); sliderHigh->setSingleStep(1); sliderLow->setRange((int)sliderMin, (int)sliderMax); sliderLow->setSingleStep(1); sliderGamma->setRange(1, (int) gammaRange); sliderLow->setSingleStep(1); // set sliders value sliderHigh->setValue(sliderMax); sliderLow->setValue(sliderMin); sliderGamma->setValue(convertGammaToSlider(QString::number(gamma))); //QLineEdit setup valueHighLineEdit = new QLineEdit(QString::number(dataMax, format, precision)); valueLowLineEdit = new QLineEdit(QString::number(dataMin, format, precision)); valueGammaLineEdit = new QLineEdit(QString::number(gamma)); int editMinimumWidth = 20; int editMaximumWidth = 60; valueHighLineEdit->setMinimumWidth(editMinimumWidth); valueHighLineEdit->setMaximumWidth(editMaximumWidth); valueLowLineEdit->setMinimumWidth(editMinimumWidth); valueLowLineEdit->setMaximumWidth(editMaximumWidth); valueGammaLineEdit->setMinimumWidth(editMinimumWidth); valueGammaLineEdit->setMaximumWidth(editMaximumWidth); // QGridLayout setup QGridLayout *sliderLayout = new QGridLayout(); // Add the labels sliderLayout->addWidget(labelHigh, 0, 0); sliderLayout->addWidget(labelLow, 1, 0); sliderLayout->addWidget(labelGamma, 2, 0); // Add the sliders sliderLayout->addWidget(sliderHigh, 0, 1); sliderLayout->addWidget(sliderLow, 1, 1); sliderLayout->addWidget(sliderGamma, 2, 1); // Add the line edits. sliderLayout->addWidget(valueHighLineEdit, 0, 2); sliderLayout->addWidget(valueLowLineEdit, 1, 2); sliderLayout->addWidget(valueGammaLineEdit, 2, 2); // Define the minimum spacing between sliders. This may need some adjusting. int vSpacing = 0; int hSpacing = 10; //QMargins margins(10, 10, 5, 5); //sliderLayout->setContentsMargins(margins); sliderLayout->setVerticalSpacing(vSpacing); sliderLayout->setHorizontalSpacing(hSpacing); // Set the minimum column widths of the layout, int sliderWidth = 350; int lineEditWidth = 20; sliderLayout->setColumnMinimumWidth(1, sliderWidth); sliderLayout->setColumnMinimumWidth(2, lineEditWidth); sliderLayout->setMargin(0); QWidget *sliderWidget = new QWidget(); sliderWidget->setLayout(sliderLayout); sliderWidget->setMinimumHeight(60); // Calibration type QWidget *calibrationTypeWidget = new QWidget(); light = new QCheckBox(QString("Light")); bias = new QCheckBox(QString("Bias")); dark = new QCheckBox(QString("Dark")); flat = new QCheckBox(QString("Flat")); // Histrogram button QPushButton *histButton = new QPushButton("Histogram"); QGridLayout *grid = new QGridLayout(); grid->addWidget(light,0,0); grid->addWidget(bias,0,1); grid->addWidget(dark,1,0); grid->addWidget(flat,1,1); grid->addWidget(histButton, 2, 0, 1, 2); grid->setMargin(0); calibrationTypeWidget->setLayout(grid); calibrationTypeWidget->setMinimumHeight(60); QHBoxLayout *hBox = new QHBoxLayout(); hBox->addWidget(sliderWidget); hBox->addWidget(calibrationTypeWidget); // Set the above layout in this QWidget setLayout(hBox); setMinimumWidth(600); //setMaximumWidth(800); setMaximumHeight(80); // Connect the change of the slider position with the QLineEdit QObject::connect(sliderHigh, SIGNAL(valueChanged(int)), this, SLOT(updateQLineEditSlot(int))); QObject::connect(sliderLow, SIGNAL(valueChanged(int)), this, SLOT(updateQLineEditSlot(int))); QObject::connect(sliderGamma, SIGNAL(valueChanged(int)), this, SLOT(updateQLineEditSlot(int))); QObject::connect(valueHighLineEdit, SIGNAL( returnPressed()), this, SLOT(setSliderValueSlot())); QObject::connect(valueLowLineEdit, SIGNAL( returnPressed()), this, SLOT(setSliderValueSlot())); QObject::connect(valueGammaLineEdit, SIGNAL( returnPressed()), this, SLOT(setSliderValueSlot())); //Connect the slider value changed with the Image display. QObject::connect(sliderHigh, SIGNAL(valueChanged(int)), this, SLOT(scaleImageSlot(int))); QObject::connect(sliderLow, SIGNAL(valueChanged(int)), this, SLOT(scaleImageSlot(int))); QObject::connect(sliderGamma, SIGNAL(valueChanged(int)), this, SLOT(gammaScaleImageSlot(int))); QObject::connect(histButton, SIGNAL(released()), this, SLOT(drawHist())); // Connect mouse events with OGLWidget QObject::connect(newOGLWidget, SIGNAL(destroyed(QObject*)), this, SLOT(deleteLater())); qRegisterMetaType<QVector<int> >("QVector<int>"); qRegisterMetaType<QVector<QString> >("QVector<QString>"); // Get initial tatistics calcStats(); autoScale(); }
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())); }
ListReports::ListReports(const QString &logname,const QString &description, const QString service_name,const QDate &start_date, const QDate &end_date,bool auto_refresh, RDLogEvent *events,QWidget *parent) : QDialog(parent,"",true) { list_log_name=logname; list_description=description; list_service_name=service_name; list_start_date=start_date; list_end_date=end_date; list_auto_refresh=auto_refresh; list_events=events; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); setCaption(tr("RDLibrary Reports")); // // Create Fonts // QFont font=QFont("Helvetica",12,QFont::Bold); font.setPixelSize(12); QFont select_font=QFont("Helvetica",12,QFont::Normal); select_font.setPixelSize(12); // // Reports List // list_reports_box=new QComboBox(this); list_reports_box->setGeometry(50,10,sizeHint().width()-60,19); list_reports_box->insertItem(tr("Log Listing")); list_reports_box->insertItem(tr("Log Exception Report")); QLabel *list_reports_label= new QLabel(list_reports_box,tr("Type:"),this); list_reports_label->setGeometry(10,10,35,19); list_reports_label->setFont(font); list_reports_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix); // // Effective Date // list_date_edit=new QDateEdit(this); list_date_edit->setGeometry(110,34,100,19); QLabel *list_date_label=new QLabel(list_date_edit,tr("Effective Date:"),this); list_date_label->setGeometry(10,34,95,19); list_date_label->setFont(font); list_date_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix); QPushButton *button=new QPushButton(this); button->setGeometry(215,32,60,24); button->setFont(select_font); button->setText(tr("&Select")); connect(button,SIGNAL(clicked()),this,SLOT(selectDateData())); list_date_edit->setDate(QDate::currentDate()); // // Generate Button // button=new QPushButton(this); button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); button->setDefault(true); button->setFont(font); button->setText(tr("&Generate")); connect(button,SIGNAL(clicked()),this,SLOT(generateData())); // // Close Button // button=new QPushButton(this); button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50); button->setFont(font); button->setText(tr("&Close")); connect(button,SIGNAL(clicked()),this,SLOT(closeData())); }
EditWinner::EditWinner(QWidget *parent) : QDialog(parent) { edit_id=-1; edit_driver=NULL; edit_line=-1; edit_meta_data=NULL; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumWidth(sizeHint().width()); setMaximumHeight(sizeHint().height()); // // Create Fonts // QFont label_font=QFont("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); QFont font=QFont("Helvetica",12,QFont::Normal); font.setPixelSize(12); // // Name // edit_first_name_edit=new QLineEdit(this); edit_first_name_edit->setFont(font); edit_first_name_label= new QLabel(edit_first_name_edit,"First Name",this); edit_first_name_label->setAlignment(Qt::AlignLeft|Qt::AlignBottom); edit_first_name_label->setFont(label_font); edit_last_name_edit=new QLineEdit(this); edit_last_name_edit->setFont(font); edit_last_name_label= new QLabel(edit_last_name_edit,"Last Name",this); edit_last_name_label->setAlignment(Qt::AlignLeft|Qt::AlignBottom); edit_last_name_label->setFont(label_font); // // Gender // edit_gender_box=new QComboBox(this); edit_gender_box->insertItem(0,"Unknown","U"); edit_gender_box->insertItem(1,"Female","F"); edit_gender_box->insertItem(2,"Male","M"); edit_gender_label= new QLabel(edit_gender_box,"Gender",this); edit_gender_label->setAlignment(Qt::AlignLeft|Qt::AlignBottom); edit_gender_label->setFont(label_font); // // Age // edit_age_spin=new QSpinBox(this); edit_age_spin->setRange(0,120); edit_age_spin->setSpecialValueText(tr("Unknown")); edit_age_label=new QLabel(edit_age_spin,"Age",this); edit_age_label->setAlignment(Qt::AlignLeft|Qt::AlignBottom); edit_age_label->setFont(label_font); // // Status // edit_status_box=new QComboBox(this); edit_status_box->insertItem(0,"Complete"); edit_status_box->insertItem(1,"Pending"); edit_status_box->insertItem(2,"Cancelled"); edit_status_label=new QLabel(edit_status_box,"Status",this); edit_status_label->setAlignment(Qt::AlignLeft|Qt::AlignBottom); edit_status_label->setFont(label_font); // // Address // edit_address1_edit=new QLineEdit(this); edit_address1_edit->setFont(font); edit_address2_edit=new QLineEdit(this); edit_address2_edit->setFont(font); edit_address_label=new QLabel(edit_address1_edit,"Address",this); edit_address_label->setAlignment(Qt::AlignLeft|Qt::AlignBottom); edit_address_label->setFont(label_font); // // City // edit_city_edit=new QLineEdit(this); edit_city_edit->setFont(font); edit_city_label=new QLabel(edit_city_edit,"City",this); edit_city_label->setAlignment(Qt::AlignLeft|Qt::AlignBottom); edit_city_label->setFont(label_font); // // State // edit_state_edit=new QLineEdit(this); edit_state_edit->setFont(font); edit_state_label=new QLabel(edit_state_edit,"State",this); edit_state_label->setAlignment(Qt::AlignLeft|Qt::AlignBottom); edit_state_label->setFont(label_font); // // Zipcode // edit_zipcode_edit=new QLineEdit(this); edit_zipcode_edit->setFont(font); edit_zipcode_label=new QLabel(edit_zipcode_edit,"Zipcode",this); edit_zipcode_label->setAlignment(Qt::AlignLeft|Qt::AlignBottom); edit_zipcode_label->setFont(label_font); // // Contact Phone // edit_phone_edit=new QLineEdit(this); edit_phone_edit->setFont(font); edit_phone_label=new QLabel(edit_phone_edit,"Contact Phone Number",this); edit_phone_label->setAlignment(Qt::AlignLeft|Qt::AlignBottom); edit_phone_label->setFont(label_font); // // E-Mail // edit_email_edit=new QLineEdit(this); edit_email_edit->setFont(font); edit_email_label=new QLabel(edit_email_edit,"E-Mail Address",this); edit_email_label->setAlignment(Qt::AlignLeft|Qt::AlignBottom); edit_email_label->setFont(label_font); // // Prize Description // edit_prize_description_edit=new QTextEdit(this); edit_prize_description_edit->setFont(font); edit_prize_description_label= new QLabel(edit_prize_description_edit,"Prize Description",this); edit_prize_description_label->setFont(label_font); // // Remarks // edit_remarks_edit=new QTextEdit(this); edit_remarks_edit->setFont(font); edit_remarks_label=new QLabel(edit_remarks_edit,"Remarks",this); edit_remarks_label->setFont(label_font); // // OK Button // QPushButton *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())); }
RDListLogs::RDListLogs(QString *logname,const QString &stationname, QWidget *parent,const char *name,RDUser *rduser) : QDialog(parent,name,true) { list_stationname=stationname; list_logname=logname; list_user=rduser; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Generate Fonts // QFont button_font("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); if (list_user != 0) { // RDStation::UserSec setCaption(QString().sprintf("%s%s",(const char *)tr("Select Log - User: "******"Select Log")); } // // Log List // list_log_list=new QListView(this,"list_log_list"); list_log_list->setGeometry(10,10, sizeHint().width()-20,sizeHint().height()-80); list_log_list->setAllColumnsShowFocus(true); list_log_list->setItemMargin(5); list_log_list->setSelectionMode(QListView::Single); connect(list_log_list, SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)), this, SLOT(doubleClickedData(QListViewItem *,const QPoint &,int))); list_log_list->addColumn(tr("NAME")); list_log_list->setColumnAlignment(0,Qt::AlignLeft); list_log_list->addColumn(tr("DESCRIPTION")); list_log_list->setColumnAlignment(1,Qt::AlignLeft); list_log_list->addColumn(tr("SERVICE")); list_log_list->setColumnAlignment(2,Qt::AlignLeft); // // OK Button // QPushButton *button=new QPushButton(this,"load_button"); button->setGeometry(sizeHint().width()-190,sizeHint().height()-60,80,50); button->setFont(button_font); button->setText(tr("OK")); connect(button,SIGNAL(clicked()),this,SLOT(okButtonData())); // // Cancel Button // button=new QPushButton(this,"cancel_button"); button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50); button->setFont(button_font); button->setText(tr("Cancel")); button->setDefault(true); connect(button,SIGNAL(clicked()),this,SLOT(cancelButtonData())); RefreshList(); }
AddMeta::AddMeta(QWidget *parent,const char *name) : QDialog(parent,name,true,Qt::WStyle_Customize|Qt::WStyle_DialogBorder) { setCaption(""); // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Generate Fonts // 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); // // Title Label // QLabel *label=new QLabel(tr("Insert a:"),this,"title_label"); label->setGeometry(0,0,sizeHint().width(),30); label->setFont(label_font); label->setAlignment(AlignCenter); // // Marker Button // QPushButton *button=new QPushButton(this,"marker_button"); button->setGeometry(10,30,sizeHint().width()-20,50); button->setFont(button_font); button->setText(tr("&Marker")); connect(button,SIGNAL(clicked()),this,SLOT(markerData())); // // Voice Track Button // button=new QPushButton(this,"track_button"); button->setGeometry(10,80,sizeHint().width()-20,50); button->setFont(button_font); button->setText(tr("Voice &Track")); connect(button,SIGNAL(clicked()),this,SLOT(trackData())); // // Chain Button // button=new QPushButton(this,"chain_button"); button->setGeometry(10,130,sizeHint().width()-20,50); button->setFont(button_font); button->setText(tr("Log C&hain")); connect(button,SIGNAL(clicked()),this,SLOT(chainData())); // // Cancel Button // button=new QPushButton(this,"cancel_button"); button->setGeometry(10,sizeHint().height()-60,sizeHint().width()-20,50); button->setFont(button_font); button->setText(tr("&Cancel")); button->setDefault(true); connect(button,SIGNAL(clicked()),this,SLOT(cancelData())); }
GameCFGWidget::GameCFGWidget(QWidget* parent) : QGroupBox(parent) , mainLayout(this) , seedRegexp("\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}") { mainLayout.setMargin(0); setMinimumHeight(310); setMaximumHeight(447); setMinimumWidth(470); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_master = true; // Easy containers for the map/game options in either stacked or tabbed mode mapContainerFree = new QWidget(); mapContainerTabbed = new QWidget(); optionsContainerFree = new QWidget(); optionsContainerTabbed = new QWidget(); tabbed = false; // Container for when in tabbed mode tabs = new QTabWidget(this); tabs->setFixedWidth(470); tabs->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); tabs->addTab(mapContainerTabbed, tr("Map")); tabs->addTab(optionsContainerTabbed, tr("Game options")); tabs->setObjectName("gameCfgWidgetTabs"); mainLayout.addWidget(tabs, 1); tabs->setVisible(false); // Container for when in stacked mode StackContainer = new QWidget(); StackContainer->setObjectName("gameStackContainer"); mainLayout.addWidget(StackContainer, 1); QVBoxLayout * stackLayout = new QVBoxLayout(StackContainer); // Map options pMapContainer = new HWMapContainer(mapContainerFree); stackLayout->addWidget(mapContainerFree, 0, Qt::AlignHCenter); pMapContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pMapContainer->setFixedSize(width() - 14, 278); mapContainerFree->setFixedSize(pMapContainer->width(), pMapContainer->height()); // Horizontal divider QFrame * divider = new QFrame(); divider->setFrameShape(QFrame::HLine); divider->setFrameShadow(QFrame::Plain); stackLayout->addWidget(divider, 0, Qt::AlignBottom); //stackLayout->setRowMinimumHeight(1, 10); // Game options optionsContainerTabbed->setContentsMargins(0, 0, 0, 0); optionsContainerFree->setFixedSize(width() - 14, 140); stackLayout->addWidget(optionsContainerFree, 0, Qt::AlignHCenter); OptionsInnerContainer = new QWidget(optionsContainerFree); m_childWidgets << OptionsInnerContainer; OptionsInnerContainer->setFixedSize(optionsContainerFree->width(), optionsContainerFree->height()); OptionsInnerContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); GBoxOptionsLayout = new QGridLayout(OptionsInnerContainer); GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Style"), this), 1, 0); Scripts = new QComboBox(this); GBoxOptionsLayout->addWidget(Scripts, 1, 1); Scripts->setModel(DataManager::instance().gameStyleModel()); m_curScript = Scripts->currentText(); connect(Scripts, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptChanged(int))); QWidget *SchemeWidget = new QWidget(this); GBoxOptionsLayout->addWidget(SchemeWidget, 2, 0, 1, 2); QGridLayout *SchemeWidgetLayout = new QGridLayout(SchemeWidget); SchemeWidgetLayout->setMargin(0); GameSchemes = new QComboBox(SchemeWidget); SchemeWidgetLayout->addWidget(GameSchemes, 0, 2); connect(GameSchemes, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeChanged(int))); SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Scheme"), SchemeWidget), 0, 0); QPixmap pmEdit(":/res/edit.png"); QPushButton * goToSchemePage = new QPushButton(SchemeWidget); goToSchemePage->setWhatsThis(tr("Edit schemes")); goToSchemePage->setIconSize(pmEdit.size()); goToSchemePage->setIcon(pmEdit); goToSchemePage->setMaximumWidth(pmEdit.width() + 6); SchemeWidgetLayout->addWidget(goToSchemePage, 0, 3); connect(goToSchemePage, SIGNAL(clicked()), this, SLOT(jumpToSchemes())); SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Weapons"), SchemeWidget), 1, 0); WeaponsName = new QComboBox(SchemeWidget); SchemeWidgetLayout->addWidget(WeaponsName, 1, 2); connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int))); QPushButton * goToWeaponPage = new QPushButton(SchemeWidget); goToWeaponPage->setWhatsThis(tr("Edit weapons")); goToWeaponPage->setIconSize(pmEdit.size()); goToWeaponPage->setIcon(pmEdit); goToWeaponPage->setMaximumWidth(pmEdit.width() + 6); SchemeWidgetLayout->addWidget(goToWeaponPage, 1, 3); connect(goToWeaponPage, SIGNAL(clicked()), this, SLOT(jumpToWeapons())); bindEntries = new QCheckBox(SchemeWidget); bindEntries->setWhatsThis(tr("Game scheme will auto-select a weapon")); bindEntries->setChecked(true); bindEntries->setMaximumWidth(42); bindEntries->setStyleSheet( "QCheckBox::indicator:checked { image: url(\":/res/lock.png\"); }" "QCheckBox::indicator:unchecked { image: url(\":/res/unlock.png\"); }" ); SchemeWidgetLayout->addWidget(bindEntries, 0, 1, 0, 1, Qt::AlignVCenter); connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SLOT(seedChanged(const QString &))); connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &))); connect(pMapContainer, SIGNAL(mapgenChanged(MapGenerator)), this, SLOT(mapgenChanged(MapGenerator))); connect(pMapContainer, SIGNAL(mazeSizeChanged(int)), this, SLOT(maze_sizeChanged(int))); connect(pMapContainer, SIGNAL(mapFeatureSizeChanged(int)), this, SLOT(slMapFeatureSizeChanged(int))); connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SLOT(themeChanged(const QString &))); connect(pMapContainer, SIGNAL(newTemplateFilter(int)), this, SLOT(templateFilterChanged(int))); connect(pMapContainer, SIGNAL(drawMapRequested()), this, SIGNAL(goToDrawMap())); connect(pMapContainer, SIGNAL(drawnMapChanged(const QByteArray &)), this, SLOT(onDrawnMapChanged(const QByteArray &))); connect(&DataManager::instance(), SIGNAL(updated()), this, SLOT(updateModelViews())); }