コード例 #1
0
ListReports::ListReports(const QString &filter,const QString &type_filter,
			 const QString &group,const QString &schedcode,
			 QWidget *parent)
  : QDialog(parent,"",true)
{
  list_filter=filter;
  list_type_filter=type_filter;
  list_group=group;
  list_schedcode=schedcode;

  //
  // 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);

  //
  // Reports List
  //
  list_reports_box=new QComboBox(this);
  list_reports_box->setGeometry(50,10,sizeHint().width()-60,19);
  list_reports_box->insertItem(tr("Cart Report"));
  list_reports_box->insertItem(tr("Cut Report"));
  list_reports_box->insertItem(tr("Cart Data Dump (fixed width)"));
  list_reports_box->insertItem(tr("Cart Data Dump (CSV)"));
  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);
  connect(list_reports_box,SIGNAL(activated(int)),
	  this,SLOT(typeActivatedData(int)));

  //
  // Field Names Checkbox
  //
  list_fieldnames_check=new QCheckBox(this);
  list_fieldnames_check->setGeometry(55,34,15,15);
  list_fieldnames_check->setChecked(true);
  list_fieldnames_check->setDisabled(true);
  list_fieldnames_label=
    new QLabel(list_fieldnames_check,tr("Prepend Field Names"),this);
  list_fieldnames_label->setGeometry(75,32,sizeHint().width()-75,19);
  list_fieldnames_label->setFont(font);
  list_fieldnames_label->setAlignment(AlignLeft|AlignVCenter|ShowPrefix);
  list_fieldnames_label->setDisabled(true);

  //
  //  Generate Button
  //
  QPushButton *generate_button=new QPushButton(this);
  generate_button->
    setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  generate_button->setDefault(true);
  generate_button->setFont(font);
  generate_button->setText(tr("&Generate"));
  connect(generate_button,SIGNAL(clicked()),this,SLOT(generateData()));

  //
  //  Close Button
  //
  QPushButton *close_button=new QPushButton(this);
  close_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
			     80,50);
  close_button->setFont(font);
  close_button->setText(tr("&Close"));
  connect(close_button,SIGNAL(clicked()),this,SLOT(closeData()));
}
コード例 #2
0
ファイル: test_import.cpp プロジェクト: bpm1992/rivendell
TestImport::TestImport(RDSvc *svc,RDSvc::ImportSource src,QWidget *parent,
		       const char *name)
  : QDialog(parent,name,true)
{
  QString sql;
  QDate current_date=QDate::currentDate();

  test_svc=svc;
  test_src=src;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());

  switch(test_src) {
      case RDSvc::Traffic:
	setCaption(tr("Test Traffic Import"));
	break;

      case RDSvc::Music:
	setCaption(tr("Test Music Import"));
	break;

      case RDSvc::NoSource:
        break;
  }

  //
  // Create Fonts
  //
  QFont font=QFont("Helvetica",12,QFont::Bold);
  font.setPixelSize(12);
  QFont section_font=QFont("Helvetica",14,QFont::Bold);
  section_font.setPixelSize(14);

  //
  // Date Selector
  //
  test_date_edit=new QDateEdit(this,"test_date_edit");
  test_date_label=new QLabel(test_date_edit,tr("Test Date:"),this);
  test_date_label->setFont(font);
  test_date_label->setAlignment(AlignVCenter|AlignRight);
  test_date_edit->setDate(current_date);
  connect(test_date_edit,SIGNAL(valueChanged(const QDate &)),
	  this,SLOT(dateChangedData(const QDate &)));

  //
  // Select Date Button
  //
  test_select_button=new QPushButton(this);
  test_select_button->setFont(font);
  test_select_button->setText(tr("&Select"));
  connect(test_select_button,SIGNAL(clicked()),this,SLOT(selectData()));

  //
  // Import Button
  //
  test_import_button=new QPushButton(this);
  test_import_button->setFont(font);
  test_import_button->setText(tr("&Import"));
  connect(test_import_button,SIGNAL(clicked()),this,SLOT(importData()));

  //
  // Import Filename
  //
  test_filename_edit=new QLineEdit(this);
  test_filename_edit->setReadOnly(true);
  test_filename_label=
    new QLabel(test_filename_edit,tr("Using source file:"),this);
  test_filename_label->setFont(font);

  //
  // Events List
  //
  test_events_list=new RDListView(this);
  test_events_list->setItemMargin(2);
  test_events_list->addColumn(tr("Start Time"));
  test_events_list->setColumnAlignment(0,AlignCenter);
  test_events_list->addColumn(tr("Cart"));
  test_events_list->setColumnAlignment(1,AlignCenter);
  test_events_list->addColumn(tr("Len"));
  test_events_list->setColumnAlignment(2,AlignRight);
  test_events_list->addColumn(tr("Title"));
  test_events_list->setColumnAlignment(3,AlignLeft);
  test_events_list->addColumn(tr("Trans"));
  test_events_list->setColumnAlignment(4,AlignCenter);
  test_events_list->addColumn(tr("Time Type"));
  test_events_list->setColumnAlignment(5,AlignCenter);
  test_events_list->addColumn(tr("Wait Time"));
  test_events_list->setColumnAlignment(6,AlignCenter);
  test_events_list->addColumn(tr("Contract #"));
  test_events_list->setColumnAlignment(7,AlignCenter);
  test_events_list->addColumn(tr("Event ID"));
  test_events_list->setColumnAlignment(8,AlignCenter);
  test_events_list->addColumn(tr("Announcement Type"));
  test_events_list->setColumnAlignment(9,AlignCenter);
  test_events_list->setColumnSortType(0,RDListView::LineSort);
  test_events_label=new QLabel(test_events_list,tr("Imported Events"),this);
  test_events_label->setFont(font);

  //
  //  Close Button
  //
  test_close_button=new QPushButton(this);
  test_close_button->setFont(font);
  test_close_button->setText(tr("&Close"));
  connect(test_close_button,SIGNAL(clicked()),this,SLOT(closeData()));

  dateChangedData(current_date);
}
コード例 #3
0
void SAGraphicsTitleBarButton::setFixedHeight(qreal height)
{
    setMinimumHeight(height);
    setMaximumHeight(height);
}
コード例 #4
0
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));
}
コード例 #5
0
ファイル: TwoDPanelDlg.cpp プロジェクト: subprotocol/xflr5
void TwoDPanelDlg::SetupLayout()
{
	setWindowTitle(tr("Global Panel Refinement"));
	QGridLayout *pInputDataLayout = new QGridLayout;
	{
		QLabel *l1 = new QLabel(tr("Number of Panels"));
		QLabel *l2 = new QLabel(tr("Panel Bunching Parameter"));
		QLabel *l3 = new QLabel(tr("TE/LE Panel Density Ratio"));
		QLabel *l4 = new QLabel(tr("Refined area/LE Panel Density Ratio"));
		QLabel *l5 = new QLabel(tr("Top Side Refined Area x/c limits"));
		QLabel *l6 = new QLabel(tr("Bottom Side Refined Area x/c limits"));

		pInputDataLayout->addWidget(l1,1,1);
		pInputDataLayout->addWidget(l2,2,1);
		pInputDataLayout->addWidget(l3,3,1);
		pInputDataLayout->addWidget(l4,4,1);
		pInputDataLayout->addWidget(l5,5,1);
		pInputDataLayout->addWidget(l6,6,1);


		m_pctrlNPanels = new IntEdit(100, this);
		m_pctrlNPanels->SetMax(IQX);

		m_pctrlCVpar  = new DoubleEdit;
		m_pctrlCTErat = new DoubleEdit;
		m_pctrlCTRrat = new DoubleEdit;
		m_pctrlXsRef1 = new DoubleEdit;
		m_pctrlXsRef2 = new DoubleEdit;
		m_pctrlXpRef1 = new DoubleEdit;
		m_pctrlXpRef2 = new DoubleEdit;

		pInputDataLayout->addWidget(m_pctrlNPanels, 1, 2);
		pInputDataLayout->addWidget(m_pctrlCVpar,   2, 2);
		pInputDataLayout->addWidget(m_pctrlCTErat,  3, 2);
		pInputDataLayout->addWidget(m_pctrlCTRrat,  4, 2);
		pInputDataLayout->addWidget(m_pctrlXsRef1,  5, 2);
		pInputDataLayout->addWidget(m_pctrlXsRef2,  5, 3);
		pInputDataLayout->addWidget(m_pctrlXpRef1,  6, 2);
		pInputDataLayout->addWidget(m_pctrlXpRef2,  6, 3);

		connect(m_pctrlNPanels, SIGNAL(editingFinished()), this, SLOT(OnChanged()));
		connect(m_pctrlCVpar,   SIGNAL(editingFinished()), this, SLOT(OnChanged()));
		connect(m_pctrlCTErat,  SIGNAL(editingFinished()), this, SLOT(OnChanged()));
		connect(m_pctrlCTRrat,  SIGNAL(editingFinished()), this, SLOT(OnChanged()));
		connect(m_pctrlXsRef1,  SIGNAL(editingFinished()), this, SLOT(OnChanged()));
		connect(m_pctrlXsRef2,  SIGNAL(editingFinished()), this, SLOT(OnChanged()));
		connect(m_pctrlXpRef1,  SIGNAL(editingFinished()), this, SLOT(OnChanged()));
		connect(m_pctrlXpRef2,  SIGNAL(editingFinished()), this, SLOT(OnChanged()));
	}

	QHBoxLayout *pCommandButtonsLayout = new QHBoxLayout;
	{
		OKButton      = new QPushButton(tr("OK"));
		CancelButton  = new QPushButton(tr("Cancel"));
		ApplyButton   = new QPushButton(tr("Apply"));
		pCommandButtonsLayout->addStretch(1);
		pCommandButtonsLayout->addWidget(ApplyButton);
		pCommandButtonsLayout->addStretch(1);
		pCommandButtonsLayout->addWidget(OKButton);
		pCommandButtonsLayout->addStretch(1);
		pCommandButtonsLayout->addWidget(CancelButton);
		pCommandButtonsLayout->addStretch(1);
	}

	QVBoxLayout *pmainLayout = new QVBoxLayout;
	{
		pmainLayout->addStretch(1);
		pmainLayout->addLayout(pInputDataLayout);
		pmainLayout->addStretch(1);
		pmainLayout->addLayout(pCommandButtonsLayout);
		pmainLayout->addStretch(1);
		setLayout(pmainLayout);
	}

	connect(ApplyButton, SIGNAL(clicked()),this, SLOT(OnApply()));
	connect(OKButton, SIGNAL(clicked()),this, SLOT(OnOK()));
	connect(CancelButton, SIGNAL(clicked()), this, SLOT(reject()));

	setMinimumHeight(250);
}
コード例 #6
0
DownloadRepoDialog::DownloadRepoDialog(const Account& account,
                                       const ServerRepo& repo,
                                       const QString& password,
                                       QWidget *parent)
    : QDialog(parent),
      repo_(repo),
      account_(account),
      has_manual_merge_mode_(seafApplet->settingsManager()->isEnableSyncingWithExistingFolder())
{
    manual_merge_mode_ = false;
    setupUi(this);
    if (!repo.isSubfolder()) {
        setWindowTitle(tr("Sync library \"%1\"").arg(repo_.name));
    }
    else {
        setWindowTitle(tr("Sync folder \"%1\"").arg(repo.parent_path));
    }
    mDirectory->setPlaceholderText(getOperatingText(repo_));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    mRepoIcon->setPixmap(repo.getPixmap());
    mRepoName->setText(repo_.name);
    mOperationText->setText(tr("Sync to folder:"));

    if (repo_.encrypted) {
        if (!password.isEmpty()) {
            mPassword->setText(password);
            mPassword->setReadOnly(true);
        }
        mPassword->setVisible(true);
        mPasswordLabel->setVisible(true);
    } else {
        mPassword->setVisible(false);
        mPasswordLabel->setVisible(false);
    }

    int height = 250;
#if defined(Q_OS_MAC)
    layout()->setContentsMargins(8, 9, 9, 5);
    layout()->setSpacing(6);
    verticalLayout_3->setSpacing(6);
#endif
    if (repo.encrypted) {
        height += 100;
    }
    setMinimumHeight(height);
    setMaximumHeight(height);

    setDirectoryText(seafApplet->configurator()->worktreeDir());

    if (!has_manual_merge_mode_) {
        mMergeHint->setText(tr("If a sub-folder with same name exists, its contents will be merged."));

        mSwitchToSyncFrame->hide();
    } else {
        connect(mSwitchModeHint, SIGNAL(linkActivated(const QString &)),
                this, SLOT(switchMode()));
        updateSyncMode();

        mMergeHint->hide();
    }

    connect(mChooseDirBtn, SIGNAL(clicked()), this, SLOT(chooseDirAction()));
    connect(mOkBtn, SIGNAL(clicked()), this, SLOT(onOkBtnClicked()));
}
コード例 #7
0
ファイル: edit_user.cpp プロジェクト: ElvishArtisan/davit
EditUser::EditUser(QString lname,QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  edit_loginname=lname;
  edit_password_changed=false;
  DvtUser *user=new DvtUser(lname);

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumWidth(sizeHint().width());
  setMaximumHeight(sizeHint().height());

  setCaption("Davit - Edit User");

  //
  // Create Fonts
  //
  QFont label_font=QFont("Helvetica",12,QFont::Bold);
  label_font.setPixelSize(12);
  QFont font=QFont("Helvetica",12,QFont::Normal);
  font.setPixelSize(12);
  QFont section_font=QFont("Helvetica",10,QFont::Bold);
  section_font.setPixelSize(10);
  QFont small_font=QFont("Helvetica",10,QFont::Normal);
  font.setPixelSize(10);

  //
  // User Name
  //
  edit_loginname_edit=new QLineEdit(this,"edit_loginname_edit");
  edit_loginname_edit->setGeometry(120,10,80,20);
  edit_loginname_edit->setFont(font);
  edit_loginname_edit->setReadOnly(true);
  edit_loginname_edit->setText(user->name());
  QLabel *label=
    new QLabel(edit_loginname_edit,"User Name:",this,"edit_loginname_label");
  label->setGeometry(10,10,105,20);
  label->setAlignment(AlignRight|AlignVCenter);
  label->setFont(label_font);

  //
  // Full Name
  //
  edit_fullname_edit=new QLineEdit(this,"edit_fullname_edit");
  edit_fullname_edit->setGeometry(120,32,sizeHint().width()-130,20);
  edit_fullname_edit->setFont(font);
  edit_fullname_edit->setMaxLength(64);
  edit_fullname_edit->setText(user->fullName());
  label=new QLabel(edit_fullname_edit,"Full Name:",this,"edit_fullname_label");
  label->setGeometry(10,32,105,20);
  label->setAlignment(AlignRight|AlignVCenter);
  label->setFont(label_font);

  //
  // Description
  //
  edit_description_edit=new QLineEdit(this,"edit_description_edit");
  edit_description_edit->setGeometry(120,54,sizeHint().width()-130,20);
  edit_description_edit->setFont(font);
  edit_description_edit->setMaxLength(64);
  edit_description_edit->setText(user->description());
  label=new QLabel(edit_description_edit,"Description:",
		   this,"edit_description_label");
  label->setGeometry(10,54,105,20);
  label->setAlignment(AlignRight|AlignVCenter);
  label->setFont(label_font);

  //
  // Email
  //
  edit_email_edit=new QLineEdit(this,"edit_email_edit");
  edit_email_edit->setGeometry(120,76,sizeHint().width()-130,20);
  edit_email_edit->setFont(font);
  edit_email_edit->setMaxLength(64);
  edit_email_edit->setText(user->email());
  label=new QLabel(edit_email_edit,"E-Mail Address:",
		   this,"edit_email_label");
  label->setGeometry(10,76,105,20);
  label->setAlignment(AlignRight|AlignVCenter);
  label->setFont(label_font);

  //
  // Phone Number
  //
  edit_phone_edit=new QLineEdit(this,"edit_phone_edit");
  edit_phone_edit->setGeometry(120,98,120,20);
  edit_phone_edit->setFont(font);
  edit_phone_edit->setMaxLength(14);
  edit_phone_edit->setText(DvtFormatPhoneNumber(user->phoneNumber()));
  label=new QLabel(edit_phone_edit,"Phone Number:",this,"edit_phone_label");
  label->setGeometry(10,98,105,20);
  label->setAlignment(AlignRight|AlignVCenter);
  label->setFont(label_font);

  //
  // Change Password Button
  //
  QPushButton *button=new QPushButton(this,"passwd_button");
  button->setGeometry(sizeHint().width()-100,98,90,44);
  button->setFont(label_font);
  button->setText("Change\n&Password");
  connect(button,SIGNAL(clicked()),this,SLOT(changePasswordData()));

  //
  // Administrative Rights
  //
  QButtonGroup *group=new QButtonGroup(tr("Administrative Rights"),this);
  group->setGeometry(10,147,sizeHint().width()-20,45);
  group->setFont(label_font);

  edit_admin_box=new QCheckBox(group,"edit_admin_box");
  edit_admin_box->setGeometry(10,21,15,15);
  edit_admin_box->setChecked(user->privilege(DvtUser::PrivAdmin));
  connect(edit_admin_box,SIGNAL(toggled(bool)),
	  this,SLOT(adminToggledData(bool)));
  label=new QLabel(edit_admin_box,tr("Administer S&ystem"),group);
  label->setGeometry(30,21,150,19);
  label->setFont(small_font);
  label->setAlignment(AlignLeft|ShowPrefix);

  //
  // Affiliate Rights
  //
  group=new QButtonGroup(tr("Affiliate Rights"),this);
  group->setGeometry(10,200,sizeHint().width()-20,65);
  group->setFont(label_font);

  edit_affiliate_view_box=new QCheckBox(group,"edit_affiliate_view_box");
  edit_affiliate_view_box->setGeometry(10,21,15,15);
  edit_affiliate_view_box->
    setChecked(user->privilege(DvtUser::PrivAffiliateView));
  connect(edit_affiliate_view_box,SIGNAL(toggled(bool)),
	  this,SLOT(viewAffiliateToggledData(bool)));
  edit_affiliate_view_label=
    new QLabel(edit_affiliate_view_box,tr("View Affiliate Data"),group);
  edit_affiliate_view_label->setGeometry(30,21,130,19);
  edit_affiliate_view_label->setFont(small_font);
  edit_affiliate_view_label->setAlignment(AlignLeft|ShowPrefix);

  edit_affiliate_edit_box=new QCheckBox(group,"edit_affiliate_edit_box");
  edit_affiliate_edit_box->setGeometry(sizeHint().width()/2+10,21,15,15);
  edit_affiliate_edit_box->
    setChecked(user->privilege(DvtUser::PrivAffiliateEdit));
  edit_affiliate_edit_label=
    new QLabel(edit_affiliate_edit_box,tr("Edit Affiliate Data"),group);
  edit_affiliate_edit_label->setGeometry(sizeHint().width()/2+30,21,100,19);
  edit_affiliate_edit_label->setFont(small_font);
  edit_affiliate_edit_label->setAlignment(AlignLeft|ShowPrefix);

  edit_affiliate_schedule_box=
    new QCheckBox(group,"edit_affiliate_schedule_box");
  edit_affiliate_schedule_box->setGeometry(10,42,15,15);
  edit_affiliate_schedule_box->
    setChecked(user->privilege(DvtUser::PrivAffiliateSchedule));
  edit_affiliate_schedule_label=
    new QLabel(edit_affiliate_schedule_box,tr("Schedule Programs"),group);
  edit_affiliate_schedule_label->setGeometry(30,42,130,19);
  edit_affiliate_schedule_label->setFont(small_font);
  edit_affiliate_schedule_label->setAlignment(AlignLeft|ShowPrefix);

  edit_affiliate_remark_box=new QCheckBox(group,"edit_affiliate_remark_box");
  edit_affiliate_remark_box->setGeometry(sizeHint().width()/2+10,42,15,15);
  edit_affiliate_remark_box->
    setChecked(user->privilege(DvtUser::PrivAffiliateRemark));
  edit_affiliate_remark_label=
    new QLabel(edit_affiliate_remark_box,tr("Add Remarks"),group);
  edit_affiliate_remark_label->setGeometry(sizeHint().width()/2+30,42,100,19);
  edit_affiliate_remark_label->setFont(small_font);
  edit_affiliate_remark_label->setAlignment(AlignLeft|ShowPrefix);

  //
  // Provider Rights
  //
  group=new QButtonGroup(tr("Provider Rights"),this);
  group->setGeometry(10,277,sizeHint().width()-20,45);
  group->setFont(label_font);

  edit_provider_view_box=new QCheckBox(group,"edit_provider_view_box");
  edit_provider_view_box->setGeometry(10,21,15,15);
  edit_provider_view_box->
    setChecked(user->privilege(DvtUser::PrivProviderView));
  connect(edit_provider_view_box,SIGNAL(toggled(bool)),
	  this,SLOT(viewProviderToggledData(bool)));
  edit_provider_view_label=
    new QLabel(edit_provider_view_box,tr("View Provider Data"),group);
  edit_provider_view_label->setGeometry(30,21,130,19);
  edit_provider_view_label->setFont(small_font);
  edit_provider_view_label->setAlignment(AlignLeft|ShowPrefix);

  edit_provider_edit_box=new QCheckBox(group,"edit_provider_edit_box");
  edit_provider_edit_box->setGeometry(sizeHint().width()/2+10,21,15,15);
  edit_provider_edit_box->
    setChecked(user->privilege(DvtUser::PrivProviderEdit));
  edit_provider_edit_label=
    new QLabel(edit_provider_edit_box,tr("Edit Provider Data"),group);
  edit_provider_edit_label->setGeometry(sizeHint().width()/2+30,21,100,19);
  edit_provider_edit_label->setFont(small_font);
  edit_provider_edit_label->setAlignment(AlignLeft|ShowPrefix);

  //
  // Program Rights
  //
  group=new QButtonGroup(tr("Program Rights"),this);
  group->setGeometry(10,332,sizeHint().width()-20,45);
  group->setFont(label_font);

  edit_program_view_box=new QCheckBox(group,"edit_program_view_box");
  edit_program_view_box->setGeometry(10,21,15,15);
  edit_program_view_box->
    setChecked(user->privilege(DvtUser::PrivProgramView));
  connect(edit_program_view_box,SIGNAL(toggled(bool)),
	  this,SLOT(viewProgramToggledData(bool)));
  edit_program_view_label=
    new QLabel(edit_program_view_box,tr("View Program Data"),group);
  edit_program_view_label->setGeometry(30,21,130,19);
  edit_program_view_label->setFont(small_font);
  edit_program_view_label->setAlignment(AlignLeft|ShowPrefix);

  edit_program_edit_box=new QCheckBox(group,"edit_program_edit_box");
  edit_program_edit_box->setGeometry(sizeHint().width()/2+10,21,15,15);
  edit_program_edit_box->
    setChecked(user->privilege(DvtUser::PrivProgramEdit));
  edit_program_edit_label=
    new QLabel(edit_program_edit_box,tr("Edit Program Data"),group);
  edit_program_edit_label->setGeometry(sizeHint().width()/2+30,21,100,19);
  edit_program_edit_label->setFont(small_font);
  edit_program_edit_label->setAlignment(AlignLeft|ShowPrefix);

  //
  // Report Rights
  //
  group=new QButtonGroup(tr("Report Rights"),this);
  group->setGeometry(10,387,sizeHint().width()-20,45);
  group->setFont(label_font);

  edit_report_view_box=new QCheckBox(group,"edit_report_view_box");
  edit_report_view_box->setGeometry(10,21,15,15);
  edit_report_view_box->
    setChecked(user->privilege(DvtUser::PrivReportView));
  edit_report_view_label=
    new QLabel(edit_report_view_box,tr("View Reports"),group);
  edit_report_view_label->setGeometry(30,21,130,19);
  edit_report_view_label->setFont(small_font);
  edit_report_view_label->setAlignment(AlignLeft|ShowPrefix);

  //
  //  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()));
}
コード例 #8
0
ファイル: rdpanel.cpp プロジェクト: stgabmp/Rivendell
MainWidget::MainWidget(QWidget *parent,const char *name)
  :QWidget(parent,name)
{
  QPixmap *pm;
  QPainter *pd;
  QPixmap *mainmap;

  //
  // Fix the Window Size
  //
#ifndef RESIZABLE
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());
#endif  // RESIZABLE

  //
  // Load the command-line arguments
  //
  RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdpanel",
				   RDPANEL_USAGE);

  //
  // Generate Fonts
  //
  QFont button_font=QFont("Helvetica",16,QFont::Bold);
  button_font.setPixelSize(16);

  //
  // Create Icons
  //
  lib_rivendell_map=new QPixmap(rivendell_xpm);
  setIcon(*lib_rivendell_map);

  //
  // Ensure that system daemons are running
  //
  RDInitializeDaemons();

  //
  // Load Local Configs
  //
  panel_config=new RDConfig();
  panel_config->load();

  //
  // Open Database
  //
  panel_db=QSqlDatabase::addDatabase("QMYSQL3");
  if(!panel_db) {
    QMessageBox::warning(this,
	   "Can't Connect","Unable to connect to mySQL Server!",0,1,1);
    exit(0);
  }
  panel_db->setDatabaseName(panel_config->mysqlDbname());
  panel_db->setUserName(panel_config->mysqlUsername());
  panel_db->setPassword(panel_config->mysqlPassword());
  panel_db->setHostName(panel_config->mysqlHostname());
  if(!panel_db->open()) {
    QMessageBox::warning(this,
			 "Can't Connect","Unable to connect to mySQL Server!");
    panel_db->removeDatabase(panel_config->mysqlDbname());
    exit(0);
  }
  new RDDbHeartbeat(panel_config->mysqlHeartbeatInterval(),this);

  //
  // Master Clock Timer
  //
  panel_master_timer=new QTimer(this,"panel_master_timer");
  connect(panel_master_timer,SIGNAL(timeout()),this,SLOT(masterTimerData()));
  panel_master_timer->start(MASTER_TIMER_INTERVAL);

  //
  // CAE Connection
  //
  panel_cae=new RDCae(parent,name);
  panel_cae->connectHost("localhost",CAED_TCP_PORT,panel_config->password());

  //
  // Allocate Global Resources
  //
  rdstation_conf=new RDStation(panel_config->stationName());
  rdairplay_conf=new RDAirPlayConf(panel_config->stationName(),0,"RDPANEL");
  panel_skin_pixmap=new QPixmap(rdairplay_conf->skinPath());
  if(panel_skin_pixmap->isNull()||(panel_skin_pixmap->width()<1024)||
     (panel_skin_pixmap->height()<738)) {
    delete panel_skin_pixmap;
    panel_skin_pixmap=NULL;
  }
  else {
    setErasePixmap(*panel_skin_pixmap);
  }

  //
  // RIPC Connection
  //
  rdripc=new RDRipc(panel_config->stationName());
  connect(rdripc,SIGNAL(userChanged()),this,SLOT(userData()));
  connect(rdripc,SIGNAL(rmlReceived(RDMacro *)),
	  this,SLOT(rmlReceivedData(RDMacro *)));
//  rdripc->connectHost("localhost",RIPCD_TCP_PORT,panel_config->password());

  //
  // User
  //
  rduser=NULL;

  //
  // Meter Timer
  //
  QTimer *timer=new QTimer(this,"meter_timer");
  connect(timer,SIGNAL(timeout()),this,SLOT(meterData()));
  timer->start(METER_INTERVAL);

  //
  // Macro Player
  //
  panel_player=new RDEventPlayer(rdripc,this);

  //
  // Cart Picker
  //
  panel_cart_dialog=new RDCartDialog(&panel_filter,&panel_group,
				     rdairplay_conf->card(3),
				     rdairplay_conf->port(3),
				     0,0,panel_cae,rdripc,rdstation_conf,
				     rdstation_conf->editorPath(),
				     this,"panel_cart_dialog");

  //
  // Sound Panel Array
  //
  if (rdairplay_conf->panels(RDAirPlayConf::StationPanel) || 
      rdairplay_conf->panels(RDAirPlayConf::UserPanel)){
    int card=-1;
    panel_panel=
      new RDSoundPanel(RDPANEL_PANEL_BUTTON_COLUMNS,RDPANEL_PANEL_BUTTON_ROWS,
		       rdairplay_conf->panels(RDAirPlayConf::StationPanel),
		       rdairplay_conf->panels(RDAirPlayConf::UserPanel),
		       rdairplay_conf->flashPanel(),
		       rdairplay_conf->buttonLabelTemplate(),true,panel_player,
		       rdripc,panel_cae,rdstation_conf,panel_cart_dialog,
		       this,"panel_panel");
    panel_panel->setLogfile(panel_config->airplayLogname());
    panel_panel->setGeometry(10,10,panel_panel->sizeHint().width(),
			 panel_panel->sizeHint().height());
    if(panel_skin_pixmap!=NULL) {
      pm=new QPixmap(1024,738);
      pd=new QPainter(pm);
      pd->drawPixmap(-10,-10,*panel_skin_pixmap);
      pd->end();
      panel_panel->setErasePixmap(*pm);
      delete pd;
      delete pm;
    }
    panel_panel->setPauseEnabled(rdairplay_conf->panelPauseEnabled());
    panel_panel->setCard(0,rdairplay_conf->card(2));
    panel_panel->setPort(0,rdairplay_conf->port(2));
    panel_panel->setFocusPolicy(QWidget::NoFocus);
    if((card=rdairplay_conf->card(6))<0) {
      panel_panel->setCard(1,panel_panel->card(0));
      panel_panel->setPort(1,panel_panel->port(0));
    }
    else {
      panel_panel->setCard(1,card);
      panel_panel->setPort(1,rdairplay_conf->port(6));
    }
    if((card=rdairplay_conf->card(7))<0) {
      panel_panel->setCard(2,panel_panel->card(1));
      panel_panel->setPort(2,panel_panel->port(1));
    }
    else {
      panel_panel->setCard(2,card);
      panel_panel->setPort(2,rdairplay_conf->port(7));
    }
    if((card=rdairplay_conf->card(8))<0) {
      panel_panel->setCard(3,panel_panel->card(2));
      panel_panel->setPort(3,panel_panel->port(2));
    }
    else {
      panel_panel->setCard(3,card);
      panel_panel->setPort(3,rdairplay_conf->port(8));
    }
    if((card=rdairplay_conf->card(9))<0) {
      panel_panel->setCard(4,panel_panel->card(3));
      panel_panel->setPort(4,panel_panel->port(3));
    }
    else {
      panel_panel->setCard(4,card);
      panel_panel->setPort(4,rdairplay_conf->port(9));
    }

    //
    // Calculate Valid Ports for Reading Meter Data (No Duplicates)
    //
    for(int i=4;i>=0;i--) {
      meter_data_valid[i]=(panel_panel->card(i)>=0);
      for(int j=0;j<i;j++) {
	if((panel_panel->card(i)==panel_panel->card(j))&&
	   (panel_panel->port(i)==panel_panel->port(j))) {
	  meter_data_valid[i]=false;
	}
      }
    }

    panel_panel->
      setRmls(0,rdairplay_conf->startRml(2),rdairplay_conf->stopRml(2));
    panel_panel->
      setRmls(1,rdairplay_conf->startRml(6),rdairplay_conf->stopRml(6));
    panel_panel->
      setRmls(2,rdairplay_conf->startRml(7),rdairplay_conf->stopRml(7));
    panel_panel->
      setRmls(3,rdairplay_conf->startRml(8),rdairplay_conf->stopRml(8));
    panel_panel->
      setRmls(4,rdairplay_conf->startRml(9),rdairplay_conf->stopRml(9));
    panel_panel->setSvcName(rdairplay_conf->defaultSvc());
    connect(rdripc,SIGNAL(userChanged()),panel_panel,SLOT(changeUser()));
    connect(panel_master_timer,SIGNAL(timeout()),
	    panel_panel,SLOT(tickClock()));
  }

  //
  // Audio Meter
  //
  panel_stereo_meter=new RDStereoMeter(this,"panel_stereo_meter");
  panel_stereo_meter->
    setGeometry(40,
		sizeHint().height()-panel_stereo_meter->sizeHint().height()-7,
		panel_stereo_meter->sizeHint().width(),
		panel_stereo_meter->sizeHint().height());
  panel_stereo_meter->setMode(RDSegMeter::Peak);
  panel_stereo_meter->setFocusPolicy(QWidget::NoFocus);
  if(panel_config->useStreamMeters()) {
    panel_stereo_meter->hide();
  }

  rdripc->connectHost("localhost",RIPCD_TCP_PORT,panel_config->password());

  //
  // Signal Handlers
  //
  signal(SIGCHLD,SigHandler);
}
コード例 #9
0
void RTIMULibDemoGL::layoutWindow()
{
    QHBoxLayout *mainLayout = new QHBoxLayout();
    mainLayout->setContentsMargins(3, 3, 3, 3);
    mainLayout->setSpacing(3);

    QVBoxLayout *vLayout = new QVBoxLayout();
    vLayout->addSpacing(10);

    QHBoxLayout *imuLayout = new QHBoxLayout();
    vLayout->addLayout(imuLayout);
    imuLayout->addWidget(new QLabel("IMU type: "));
    m_imuType = new QLabel();
    imuLayout->addWidget(m_imuType);
    imuLayout->setStretch(1, 1);

    vLayout->addSpacing(10);

    QHBoxLayout *biasLayout = new QHBoxLayout();
    vLayout->addLayout(biasLayout);
    biasLayout->addWidget(new QLabel("Gyro bias status: "));
    m_biasStatus = new QLabel();
    biasLayout->addWidget(m_biasStatus);
    biasLayout->setStretch(1, 1);

    vLayout->addSpacing(10);

    vLayout->addWidget(new QLabel("Fusion state (quaternion): "));

    QHBoxLayout *dataLayout = new QHBoxLayout();
    dataLayout->setAlignment(Qt::AlignLeft);
    m_fusionQPoseScalar = getFixedPanel("1");
    m_fusionQPoseX = getFixedPanel("0");
    m_fusionQPoseY = getFixedPanel("0");
    m_fusionQPoseZ = getFixedPanel("0");
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_fusionQPoseScalar);
    dataLayout->addWidget(m_fusionQPoseX);
    dataLayout->addWidget(m_fusionQPoseY);
    dataLayout->addWidget(m_fusionQPoseZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Pose - roll, pitch, yaw (degrees): "));

    m_fusionPoseX = getFixedPanel("0");
    m_fusionPoseY = getFixedPanel("0");
    m_fusionPoseZ = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->setAlignment(Qt::AlignLeft);
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_fusionPoseX);
    dataLayout->addWidget(m_fusionPoseY);
    dataLayout->addWidget(m_fusionPoseZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Gyros (radians/s): "));

    m_gyroX = getFixedPanel("0");
    m_gyroY = getFixedPanel("0");
    m_gyroZ = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->setAlignment(Qt::AlignLeft);
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_gyroX);
    dataLayout->addWidget(m_gyroY);
    dataLayout->addWidget(m_gyroZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Accelerometers (g): "));

    m_accelX = getFixedPanel("0");
    m_accelY = getFixedPanel("0");
    m_accelZ = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->setAlignment(Qt::AlignLeft);
    dataLayout->addWidget(m_accelX);
    dataLayout->addWidget(m_accelY);
    dataLayout->addWidget(m_accelZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Accelerometer magnitude (g): "));

    m_accelMagnitude = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_accelMagnitude);
    dataLayout->setAlignment(Qt::AlignLeft);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Accelerometer residuals (g): "));

    m_accelResidualX = getFixedPanel("0");
    m_accelResidualY = getFixedPanel("0");
    m_accelResidualZ = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->setAlignment(Qt::AlignLeft);
    dataLayout->addWidget(m_accelResidualX);
    dataLayout->addWidget(m_accelResidualY);
    dataLayout->addWidget(m_accelResidualZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Magnetometers (uT): "));

    m_compassX = getFixedPanel("0");
    m_compassY = getFixedPanel("0");
    m_compassZ = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->setAlignment(Qt::AlignLeft);
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_compassX);
    dataLayout->addWidget(m_compassY);
    dataLayout->addWidget(m_compassZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Compass magnitude (uT): "));

    m_compassMagnitude = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_compassMagnitude);
    dataLayout->setAlignment(Qt::AlignLeft);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Pressure (hPa), height above sea level (m): "));

    m_pressure = getFixedPanel("0");
    m_height = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_pressure);
    dataLayout->addWidget(m_height);
    dataLayout->setAlignment(Qt::AlignLeft);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Temperature (C): "));

    m_temperature = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_temperature);
    dataLayout->setAlignment(Qt::AlignLeft);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Humidity (RH): "));

    m_humidity = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_humidity);
    dataLayout->setAlignment(Qt::AlignLeft);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);

    QHBoxLayout *fusionBox = new QHBoxLayout();
    QLabel *fusionTypeLabel = new QLabel("Fusion algorithm: ");
    fusionBox->addWidget(fusionTypeLabel);
    fusionTypeLabel->setMaximumWidth(150);
    m_fusionType = new QLabel();
    fusionBox->addWidget(m_fusionType);
    vLayout->addLayout(fusionBox);

    vLayout->addSpacing(10);

    vLayout->addWidget(new QLabel("Fusion controls: "));

    m_enableGyro = new QCheckBox("Enable gyros");
    m_enableGyro->setChecked(true);
    vLayout->addWidget(m_enableGyro);

    m_enableAccel = new QCheckBox("Enable accels");
    m_enableAccel->setChecked(true);
    vLayout->addWidget(m_enableAccel);

    m_enableCompass = new QCheckBox("Enable compass");
    m_enableCompass->setChecked(true);
    vLayout->addWidget(m_enableCompass);

    m_enableDebug = new QCheckBox("Enable debug messages");
    m_enableDebug->setChecked(false);
    vLayout->addWidget(m_enableDebug);

    vLayout->addStretch(1);

    mainLayout->addLayout(vLayout);

    vLayout = new QVBoxLayout();
    vLayout->setContentsMargins(3, 3, 3, 3);
    vLayout->setSpacing(3);

    QHBoxLayout *displayLayout = new QHBoxLayout();
    QLabel *displayLabel = new QLabel("Display type:  ");
    displayLayout->addWidget(displayLabel);
    displayLayout->setAlignment(displayLabel, Qt::AlignRight);

    m_displaySelect = new QComboBox();
    m_displaySelect->addItem("Fusion pose", DISPLAY_FUSION);
    m_displaySelect->addItem("Measured pose", DISPLAY_MEASURED);
    m_displaySelect->addItem("Accels only", DISPLAY_ACCELONLY);
    m_displaySelect->addItem("Compass only", DISPLAY_COMPASSONLY);

    displayLayout->addWidget(m_displaySelect);
    vLayout->addLayout(displayLayout);

    m_view = new IMUView(this);
    vLayout->addWidget(m_view);

    mainLayout->addLayout(vLayout, 1);
    centralWidget()->setLayout(mainLayout);
    setMinimumWidth(1000);
    setMinimumHeight(700);
}
コード例 #10
0
ファイル: import_track.cpp プロジェクト: WMFO/rivendell
ImportTrack::ImportTrack(QString *filter,QString *group,QWidget *parent)
  : QDialog(parent,"",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);

  add_filter=filter;
  add_group=group;

  //
  // Title Label
  //
  QLabel *label=new QLabel(tr("Insert audio from a:"),this);
  label->setGeometry(0,0,sizeHint().width(),30);
  label->setFont(label_font);
  label->setAlignment(Qt::AlignCenter);

  //
  //  Cart Button
  //
  QPushButton *button=new QPushButton(this);
  button->setGeometry(10,30,sizeHint().width()-20,50);
  button->setFont(button_font);
  button->setText(tr("&Cart"));
  button->setDisabled(true);
  QString sql=QString("select CHANNEL from DECKS where ")+
    "(CARD_NUMBER>=0)&&"+
    "(CHANNEL>0)&&"+
    "(CHANNEL<=9)";
  RDSqlQuery *q=new RDSqlQuery(sql);
  if(q->first()) {
    button->setEnabled(true);
  }
  delete q;
  connect(button,SIGNAL(clicked()),this,SLOT(cartData()));

  //
  //  Import Button
  //
  button=new QPushButton(this);
  button->setGeometry(10,80,sizeHint().width()-20,50);
  button->setFont(button_font);
  button->setText(tr("&File"));
  button->setDisabled(true);
  sql=QString("select CHANNEL from DECKS where ")+
    "(CARD_NUMBER>=0)&&"+
    "(CHANNEL>128)&&"+
    "(CHANNEL<=137)";
  q=new RDSqlQuery(sql);
  if(q->first()) {
    button->setEnabled(true);
  }
  delete q;
  connect(button,SIGNAL(clicked()),this,SLOT(importData()));

  //
  //  Cancel Button
  //
  button=new QPushButton(this);
  button->setGeometry(10,140,sizeHint().width()-20,50);
  button->setFont(button_font);
  button->setText(tr("&Cancel"));
  button->setDefault(true);
  connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));
}
コード例 #11
0
RDAudioSettingsDialog::RDAudioSettingsDialog(RDAudioSettings *settings,
					     bool mpeg,QWidget *parent)
  : QDialog(parent,"",true)
{
  lib_lib=settings;

  //
  // Dialog Name
  //
  setCaption(tr("Edit Settings"));

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  //
  // Generate Fonts
  //
  QFont font=QFont("Helvetica",12,QFont::Normal);
  font.setPixelSize(12);
  QFont button_font=QFont("Helvetica",12,QFont::Bold);
  font.setPixelSize(12);

  //
  // Default Format
  //
  lib_format_box=new QComboBox(this,"lib_name_edit");
  lib_format_box->setGeometry(150,10,150,20);
  lib_format_box->setFont(font);
  connect(lib_format_box,SIGNAL(activated(int)),this,SLOT(formatData(int)));
  QLabel *lib_format_label=new QLabel(lib_format_box,tr("Default &Format:"),
				      this,"lib_format_label");
  lib_format_label->setGeometry(25,10,120,20);
  lib_format_label->setFont(font);
  lib_format_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);

  //
  // Default Channels
  //
  lib_channels_box=new QComboBox(this,"lib_name_edit");
  lib_channels_box->setGeometry(150,32,60,20);
  lib_channels_box->setFont(font);
  QLabel *lib_channels_label=new QLabel(lib_channels_box,
					tr("Default &Channels:"),
					this,"lib_channels_label");
  lib_channels_label->setGeometry(25,32,120,20);
  lib_channels_label->setFont(font);
  lib_channels_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);

  //
  // Default Sample Rate
  //
  lib_samprate_box=new QComboBox(this,"lib_name_edit");
  lib_samprate_box->setGeometry(150,54,100,20);
  lib_samprate_box->setFont(font);
  QLabel *lib_samprate_label=
    new QLabel(lib_samprate_box,tr("Default &Sample Rate:"),this,
	       "lib_samprate_label");
  lib_samprate_label->setGeometry(20,54,125,20);
  lib_samprate_label->setFont(font);
  lib_samprate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);

  //
  // Default Bitrate
  //
  lib_bitrate_box=new QComboBox(this,"lib_name_edit");
  lib_bitrate_box->setGeometry(150,76,100,20);
  lib_bitrate_box->setFont(font);
  QLabel *lib_bitrate_label=
    new QLabel(lib_bitrate_box,tr("Default &Bitrate:"),this,
	       "lib_bitrate_label");
  lib_bitrate_label->setGeometry(25,76,120,20);
  lib_bitrate_label->setFont(font);
  lib_bitrate_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);

  //
  //  Ok Button
  //
  QPushButton *ok_button=new QPushButton(this,"ok_button");
  ok_button->setGeometry(145,108,80,50);
  ok_button->setDefault(true);
  ok_button->setFont(button_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(235,108,80,50);
  cancel_button->setFont(button_font);
  cancel_button->setText(tr("&Cancel"));
  connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));

  //
  // Populate Fields
  //
  lib_format_box->insertItem(tr("PCM16"));
#ifdef HAVE_VORBIS
  lib_format_box->insertItem(tr("OggVorbis"));
#endif  // HAVE_VORBIS
  if(mpeg) {
    lib_format_box->insertItem(tr("MPEG Layer 2"));
    lib_format_box->insertItem(tr("MPEG Layer 3"));
  }
  QString str;
  switch(lib_lib->format()) {
      case RDAudioSettings::Pcm16:
	str="PCM16";
	break;

      case RDAudioSettings::OggVorbis:
	str="OggVorbis";
	break;

      case RDAudioSettings::Layer1:
	str="MPEG Layer 1";
	break;

      case RDAudioSettings::Layer2:
	str="MPEG Layer 2";
	break;

      case RDAudioSettings::Layer3:
	str="MPEG Layer 3";
	break;
  }
  for(int i=0;i<lib_format_box->count();i++) {
    if(lib_format_box->text(i)==str) {
      lib_format_box->setCurrentItem(i);
    }
  }
  lib_channels_box->insertItem("1");
  lib_channels_box->insertItem("2");
  lib_channels_box->setCurrentItem(lib_lib->channels()-1);
  lib_samprate_box->insertItem("32000");
  lib_samprate_box->insertItem("44100");
  lib_samprate_box->insertItem("48000");
  switch(lib_lib->sampleRate()) {
      case 32000:
	lib_samprate_box->setCurrentItem(0);
	break;

      case 44100:
	lib_samprate_box->setCurrentItem(1);
	break;

      case 48000:
	lib_samprate_box->setCurrentItem(2);
	break;
  }
  ShowBitRates(lib_lib->format(),lib_lib->bitRate());
}
コード例 #12
0
ファイル: rdsoftkeys.cpp プロジェクト: WMTH/rivendell
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());
}
コード例 #13
0
ListEvents::ListEvents(QString *eventname,QWidget *parent)
  : QDialog(parent,"",true)
{
  QStringList services_list;
  QString str1=tr("Log Events - User: "******"%s%s",(const char *)str1,
			       (const char *)rda->ripc()->user()));
  edit_eventname=eventname;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());

  //
  // Create Fonts
  //
  QFont bold_font=QFont("Helvetica",12,QFont::Bold);
  bold_font.setPixelSize(12);
  QFont font=QFont("Helvetica",12,QFont::Normal);
  font.setPixelSize(12);

  //
  // Event Filter
  //
  edit_filter_box=new QComboBox(this);
  edit_filter_label=new QLabel(edit_filter_box,tr("Filter:"),this);
  edit_filter_label->setGeometry(10,10,50,20);
  edit_filter_label->setFont(bold_font);
  edit_filter_label->setAlignment(AlignRight|AlignVCenter);
  connect(edit_filter_box,SIGNAL(activated(int)),
	  this,SLOT(filterActivatedData(int)));

  //
  // Events List
  //
  edit_events_list=new QListView(this);
  edit_events_list->setAllColumnsShowFocus(true);
  edit_events_list->setItemMargin(5);
  edit_events_list->addColumn(tr("Name"));
  edit_events_list->addColumn(tr("Properties"));
  edit_events_list->addColumn(tr("Color"));
  edit_events_list->setColumnAlignment(2,AlignCenter);
  connect(edit_events_list,
	  SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),
	  this,SLOT(doubleClickedData(QListViewItem *,const QPoint &,int)));

  //
  //  Add Button
  //
  edit_add_button=new QPushButton(this);
  edit_add_button->setFont(bold_font);
  edit_add_button->setText(tr("&Add"));
  connect(edit_add_button,SIGNAL(clicked()),this,SLOT(addData()));
    
  //
  //  Edit Button
  //
  edit_edit_button=new QPushButton(this);
  edit_edit_button->setFont(bold_font);
  edit_edit_button->setText(tr("&Edit"));
  connect(edit_edit_button,SIGNAL(clicked()),this,SLOT(editData()));
    
  //
  //  Delete Button
  //
  edit_delete_button=new QPushButton(this);
  edit_delete_button->setFont(bold_font);
  edit_delete_button->setText(tr("&Delete"));
  connect(edit_delete_button,SIGNAL(clicked()),this,SLOT(deleteData()));
    
  //
  //  Rename Button
  //
  edit_rename_button=new QPushButton(this);
  edit_rename_button->setFont(bold_font);
  edit_rename_button->setText(tr("&Rename"));
  connect(edit_rename_button,SIGNAL(clicked()),this,SLOT(renameData()));
    
  //
  //  Close Button
  //
  edit_close_button=new QPushButton(this);
  edit_close_button->setFont(bold_font);
  edit_close_button->setText(tr("&OK"));
  connect(edit_close_button,SIGNAL(clicked()),this,SLOT(closeData()));

  //
  //  Ok Button
  //
  edit_ok_button=new QPushButton(this);
  edit_ok_button->setFont(bold_font);
  edit_ok_button->setText(tr("&Ok"));
  connect(edit_ok_button,SIGNAL(clicked()),this,SLOT(okData()));

  //
  //  Cancel Button
  //
  edit_cancel_button=new QPushButton(this);
  edit_cancel_button->setFont(bold_font);
  edit_cancel_button->setText(tr("&Cancel"));
  connect(edit_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));

  if(edit_eventname==NULL) {
    edit_close_button->setDefault(true);
    edit_ok_button->hide();
    edit_cancel_button->hide();
  }
  else {
    edit_ok_button->setDefault(true);
    edit_add_button->hide();
    edit_edit_button->hide();
    edit_delete_button->hide();
    edit_rename_button->hide();
    edit_close_button->hide();
  }

  //
  // Populate Data
  //
  edit_filter_box->insertItem(tr("ALL"));
  edit_filter_box->insertItem(tr("NONE"));

  QString sql="select NAME from SERVICES";
  RDSqlQuery *q=new RDSqlQuery(sql);
  while(q->next()) {
    services_list.append( q->value(0).toString() );
  }
  delete q;
  services_list.sort();
  for ( QStringList::Iterator it = services_list.begin(); 
        it != services_list.end();
        ++it ) {
    edit_filter_box->insertItem(*it);
    if(*event_filter==*it) {
      edit_filter_box->setCurrentItem(edit_filter_box->count()-1);
    }
  }

  RefreshList();
}
コード例 #14
0
EditDropbox::EditDropbox(int id,bool duplicate,QWidget *parent)
  : QDialog(parent)
{
  setModal(true);

  QString sql;
  RDSqlQuery *q;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  box_dropbox=new RDDropbox(id);

  setWindowTitle("RDAdmin - "+tr("Dropbox Configuration")+" ["+
		 tr("ID")+QString().sprintf(": %d]",id));

  //
  // Create Fonts
  //
  QFont normal_font=QFont("Helvetica",12,QFont::Normal);
  normal_font.setPixelSize(12);
  QFont font=QFont("Helvetica",12,QFont::Bold);
  font.setPixelSize(12);

  //
  // Dialogs
  //
  box_schedcodes_dialog=new RDSchedCodesDialog(this);

  //
  // Group Name
  //
  box_group_name_box=new QComboBox(this);
  box_group_name_box->setGeometry(120,10,100,20);
  QLabel *label=new QLabel(box_group_name_box,tr("Default Group:"),this);
  label->setGeometry(10,10,105,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);

  //
  // Path
  //
  box_path_edit=new QLineEdit(this);
  box_path_edit->setGeometry(120,32,sizeHint().width()-190,19);
  box_path_edit->setMaxLength(255);
  label=new QLabel(box_path_edit,tr("&Path Spec:"),this);
  label->setGeometry(10,32,105,19);
  label->setFont(font);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  QPushButton *button=
    new QPushButton(tr("Select"),this);
  button->setGeometry(sizeHint().width()-60,30,50,23);
  button->setFont(normal_font);
  connect(button,SIGNAL(clicked()),this,SLOT(selectPathData()));

  //
  // To Cart
  //
  box_to_cart_edit=new QLineEdit(this);
  box_to_cart_edit->setGeometry(120,54,60,19);
  box_to_cart_edit->setValidator(new QIntValidator(1,999999,this));
  box_to_cart_edit->setMaxLength(6);
  label=new QLabel(box_to_cart_edit,tr("To &Cart:"),this);
  label->setGeometry(10,54,105,19);
  label->setFont(font);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  box_select_cart_button=
    new QPushButton(tr("Select"),this);
  box_select_cart_button->setGeometry(190,52,50,23);
  box_select_cart_button->setFont(normal_font);
  connect(box_select_cart_button,SIGNAL(clicked()),
	  this,SLOT(selectCartData()));

  //
  // Delete Cuts
  //
  box_delete_cuts_box=new QCheckBox(this);
  box_delete_cuts_box->setGeometry(260,56,15,15);
  box_delete_cuts_label=
    new QLabel(box_delete_cuts_box,tr("Delete cuts before importing"),this);
  box_delete_cuts_label->setGeometry(280,54,sizeHint().width()-150,20);
  box_delete_cuts_label->setFont(font);
  box_delete_cuts_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);

  //
  // Metadata Format
  //
  box_metadata_pattern_edit=new QLineEdit(this);
  box_metadata_pattern_edit->setGeometry(120,76,sizeHint().width()-170,19);
  box_metadata_pattern_edit->setMaxLength(64);
  label=new QLabel(box_metadata_pattern_edit,tr("&Metadata Pattern:"),this);
  label->setGeometry(10,76,105,19);
  label->setFont(font);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);

  //
  // User Defined Field
  //
  box_user_defined_edit=new QLineEdit(this);
  box_user_defined_edit->setGeometry(120,98,sizeHint().width()-170,19);
  box_user_defined_edit->setMaxLength(255);
  label=new QLabel(box_user_defined_edit,tr("&User Defined:"),this);
  label->setGeometry(10,98,105,19);
  label->setFont(font);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);

  //
  // Log Path
  //
  box_log_path_edit=new QLineEdit(this);
  box_log_path_edit->setGeometry(120,120,sizeHint().width()-190,19);
  box_log_path_edit->setMaxLength(255);
  label=
    new QLabel(box_log_path_edit,tr("&Log File:"),this);
  label->setGeometry(10,120,105,19);
  label->setFont(font);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  button=new QPushButton(tr("Select"),this);
  button->setGeometry(sizeHint().width()-60,118,50,23);
  button->setFont(normal_font);
  connect(button,SIGNAL(clicked()),this,SLOT(selectLogPathData()));

  //
  // Scheduler Codes
  //
  box_schedcodes_button=new QPushButton(tr("Scheduler Codes"),this);
  box_schedcodes_button->setGeometry(110,145,200,25);
  box_schedcodes_button->setFont(font);
  connect(box_schedcodes_button,SIGNAL(clicked()),this,SLOT(schedcodesData()));

  //
  // Delete Source
  //
  box_delete_source_box=new QCheckBox(this);
  box_delete_source_box->setGeometry(90,177,15,15);
  label=new QLabel(box_delete_source_box,tr("Delete source files after import"),
		   this);
  label->setGeometry(110,175,sizeHint().width()-120,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);

  //
  // Force To Mono
  //
  box_force_to_mono_box=new QCheckBox(this);
  box_force_to_mono_box->setGeometry(90,199,15,15);
  label=new QLabel(box_force_to_mono_box,tr("Force to Monaural"),this);
  label->setGeometry(110,197,sizeHint().width()-120,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);

  //
  // Normalization
  //
  box_normalization_box=new QCheckBox(this);
  box_normalization_box->setGeometry(90,221,15,15);
  label=new QLabel(box_normalization_box,tr("Normalize Levels"),this);
  label->setGeometry(110,219,100,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
  box_normalization_level_spin=new QSpinBox(this);
  box_normalization_level_spin->setGeometry(275,219,50,20);
  box_normalization_level_spin->setRange(-100,-1);
  box_normalization_level_label=new QLabel(tr("Level:"),this);
  box_normalization_level_label->setGeometry(210,219,60,20);
  box_normalization_level_label->setFont(font);
  box_normalization_level_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
  box_normalization_level_unit=new QLabel(tr("dBFS"),this);
  box_normalization_level_unit->setGeometry(330,219,60,20);
  box_normalization_level_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
  connect(box_normalization_box,SIGNAL(toggled(bool)),
	  this,SLOT(normalizationToggledData(bool)));

  //
  // Autotrim
  //
  box_autotrim_box=new QCheckBox(this);
  box_autotrim_box->setGeometry(90,245,15,15);
  label=new QLabel(box_autotrim_box,tr("Autotrim Cuts"),this);
  label->setGeometry(110,243,100,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
  box_autotrim_level_spin=new QSpinBox(this);
  box_autotrim_level_spin->setGeometry(275,243,50,20);
  box_autotrim_level_spin->setRange(-100,-1);
  box_autotrim_level_label=new QLabel(tr("Level:"),this);
  box_autotrim_level_label->setGeometry(210,243,60,20);
  box_autotrim_level_label->setFont(font);
  box_autotrim_level_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
  box_autotrim_level_unit=new QLabel(tr("dBFS"),this);
  box_autotrim_level_unit->setGeometry(330,243,60,20);
  box_autotrim_level_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
  connect(box_autotrim_box,SIGNAL(toggled(bool)),
	  this,SLOT(autotrimToggledData(bool)));

  //
  // Segue
  //
  box_segue_box=new QCheckBox(this);
  box_segue_box->setGeometry(90,271,15,15);
  label=new QLabel(box_segue_box,tr("Insert Segue Markers"),
     this);
  label->setGeometry(110,269,sizeHint().width()-40,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
  box_segue_level_spin=
    new QSpinBox(this);
  box_segue_level_spin->setGeometry(300,295,50,20);
  box_segue_level_spin->setRange(-100,0);
  box_segue_level_label=
    new QLabel(box_segue_level_spin,tr("Segue Level:"),
        this);
  box_segue_level_label->setGeometry(120,295,160,20);
  box_segue_level_label->setFont(font);
  box_segue_level_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
  box_segue_level_unit=
    new QLabel(box_segue_level_spin,("dBFS"),this);
  box_segue_level_unit->setGeometry(360,296,60,20);
  box_segue_level_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);

  box_segue_length_spin=new QSpinBox(this);
  box_segue_length_spin->setGeometry(300,320,70,20);
  box_segue_length_spin->setRange(0,180000);
  box_segue_length_label=
     new QLabel(box_segue_length_spin,tr("Segue Length:"),
      this);
  box_segue_length_label->setGeometry(120,320,160,20);
  box_segue_length_label->setFont(font);
  box_segue_length_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
  box_segue_length_unit=
    new QLabel(box_segue_length_spin,("msec"),this);
  box_segue_length_unit->setGeometry(375,321,60,20);
  box_segue_length_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
  connect(box_segue_box,SIGNAL(toggled(bool)),
          this,SLOT(segueToggledData(bool)));

  //
  // Use CartChunk ID
  //
  box_use_cartchunk_id_box=new QCheckBox(this);
  box_use_cartchunk_id_box->setGeometry(90,350,15,15);
  label=new QLabel(box_use_cartchunk_id_box,
		   tr("Get cart number from CartChunk CutID"),this);
  label->setGeometry(110,348,sizeHint().width()-40,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);

  //
  // Title from CartChunk ID
  //
  box_title_from_cartchunk_id_box=new QCheckBox(this);
  box_title_from_cartchunk_id_box->setGeometry(90,374,15,15);
  label=new QLabel(box_title_from_cartchunk_id_box,
		   tr("Get cart title from CartChunk CutID"),this);
  label->setGeometry(110,372,sizeHint().width()-40,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);

  //
  // Fix Broken Formats
  //
  box_fix_broken_formats_box=new QCheckBox(this);
  box_fix_broken_formats_box->setGeometry(90,398,15,15);
  label=new QLabel(box_fix_broken_formats_box,
		   tr("Attempt to work around malformatted input files"),this);
  label->setGeometry(110,396,sizeHint().width()-40,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);

  //
  // Start Date Offset
  //
  box_startoffset_spin=
    new QSpinBox(this);
  box_startoffset_spin->setGeometry(215,422,50,20);
  box_startoffset_spin->setRange(-7,7);
  label=new QLabel(box_startoffset_spin,tr("Offset start date by"),this);
  label->setGeometry(90,422,120,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
  label=new QLabel(box_startoffset_spin,tr("days"),this);
  label->setGeometry(275,424,100,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);

  //
  // End Date Offset
  //
  box_endoffset_spin=
    new QSpinBox(this);
  box_endoffset_spin->setGeometry(215,446,50,20);
  box_endoffset_spin->setRange(-7,7);
  label=new QLabel(box_endoffset_spin,tr("Offset end date by"),this);
  label->setGeometry(90,446,120,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
  label=new QLabel(box_endoffset_spin,tr("days"),this);
  label->setGeometry(275,446,100,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);

  //
  // Create Dates
  //
  box_create_dates_box=new QCheckBox(this);
  box_create_dates_box->setGeometry(90,470,15,15);
  label=new QLabel(box_create_dates_box,tr("Create Dates when no Dates Exist"),
		   this);
  label->setGeometry(110,468,sizeHint().width()-40,20);
  label->setFont(font);
  label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
  box_create_startdate_offset_spin=
    new QSpinBox(this);
  box_create_startdate_offset_spin->setGeometry(300,494,50,20);
  box_create_startdate_offset_spin->setRange(-180,180);
  box_create_startdate_label= 
    new QLabel(box_create_startdate_offset_spin,tr("Create start date offset:"),
	       this);
  box_create_startdate_label->setGeometry(120,494,160,20);
  box_create_startdate_label->setFont(font);
  box_create_startdate_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
  box_create_startdate_unit=
    new QLabel(box_create_startdate_offset_spin,("days"),this);
  box_create_startdate_unit->setGeometry(360,495,60,20);
  box_create_startdate_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
  box_create_enddate_offset_spin=new QSpinBox(this);
  box_create_enddate_offset_spin->setGeometry(300,524,50,20);
  box_create_enddate_offset_spin->setRange(-180,180);
  box_create_enddate_label= 
     new QLabel(box_create_enddate_offset_spin,tr("Create end date offset:"),
		this);
  box_create_enddate_label->setGeometry(120,524,160,20);
  box_create_enddate_label->setFont(font);
  box_create_enddate_label->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
  box_create_enddate_unit=
    new QLabel(box_create_enddate_offset_spin,("days"),this);
  box_create_enddate_unit->setGeometry(360,524,60,20);
  box_create_enddate_unit->setAlignment(Qt::AlignVCenter|Qt::AlignLeft);
  connect(box_create_dates_box,SIGNAL(toggled(bool)),
          this,SLOT(createDatesToggledData(bool)));


  //
  //  Reset Button
  //
  QPushButton *reset_button=new QPushButton(this);
  reset_button->
    setGeometry(10,sizeHint().height()-60,80,50);
  reset_button->setDefault(true);
  reset_button->setFont(font);
  reset_button->setText(tr("&Reset"));
  connect(reset_button,SIGNAL(clicked()),this,SLOT(resetData()));

  //
  //  Ok Button
  //
  ok_button=new QPushButton(this);
  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->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
  //
  sql="select NAME from GROUPS order by NAME";
  q=new RDSqlQuery(sql);
  QString groupname=box_dropbox->groupName();
  while(q->next()) {
    box_group_name_box->insertItem(q->value(0).toString());
    if(q->value(0).toString()==groupname) {
      box_group_name_box->setCurrentItem(box_group_name_box->count()-1);
    }
  }
  delete q;
  box_path_edit->setText(box_dropbox->path());
  if(box_dropbox->toCart()>0) {
    box_to_cart_edit->setText(QString().sprintf("%06u",box_dropbox->toCart()));
  }
  box_delete_cuts_box->setChecked(box_dropbox->deleteCuts());
  box_metadata_pattern_edit->setText(box_dropbox->metadataPattern());
  box_user_defined_edit->setText(box_dropbox->userDefined());
  box_delete_source_box->setChecked(box_dropbox->deleteSource());
  box_force_to_mono_box->setChecked(box_dropbox->forceToMono());
  box_normalization_box->setChecked(box_dropbox->normalizationLevel()<0);
  box_normalization_level_spin->
    setValue(box_dropbox->normalizationLevel()/100);
  box_autotrim_box->setChecked(box_dropbox->autotrimLevel()<0);
  box_autotrim_level_spin->setValue(box_dropbox->autotrimLevel()/100);
  box_use_cartchunk_id_box->setChecked(box_dropbox->useCartchunkId());
  box_title_from_cartchunk_id_box->setChecked(box_dropbox->titleFromCartchunkId());
  box_log_path_edit->setText(box_dropbox->logPath());
  box_fix_broken_formats_box->setChecked(box_dropbox->fixBrokenFormats());
  box_startoffset_spin->setValue(box_dropbox->startdateOffset());
  box_endoffset_spin->setValue(box_dropbox->enddateOffset());
  box_create_dates_box->setChecked(box_dropbox->createDates());
  box_create_startdate_offset_spin->setValue(box_dropbox->createStartdateOffset());
  box_create_enddate_offset_spin->setValue(box_dropbox->createEnddateOffset());
  normalizationToggledData(box_normalization_box->isChecked());
  autotrimToggledData(box_autotrim_box->isChecked());
  segueToggledData(box_segue_box->isChecked());
  createDatesToggledData(box_create_dates_box->isChecked());
  segueToggledData(box_segue_box->isChecked());
  box_segue_box->setChecked(box_dropbox->segueLevel()<1);
  box_segue_level_spin->setValue(box_dropbox->segueLevel()/100);
  box_segue_length_spin->setValue(box_dropbox->segueLength());

  sql=QString("select SCHED_CODE from DROPBOX_SCHED_CODES ")+
    QString().sprintf("where DROPBOX_ID=%d",box_dropbox->id());
  q=new RDSqlQuery(sql);
  while(q->next()) {
    box_schedcodes.push_back(q->value(0).toString());
  }
  delete q;

  if(duplicate) {
    box_path=box_dropbox->path();
    connect(box_path_edit,SIGNAL(textChanged(QString)),this,SLOT(pathChangedData(QString)));
    ok_button->setEnabled(false);
    box_path_edit->setFocus();
  }
}
コード例 #15
0
ファイル: UBRightPalette.cpp プロジェクト: KubaO/Sankore-3.1
/**
 * \brief Update the maximum width
 */
void UBRightPalette::updateMaxWidth()
{
    setMaximumWidth((int)(parentWidget()->width() * 0.45));
    setMaximumHeight(parentWidget()->height());
    setMinimumHeight(parentWidget()->height());
}
コード例 #16
0
ファイル: edit_svc_perms.cpp プロジェクト: stgabmp/Rivendell
EditSvcPerms::EditSvcPerms(RDSvc *svc,QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  QString sql;
  RDSqlQuery *q;

  svc_svc=svc;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  setCaption(tr("Service: ")+svc_svc->name());

  //
  // Create Fonts
  //
  QFont font=QFont("Helvetica",12,QFont::Bold);
  font.setPixelSize(12);

  //
  // Services Selector
  //
  svc_host_sel=new RDListSelector(this,"svc_host_sel");
  svc_host_sel->sourceSetLabel(tr("Available Hosts"));
  svc_host_sel->destSetLabel(tr("Enabled Hosts"));
  svc_host_sel->setGeometry(10,10,380,130);

  //
  //  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
  sql=QString().sprintf("select STATION_NAME from SERVICE_PERMS \
                         where SERVICE_NAME=\"%s\"",
			(const char *)svc_svc->name());
  q=new RDSqlQuery(sql);
  while(q->next()) {
    svc_host_sel->destInsertItem(q->value(0).toString());
  }
  delete q;

  sql=QString().sprintf("select NAME from STATIONS");
  q=new RDSqlQuery(sql);
  while(q->next()) {
    if(svc_host_sel->destFindItem(q->value(0).toString())==0) {
      svc_host_sel->sourceInsertItem(q->value(0).toString());
    }
  }
  delete q;
}
コード例 #17
0
NotificationDialog::NotificationDialog(Notification *notification, QWidget *parent) : QDialog(parent),
	m_notification(notification),
	m_closeLabel(nullptr)
{
	QFrame *notificationFrame(new QFrame(this));
	notificationFrame->setObjectName(QLatin1String("notificationFrame"));
	notificationFrame->setStyleSheet(QLatin1String("#notificationFrame {padding:5px;border:1px solid #CCC;border-radius:10px;background:#F0F0f0;}"));
	notificationFrame->setCursor(QCursor(Qt::PointingHandCursor));
	notificationFrame->installEventFilter(this);

	QBoxLayout *mainLayout(new QBoxLayout(QBoxLayout::LeftToRight));
	mainLayout->setContentsMargins(0, 0, 0, 0);
	mainLayout->setSpacing(0);
	mainLayout->setSizeConstraint(QLayout::SetMinimumSize);
	mainLayout->addWidget(notificationFrame);

	QLabel *iconLabel(new QLabel(this));
	iconLabel->setPixmap(ThemesManager::createIcon(QLatin1String("otter-browser-32")).pixmap(32, 32));
	iconLabel->setStyleSheet(QLatin1String("padding:5px;"));

	QLabel *messageLabel(new QLabel(this));
	messageLabel->setText(m_notification->getMessage());
	messageLabel->setStyleSheet(QLatin1String("padding:5px;font-size:13px;"));
	messageLabel->setWordWrap(true);

	QStyleOption option;
	option.rect = QRect(0, 0, 16, 16);

	QPixmap pixmap(16, 16);
	pixmap.fill(Qt::transparent);

	QPainter painter(&pixmap);

	style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &option, &painter, this);

	m_closeLabel = new QLabel(notificationFrame);
	m_closeLabel->setToolTip(tr("Close"));
	m_closeLabel->setPixmap(pixmap);
	m_closeLabel->setAlignment(Qt::AlignTop);
	m_closeLabel->setMargin(5);
	m_closeLabel->installEventFilter(this);

	QBoxLayout *notificationLayout(new QBoxLayout(QBoxLayout::LeftToRight));
	notificationLayout->setContentsMargins(0, 0, 0, 0);
	notificationLayout->setSpacing(0);
	notificationLayout->setSizeConstraint(QLayout::SetMinimumSize);
	notificationLayout->addWidget(iconLabel);
	notificationLayout->addWidget(messageLabel);
	notificationLayout->addWidget(m_closeLabel);

	notificationFrame->setLayout(notificationLayout);

	setLayout(mainLayout);
	setFixedWidth(400);
	setMinimumHeight(50);
	setMaximumHeight(150);
	setWindowOpacity(0);
	setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Tool | Qt::FramelessWindowHint);
	setFocusPolicy(Qt::NoFocus);
	setAttribute(Qt::WA_DeleteOnClose, true);
	setAttribute(Qt::WA_ShowWithoutActivating, true);
	setAttribute(Qt::WA_TranslucentBackground, true);
	adjustSize();

	m_animation = new QPropertyAnimation(this, QStringLiteral("windowOpacity").toLatin1());
	m_animation->setDuration(500);
	m_animation->setStartValue(0.0);
	m_animation->setEndValue(1.0);
	m_animation->start();

	const int visibilityDuration(SettingsManager::getOption(SettingsManager::Interface_NotificationVisibilityDurationOption).toInt());

	if (visibilityDuration > 0)
	{
		QTimer::singleShot((visibilityDuration * 1000), this, [&]()
		{
			m_animation->setStartValue(1.0);
			m_animation->setEndValue(0.0);
			m_animation->start();

			connect(m_animation, &QPropertyAnimation::finished, this, [&]()
			{
				m_notification->markAsIgnored();

				close();
			});
		});
	}
}
コード例 #18
0
void QgsBrowserPropertiesWrapLabel::adjustHeight( QSizeF size )
{
  int height = size.height() + 2 * frameWidth();
  setMinimumHeight( height );
  setMaximumHeight( height );
}
コード例 #19
0
ファイル: maintab.cpp プロジェクト: neolit123/subsurface
MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
	weightModel(new WeightModel(this)),
	cylindersModel(new CylindersModel(this)),
	editMode(NONE),
	copyPaste(false),
	currentTrip(0)
{
	ui.setupUi(this);

	extraWidgets << new TabDiveInformation();
	ui.tabWidget->addTab(extraWidgets.last(), tr("Information"));
	extraWidgets << new TabDiveStatistics();
	ui.tabWidget->addTab(extraWidgets.last(), tr("Statistics"));
	extraWidgets << new TabDivePhotos();
	ui.tabWidget->addTab(extraWidgets.last(), tr("Photos"));
	extraWidgets << new TabDiveExtraInfo();
	ui.tabWidget->addTab(extraWidgets.last(), tr("Extra Info"));

	ui.dateEdit->setDisplayFormat(prefs.date_format);

	memset(&displayed_dive, 0, sizeof(displayed_dive));
	memset(&displayedTrip, 0, sizeof(displayedTrip));

	// This makes sure we only delete the models
	// after the destructor of the tables,
	// this is needed to save the column sizes.
	cylindersModel->setParent(ui.cylinders);
	weightModel->setParent(ui.weights);

	ui.cylinders->setModel(cylindersModel);
	ui.weights->setModel(weightModel);
	closeMessage();

	connect(ui.editDiveSiteButton, SIGNAL(clicked()), MainWindow::instance(), SIGNAL(startDiveSiteEdit()));
	connect(ui.location, &DiveLocationLineEdit::entered, MapWidget::instance(), &MapWidget::centerOnIndex);
	connect(ui.location, &DiveLocationLineEdit::currentChanged, MapWidget::instance(), &MapWidget::centerOnIndex);

	QAction *action = new QAction(tr("Apply changes"), this);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(acceptChanges()));
	addMessageAction(action);

	action = new QAction(tr("Discard changes"), this);
	connect(action, SIGNAL(triggered(bool)), this, SLOT(rejectChanges()));
	addMessageAction(action);

	QShortcut *closeKey = new QShortcut(QKeySequence(Qt::Key_Escape), this);
	connect(closeKey, SIGNAL(activated()), this, SLOT(escDetected()));

	if (qApp->style()->objectName() == "oxygen")
		setDocumentMode(true);
	else
		setDocumentMode(false);

	// we start out with the fields read-only; once things are
	// filled from a dive, they are made writeable
	setEnabled(false);

	ui.cylinders->setTitle(tr("Cylinders"));
	ui.cylinders->setBtnToolTip(tr("Add cylinder"));
	connect(ui.cylinders, SIGNAL(addButtonClicked()), this, SLOT(addCylinder_clicked()));

	ui.weights->setTitle(tr("Weights"));
	ui.weights->setBtnToolTip(tr("Add weight system"));
	connect(ui.weights, SIGNAL(addButtonClicked()), this, SLOT(addWeight_clicked()));

	// This needs to be the same order as enum dive_comp_type in dive.h!
	ui.DiveType->insertItems(0, QStringList() << tr("OC") << tr("CCR") << tr("pSCR") << tr("Freedive"));
	connect(ui.DiveType, SIGNAL(currentIndexChanged(int)), this, SLOT(divetype_Changed(int)));

	connect(ui.cylinders->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editCylinderWidget(QModelIndex)));
	connect(ui.weights->view(), SIGNAL(clicked(QModelIndex)), this, SLOT(editWeightWidget(QModelIndex)));

	ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this));
	ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::USE, new TankUseDelegate(this));
	ui.weights->view()->setItemDelegateForColumn(WeightModel::TYPE, new WSInfoDelegate(this));
	ui.cylinders->view()->setColumnHidden(CylindersModel::DEPTH, true);
	completers.buddy = new QCompleter(&buddyModel, ui.buddy);
	completers.divemaster = new QCompleter(&diveMasterModel, ui.divemaster);
	completers.suit = new QCompleter(&suitModel, ui.suit);
	completers.tags = new QCompleter(&tagModel, ui.tagWidget);
	completers.buddy->setCaseSensitivity(Qt::CaseInsensitive);
	completers.divemaster->setCaseSensitivity(Qt::CaseInsensitive);
	completers.suit->setCaseSensitivity(Qt::CaseInsensitive);
	completers.tags->setCaseSensitivity(Qt::CaseInsensitive);
	ui.buddy->setCompleter(completers.buddy);
	ui.divemaster->setCompleter(completers.divemaster);
	ui.suit->setCompleter(completers.suit);
	ui.tagWidget->setCompleter(completers.tags);
	ui.diveNotesMessage->hide();
	ui.depth->hide();
	ui.depthLabel->hide();
	ui.duration->hide();
	ui.durationLabel->hide();
	setMinimumHeight(0);
	setMinimumWidth(0);

	// Current display of things on Gnome3 looks like shit, so
	// let`s fix that.
	if (isGnome3Session()) {
		QPalette p;
		p.setColor(QPalette::Window, QColor(Qt::white));
		ui.scrollArea->viewport()->setPalette(p);
		ui.scrollArea_2->viewport()->setPalette(p);

		// GroupBoxes in Gnome3 looks like I'v drawn them...
		static const QString gnomeCss(
			"QGroupBox {"
			"    background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
			"    stop: 0 #E0E0E0, stop: 1 #FFFFFF);"
			"    border: 2px solid gray;"
			"    border-radius: 5px;"
			"    margin-top: 1ex;"
			"}"
			"QGroupBox::title {"
			"    subcontrol-origin: margin;"
			"    subcontrol-position: top center;"
			"    padding: 0 3px;"
			"    background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
			"    stop: 0 #E0E0E0, stop: 1 #FFFFFF);"
			"}");
		Q_FOREACH (QGroupBox *box, findChildren<QGroupBox *>()) {
			box->setStyleSheet(gnomeCss);
		}
	}
コード例 #20
0
ファイル: rdlogin.cpp プロジェクト: stgabmp/Rivendell
MainWidget::MainWidget(QWidget *parent,const char *name)
  :QWidget(parent,name)
{
  login_user_width=160;

  QString str;
  QString sql;
  RDSqlQuery *q;

  //
  // HACK: Disable the Broken Custom SuSE Dialogs
  //
  setenv("QT_NO_KDE_INTEGRATION","1",1);

  //
  // Read Command Options
  //
  RDCmdSwitch *cmd=new RDCmdSwitch(qApp->argc(),qApp->argv(),"rdlogin","\n");
  delete cmd;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  //
  // Generate Fonts
  //
  QFont default_font("Helvetica",12,QFont::Normal);
  default_font.setPixelSize(12);
  qApp->setFont(default_font);
  QFont button_font=QFont("Helvetica",12,QFont::Bold);
  button_font.setPixelSize(12);
  QFont label_font=QFont("Helvetica",16,QFont::Bold);
  label_font.setPixelSize(12);
  QFont small_label_font=QFont("Helvetica",12,QFont::Bold);
  small_label_font.setPixelSize(12);
  QFont line_edit_font=QFont("Helvetica",12,QFont::Normal);
  line_edit_font.setPixelSize(12);

  //
  // Create And Set Icon
  //
  login_rivendell_map=new QPixmap(rivendell_xpm);
  setIcon(*login_rivendell_map);

  //
  // Text Validator
  //
  RDTextValidator *validator=new RDTextValidator(this,"validator");

  //
  // Ensure that the system daemons are running
  //
  RDInitializeDaemons();

  //
  // Load Configs
  //
  login_config=new RDConfig();
  login_config->load();

  str=QString(tr("RDLogin - Station:"));
  setCaption(QString().sprintf("%s %s",(const char *)str,
			       (const char *)login_config->stationName()));

  //
  // Open Database
  //
  QString err(tr("rdlogin : "******"Can't Connect"),err);
    exit(0);
  }
  //
  // RIPC Connection
  //
  login_ripc=new RDRipc(login_config->stationName());
  connect(login_ripc,SIGNAL(connected(bool)),this,SLOT(connectedData(bool)));
  connect(login_ripc,SIGNAL(userChanged()),this,SLOT(userData()));
  login_ripc->connectHost("localhost",RIPCD_TCP_PORT,
			  login_config->password());

  //
  // Station
  //
  login_station=new RDStation(login_config->stationName());

  //
  // User Label
  //
  login_label=new QLabel(this,"login_label");
  login_label->setFont(label_font);
  login_label->setAlignment(AlignCenter);
  login_label->setText(tr("Current User: unknown"));

  //
  // User Name
  //
  login_username_box=new QComboBox(this,"login_username_box");
  login_username_box->setFont(line_edit_font);
  login_username_box->setFocus();
  QFontMetrics fm(line_edit_font);
  sql="select LOGIN_NAME from USERS where ADMIN_CONFIG_PRIV=\"N\"\
       order by LOGIN_NAME";
  q=new RDSqlQuery(sql);
  while(q->next()) {
    login_username_box->insertItem(q->value(0).toString());
    if(fm.width(q->value(0).toString())>login_user_width) {
      login_user_width=fm.width(q->value(0).toString());
    }
  }
  delete q;
  if(login_user_width>900) {
    login_user_width=900;
  }
  login_username_label=new QLabel(login_username_box,tr("&Username:"******"login_username_label");
  login_username_label->setFont(small_label_font);
  login_username_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Password
  //
  login_password_edit=new QLineEdit(this,"login_password_edit");
  login_password_edit->setFont(line_edit_font);
  login_password_edit->setMaxLength(16);
  login_password_edit->setValidator(validator);
  login_password_edit->setEchoMode(QLineEdit::Password);
  login_password_label=new QLabel(login_password_edit,tr("&Password:"******"login_password_label");
  login_password_label->setFont(small_label_font);
  login_password_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  connect(login_password_edit,SIGNAL(returnPressed()),this,SLOT(loginData()));

  //
  // Login Button
  //
  login_button=new QPushButton(this,"login_button");
  login_button->setFont(button_font);
  login_button->setText(tr("&Set User"));
  connect(login_button,SIGNAL(clicked()),this,SLOT(loginData()));

  //
  // Logout Button
  //
  logout_button=new QPushButton(this,"logout_button");
  logout_button->setFont(button_font);
  logout_button->setText(tr("&Default\nUser"));
  connect(logout_button,SIGNAL(clicked()),this,SLOT(logoutData()));

  //
  // Cancel Button
  //
  cancel_button=new QPushButton(this,"cancel_button");
  cancel_button->setFont(button_font);
  cancel_button->setText(tr("&Cancel"));
  connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));

  resizeEvent(NULL);
}
コード例 #21
0
ファイル: TasksView.cpp プロジェクト: MichaelRyanWebber/Charm
TasksView::TasksView( QToolBar* toolBar, QWidget* parent )
    : QWidget( parent )
      // , ViewInterface()
    , m_delegate( new TasksViewDelegate( this ) )
    , m_actionNewTask( this )
    , m_actionNewSubTask( this )
    , m_actionEditTask( this )
    , m_actionDeleteTask( this )
    , m_actionExpandTree( this )
    , m_actionCollapseTree( this )
    , m_showCurrentOnly( new QAction( toolBar ) )
    , m_showSubscribedOnly( new QAction( toolBar ) )
    , m_treeView( new QTreeView( this ) )
{
    auto layout = new QVBoxLayout( this );
    layout->setContentsMargins( 0, 0, 0, 0 );
    layout->addWidget( m_treeView );

    m_treeView->setItemDelegate( m_delegate );
    connect( m_delegate, SIGNAL(editingStateChanged()),
             SLOT(configureUi()) );

    // set up actions
    m_actionNewTask.setText( tr( "New &Task" ) );
    m_actionNewTask.setShortcut( QKeySequence::New );
    m_actionNewTask.setIcon( Data::newTaskIcon() );
    toolBar->addAction( &m_actionNewTask );
    connect( &m_actionNewTask, SIGNAL(triggered(bool)),
             SLOT(actionNewTask()) );

    m_actionNewSubTask.setText( tr( "New &Subtask" ) );
    m_actionNewSubTask.setShortcut( Qt::META + Qt::Key_N );
    m_actionNewSubTask.setIcon( Data::newSubtaskIcon() );
    toolBar->addAction( &m_actionNewSubTask );
    connect( &m_actionNewSubTask, SIGNAL(triggered(bool)),
             SLOT(actionNewSubTask()) );

    m_actionEditTask.setText( tr( "Edit Task" ) );
    m_actionEditTask.setShortcut( Qt::CTRL + Qt::Key_E );
    m_actionEditTask.setIcon( Data::editTaskIcon() );
    toolBar->addAction( &m_actionEditTask );
    connect( &m_actionEditTask, SIGNAL(triggered(bool)),
             SLOT(actionEditTask()) );

    m_actionDeleteTask.setText( tr( "Delete Task" ) );
    QList<QKeySequence> deleteShortcuts;
    deleteShortcuts << QKeySequence::Delete;
#ifdef Q_OS_OSX
    deleteShortcuts << Qt::Key_Backspace;
#endif
    m_actionDeleteTask.setShortcuts(deleteShortcuts);
    m_actionDeleteTask.setIcon( Data::deleteTaskIcon() );
    toolBar->addAction( &m_actionDeleteTask );
    connect( &m_actionDeleteTask, SIGNAL(triggered(bool)),
             SLOT(actionDeleteTask()) );

    m_actionExpandTree.setText( tr( "Expand All" ) );
    connect( &m_actionExpandTree, SIGNAL(triggered(bool)),
             m_treeView, SLOT(expandAll()) );

    m_actionCollapseTree.setText( tr( "Collapse All" ) );
    connect( &m_actionCollapseTree, SIGNAL(triggered(bool)),
             m_treeView, SLOT(collapseAll()) );

    // filter setup
    m_showCurrentOnly->setText( tr( "Current" ) );
    m_showCurrentOnly->setCheckable( true );

    toolBar->addAction( m_showCurrentOnly );
    connect( m_showCurrentOnly, SIGNAL(triggered(bool)),
             SLOT(taskPrefilteringChanged()) );

    m_showSubscribedOnly->setText( tr( "Selected" ) );
    m_showSubscribedOnly->setCheckable( true );

    toolBar->addAction( m_showSubscribedOnly );
    connect( m_showSubscribedOnly, SIGNAL(triggered(bool)),
             SLOT(taskPrefilteringChanged()) );

    auto searchField = new QLineEdit( this );

    connect( searchField, SIGNAL(textChanged(QString)),
             SLOT(slotFiltertextChanged(QString)) );
    toolBar->addWidget( searchField );

    m_treeView->setEditTriggers(QAbstractItemView::EditKeyPressed);
    m_treeView->setExpandsOnDoubleClick(false);
    m_treeView->setAlternatingRowColors( true );
    // The delegate does its own eliding.
    m_treeView->setTextElideMode( Qt::ElideNone );
    m_treeView->setRootIsDecorated( true );
    m_treeView->setContextMenuPolicy( Qt::CustomContextMenu );
    connect( m_treeView, SIGNAL(customContextMenuRequested(QPoint)),
             SLOT(slotContextMenuRequested(QPoint)) );

    // I hate doing this but the stupid default view sizeHints suck badly.
    setMinimumHeight( 200 );

    // A reasonable default depth.
    m_treeView->expandToDepth( 0 );
}
コード例 #22
0
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());
}
コード例 #23
0
EditNode::EditNode(int *id,RDMatrix *matrix,QWidget *parent)
  : QDialog(parent,"",true)
{
  edit_id=id;
  edit_matrix=matrix;
  edit_password_changed=false;
  setCaption(tr("Edit LiveWire Node"));

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  //
  // Create Fonts
  //
  QFont bold_font=QFont("Helvetica",12,QFont::Bold);
  bold_font.setPixelSize(12);
  QFont font=QFont("Helvetica",12,QFont::Normal);
  font.setPixelSize(12);

  //
  // Node Hostname
  //
  edit_hostname_edit=new QLineEdit(this);
  edit_hostname_edit->setGeometry(90,10,190,20);
  QLabel *label=
    new QLabel(edit_hostname_edit,tr("Hostname: "),this);
  label->setGeometry(10,10,80,20);
  label->setFont(bold_font);
  label->setAlignment(AlignRight|AlignVCenter);

  //
  // Node TCP Port
  //
  edit_tcpport_spin=new QSpinBox(this);
  edit_tcpport_spin->setGeometry(335,10,sizeHint().width()-345,20);
  edit_tcpport_spin->setRange(0,0xFFFF);
  label=new QLabel(edit_tcpport_spin,tr("Port: "),this);
  label->setGeometry(290,10,45,20);
  label->setFont(bold_font);
  label->setAlignment(AlignRight|AlignVCenter);

  //
  // Node Description
  //
  edit_description_edit=new QLineEdit(this);
  edit_description_edit->setGeometry(90,32,sizeHint().width()-100,20);
  label=new QLabel(edit_description_edit,tr("Description: "),this);
  label->setGeometry(10,32,80,20);
  label->setFont(bold_font);
  label->setAlignment(AlignRight|AlignVCenter);

  //
  // Base Output
  //
  edit_output_spin=new QSpinBox(this);
  edit_output_spin->setGeometry(90,54,60,20);
  edit_output_spin->setRange(0,0x7FFF);
  edit_output_spin->setSpecialValueText(tr("None"));
  label=
    new QLabel(edit_output_spin,tr("First Output: "),this);
  label->setGeometry(10,54,80,20);
  label->setFont(bold_font);
  label->setAlignment(AlignRight|AlignVCenter);

  //
  // Node Password
  //
  edit_password_edit=new QLineEdit(this);
  edit_password_edit->setGeometry(245,54,90,20);
  edit_password_edit->setEchoMode(QLineEdit::Password);
  edit_password_edit->setText("********");
  connect(edit_password_edit,SIGNAL(textChanged(const QString &)),
	  this,SLOT(passwordChangedData(const QString &)));
  label=
    new QLabel(edit_password_edit,tr("Password: "******"&View Node\nInfo"));
  connect(button,SIGNAL(clicked()),this,SLOT(viewData()));

  //
  //  Ok Button
  //
  button=new QPushButton(this);
  button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  button->setDefault(true);
  button->setFont(bold_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(bold_font);
  button->setText(tr("&Cancel"));
  connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));

  //
  // Load Data
  //
  if((*edit_id)<0) {
    edit_tcpport_spin->setValue(RD_LIVEWIRE_DEFAULT_TCP_PORT);
  }
  else {
    QString sql;
    RDSqlQuery *q;
    sql=QString().sprintf("select HOSTNAME,TCP_PORT,DESCRIPTION,PASSWORD,\
                           BASE_OUTPUT \
                           from SWITCHER_NODES \
                           where ID=%d",*edit_id);
    q=new RDSqlQuery(sql);
    if(q->first()) {
      edit_hostname_edit->setText(q->value(0).toString());
      edit_tcpport_spin->setValue(q->value(1).toInt());
      edit_description_edit->setText(q->value(2).toString());
      edit_password=q->value(3).toString();
      edit_output_spin->setValue(q->value(4).toInt());
    }
    delete q;
  }
}
コード例 #24
0
ファイル: list_logs.cpp プロジェクト: WMFO/rivendell
ListLogs::ListLogs(LogPlay *log,QWidget *parent)
  : QDialog(parent,"",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_log=log;
  setCaption(tr("Select a Log"));

  //
  // Log List
  //
  list_log_list=new Q3ListView(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(Q3ListViewItem *,const QPoint &,int)),
          this,
          SLOT(doubleClickedData(Q3ListViewItem *,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
  //
  list_saveas_button=new QPushButton(this,"list_saveas_button");
  list_saveas_button->setGeometry(300,sizeHint().height()-60,80,50);
  list_saveas_button->setFont(button_font);
  list_saveas_button->setText(tr("Save &As"));
  connect(list_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();
}
コード例 #25
0
MainWindow::MainWindow(QFrame *parent)
    : QFrame(parent),isLeftNaviVisuable(true)
{
    setWindowFlags(Qt::FramelessWindowHint);

    setMouseTracking(true);
    setAttribute(Qt::WA_Hover, true);
    QString fileName("/style/system.qss");
    QFile file(fileName);
    if (!file.open(QFile::ReadOnly)) {
      file.setFileName(":/style/system.qss");
      file.open(QFile::ReadOnly);
    }
    setStyleSheet(file.readAll());
    file.close();


    ptrHeaderBar = new HeaderBar(this);//创建标题栏
    ptrStatusBar = new StatusBar(this);//创建状态栏
    QString msg = "Ready";
    ptrStatusBar->setMessage(msg);

    lft = new LeftNavi(this);
    lft->setFrameStyle(QFrame::NoFrame);

    rgt = new QStackedWidget(this);
    rgt->setObjectName("rgt");
    rgt->setFrameStyle(QFrame::NoFrame);



    NetPlanView *tpview = new NetPlanView();
    rgt->addWidget(tpview);
    NetResView *resview = new NetResView();
    rgt->addWidget(resview);
    QSplitter *mainSplitter = new QSplitter(this);
    mainSplitter->setFrameStyle(QFrame::NoFrame);
    mainSplitter->setHandleWidth(1);
    mainSplitter->setStyleSheet(
                QString("QSplitter::handle {background: qlineargradient("
                        "x1: 0, y1: 0, x2: 0, y2: 1,"
                        "stop: 0 %1, stop: 0.07 %2);}").
                arg(qApp->palette().background().color().name()).
                arg(qApp->palette().color(QPalette::Dark).name()));

    mainSplitter->setChildrenCollapsible(false);

    mainSplitter->addWidget(lft);
    mainSplitter->addWidget(rgt);
    mainSplitter->setStretchFactor(20,80);
    createToolBarNull();
    QHBoxLayout *ptrHLayout = new QHBoxLayout();
    ptrHLayout->setMargin(0);
    ptrHLayout->setSpacing(0);
    ptrHLayout->addWidget(pushButtonNull_);
    ptrHLayout->addWidget(mainSplitter);

    QVBoxLayout *ptrVLayout = new QVBoxLayout();//创建布局
    ptrVLayout->addWidget(ptrHeaderBar);//将部件加入到布局中
    ptrVLayout->addLayout(ptrHLayout);
    ptrVLayout->addWidget(ptrStatusBar);
    ptrVLayout->setSpacing(0);  //设置间距与边缘空白
    ptrVLayout->setContentsMargins(VALUE_DIS,VALUE_DIS,VALUE_DIS,VALUE_DIS);
    setLayout(ptrVLayout);
    setMinimumWidth(800);
    setMinimumHeight(600);


     createActions();


    FramelessHelper *pHelper = new FramelessHelper(this);
    pHelper->activateOn(this);  //激活当前窗体
    pHelper->setBorderWidth(VALUE_DIS);
    pHelper->setTitleHeight(HEADER_H);  //设置窗体的标题栏高度
    pHelper->setWidgetMovable(true);  //设置窗体可移动
    pHelper->setWidgetResizable(true);  //设置窗体可缩放

    connect(ptrHeaderBar, SIGNAL(signal_menu(QPoint)), this, SLOT(showMenu(QPoint)));
    connect(ptrHeaderBar, SIGNAL(signal_maxrestore()), this, SLOT(showMaxRestore()));

     //lft->setDatabase(db.db());
}
コード例 #26
0
EditVguestResource::EditVguestResource(RDMatrix::VguestType type,
				       int *enginenum,int *devicenum,
				       int *surfacenum,int *relaynum,
				       QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  edit_type=type;
  edit_enginenum=enginenum;
  edit_devicenum=devicenum;
  edit_surfacenum=surfacenum;
  edit_relaynum=relaynum;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  //
  // Create Fonts
  //
  QFont bold_font=QFont("Helvetica",12,QFont::Bold);
  bold_font.setPixelSize(12);
  QFont font=QFont("Helvetica",12,QFont::Normal);
  font.setPixelSize(12);

  //
  // Logitek Engine Number
  //
  edit_enginenum_edit=new QLineEdit(this,"edit_enginenum_edit");
  edit_enginenum_edit->setGeometry(135,10,50,20);
  QLabel *label=new QLabel(edit_enginenum_edit,tr("Engine (Hex): "),
			   this,"edit_enginenum_label");
  label->setGeometry(10,10,120,20);
  label->setFont(bold_font);
  label->setAlignment(AlignRight|AlignVCenter);

  //
  // Logitek Device Number
  //
  edit_devicenum_edit=new QLineEdit(this,"edit_devicenum_edit");
  edit_devicenum_edit->setGeometry(135,36,50,20);
  label=new QLabel(edit_devicenum_edit,tr("Device (Hex): "),
		   this,"edit_devicenum_label");
  label->setGeometry(10,36,120,20);
  label->setFont(bold_font);
  label->setAlignment(AlignRight|AlignVCenter);

  //
  // Logitek Surface Number
  //
  edit_surfacenum_edit=new QLineEdit(this,"edit_surfacenum_edit");
  edit_surfacenum_edit->setGeometry(135,62,50,20);
  label=new QLabel(edit_surfacenum_edit,tr("Surface (Hex): "),
		   this,"edit_surfacenum_label");
  label->setGeometry(10,62,120,20);
  label->setFont(bold_font);
  label->setAlignment(AlignRight|AlignVCenter);

  //
  // Logitek Relay Number
  //
  edit_relaynum_edit=new QLineEdit(this,"edit_relaynum_edit");
  edit_relaynum_edit->setGeometry(135,88,50,20);
  edit_relaynum_label=new QLabel(edit_relaynum_edit,tr("Bus/Relay (Hex): "),
		   this,"edit_relaynum_label");
  edit_relaynum_label->setGeometry(10,88,120,20);
  edit_relaynum_label->setFont(bold_font);
  edit_relaynum_label->setAlignment(AlignRight|AlignVCenter);

  //
  //  Ok Button
  //
  QPushButton *button=new QPushButton(this,"ok_button");
  button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  button->setDefault(true);
  button->setFont(bold_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(bold_font);
  button->setText(tr("&Cancel"));
  connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));

  //
  // Load Data
  //
  if(*enginenum>=0) {
    edit_enginenum_edit->setText(QString().sprintf("%04X",*enginenum));
  }
  if(*devicenum>=0) {
    edit_devicenum_edit->setText(QString().sprintf("%04X",*devicenum));
  }
  if(*surfacenum>=0) {
    edit_surfacenum_edit->setText(QString().sprintf("%04X",*surfacenum));
  }
  switch(edit_type) {
      case RDMatrix::VguestTypeRelay:
	setCaption(tr("Edit vGuest Switch"));
	if(*relaynum>=0) {
	  edit_relaynum_edit->setText(QString().sprintf("%04X",*relaynum));
	}
	break;

      case RDMatrix::VguestTypeDisplay:
	setCaption(tr("Edit vGuest Display"));
	edit_relaynum_edit->setDisabled(true);
	break;
  }
}
コード例 #27
0
ファイル: controller.cpp プロジェクト: BloodExecutioner/vlc
/**********************************************************************
 * Fullscrenn control widget
 **********************************************************************/
FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWidget *_parent )
                           : AbstractController( _p_i, _parent )
{
    RTL_UNAFFECTED_WIDGET
    i_mouse_last_x      = -1;
    i_mouse_last_y      = -1;
    b_mouse_over        = false;
    i_mouse_last_move_x = -1;
    i_mouse_last_move_y = -1;
#if HAVE_TRANSPARENCY
    b_slow_hide_begin   = false;
    i_slow_hide_timeout = 1;
#endif
    b_fullscreen        = false;
    i_hide_timeout      = 1;
    i_screennumber      = -1;

    vout.clear();

    setWindowFlags( Qt::ToolTip );
    setMinimumWidth( FSC_WIDTH );
    setMinimumHeight( FSC_HEIGHT );
    isWideFSC = false;

    setFrameShape( QFrame::StyledPanel );
    setFrameStyle( QFrame::Sunken );
    setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );

    QVBoxLayout *controlLayout2 = new QVBoxLayout( this );
    controlLayout2->setContentsMargins( 4, 6, 4, 2 );

    /* First line */
    InputControlsWidget *inputC = new InputControlsWidget( p_intf, this );
    controlLayout2->addWidget( inputC );

    controlLayout = new QHBoxLayout;
    QString line = getSettings()->value( "MainWindow/FSCtoolbar", FSC_TB_DEFAULT ).toString();
    parseAndCreate( line, controlLayout );
    controlLayout2->addLayout( controlLayout );

    /* hiding timer */
    p_hideTimer = new QTimer( this );
    p_hideTimer->setSingleShot( true );
    CONNECT( p_hideTimer, timeout(), this, hideFSC() );

    /* slow hiding timer */
#if HAVE_TRANSPARENCY
    p_slowHideTimer = new QTimer( this );
    CONNECT( p_slowHideTimer, timeout(), this, slowHideFSC() );
    f_opacity = var_InheritFloat( p_intf, "qt-fs-opacity" );
#endif

    vlc_mutex_init_recursive( &lock );

    DCONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ),
              this, setVoutList( vout_thread_t **, int ) );

    /* First Move */
    previousPosition = getSettings()->value( "FullScreen/pos" ).toPoint();
    screenRes = getSettings()->value( "FullScreen/screen" ).toRect();
    isWideFSC = getSettings()->value( "FullScreen/wide" ).toBool();
    i_screennumber = var_InheritInteger( p_intf, "qt-fullscreen-screennumber" );
}
コード例 #28
0
void
SimilarArtistsApplet::init()
{
    DEBUG_BLOCK

    // Call the base implementation.
    Context::Applet::init();

    enableHeader( true );
    setHeaderText( i18n( "Similar Artists" ) );

    QAction* backwardAction = new QAction( this );
    backwardAction->setIcon( KIcon( "go-previous" ) );
    backwardAction->setEnabled( false );
    backwardAction->setText( i18n( "Back" ) );
    m_backwardIcon = addLeftHeaderAction( backwardAction );
    connect( m_backwardIcon, SIGNAL(clicked()), this, SLOT(goBackward()) );

    QAction* forwardAction = new QAction( this );
    forwardAction->setIcon( KIcon( "go-next" ) );
    forwardAction->setEnabled( false );
    forwardAction->setText( i18n( "Forward" ) );
    m_forwardIcon = addLeftHeaderAction( forwardAction );
    connect( m_forwardIcon, SIGNAL(clicked()), this, SLOT(goForward()) );

    QAction *currentAction = new QAction( this );
    currentAction->setIcon( KIcon( "filename-artist-amarok" ) );
    currentAction->setEnabled( true );
    currentAction->setText( i18n( "Show Similar Artists for Currently Playing Track" ) );
    m_currentArtistIcon = addRightHeaderAction( currentAction );
    connect( m_currentArtistIcon, SIGNAL(clicked()), this, SLOT(queryForCurrentTrack()) );

    QAction* settingsAction = new QAction( this );
    settingsAction->setIcon( KIcon( "preferences-system" ) );
    settingsAction->setEnabled( true );
    settingsAction->setText( i18n( "Settings" ) );
    m_settingsIcon = addRightHeaderAction( settingsAction );
    connect( m_settingsIcon, SIGNAL(clicked()), this, SLOT(configure()) );

    setCollapseOffHeight( -1 );
    setCollapseHeight( m_header->height() );
    setMinimumHeight( collapseHeight() );
    setPreferredHeight( collapseHeight() );

    // create a scrollarea
    m_scroll = new ArtistsListWidget( this );
    m_scroll->hide();
    connect( m_scroll, SIGNAL(showSimilarArtists(QString)), SLOT(showSimilarArtists(QString)) );
    connect( m_scroll, SIGNAL(showBio(QString)), SLOT(showArtistBio(QString)) );

    m_layout = new QGraphicsLinearLayout( Qt::Vertical, this );
    m_layout->addItem( m_header );
    m_layout->addItem( m_scroll );
    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

    // Read config and inform the engine.
    KConfigGroup config = Amarok::config( "SimilarArtists Applet" );
    m_maxArtists = config.readEntry( "maxArtists", "5" ).toInt();

    Plasma::DataEngine *engine = dataEngine( "amarok-similarArtists" );
    connect( engine, SIGNAL(sourceAdded(QString)), SLOT(connectSource(QString)) );
    engine->setProperty( "maximumArtists", m_maxArtists );
    engine->query( "similarArtists" );
}
コード例 #29
0
ファイル: widget.cpp プロジェクト: pwarnimo/misc_projects
Widget::Widget(QWidget *parent) : QFrame(parent) {
	m_parent = parent;
	setMinimumHeight(PANEL_HEIGHT);
}
コード例 #30
0
int QWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 23)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 23;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isModal(); break;
        case 1: *reinterpret_cast< Qt::WindowModality*>(_v) = windowModality(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isEnabled(); break;
        case 3: *reinterpret_cast< QRect*>(_v) = geometry(); break;
        case 4: *reinterpret_cast< QRect*>(_v) = frameGeometry(); break;
        case 5: *reinterpret_cast< QRect*>(_v) = normalGeometry(); break;
        case 6: *reinterpret_cast< int*>(_v) = x(); break;
        case 7: *reinterpret_cast< int*>(_v) = y(); break;
        case 8: *reinterpret_cast< QPoint*>(_v) = pos(); break;
        case 9: *reinterpret_cast< QSize*>(_v) = frameSize(); break;
        case 10: *reinterpret_cast< QSize*>(_v) = size(); break;
        case 11: *reinterpret_cast< int*>(_v) = width(); break;
        case 12: *reinterpret_cast< int*>(_v) = height(); break;
        case 13: *reinterpret_cast< QRect*>(_v) = rect(); break;
        case 14: *reinterpret_cast< QRect*>(_v) = childrenRect(); break;
        case 15: *reinterpret_cast< QRegion*>(_v) = childrenRegion(); break;
        case 16: *reinterpret_cast< QSizePolicy*>(_v) = sizePolicy(); break;
        case 17: *reinterpret_cast< QSize*>(_v) = minimumSize(); break;
        case 18: *reinterpret_cast< QSize*>(_v) = maximumSize(); break;
        case 19: *reinterpret_cast< int*>(_v) = minimumWidth(); break;
        case 20: *reinterpret_cast< int*>(_v) = minimumHeight(); break;
        case 21: *reinterpret_cast< int*>(_v) = maximumWidth(); break;
        case 22: *reinterpret_cast< int*>(_v) = maximumHeight(); break;
        case 23: *reinterpret_cast< QSize*>(_v) = sizeIncrement(); break;
        case 24: *reinterpret_cast< QSize*>(_v) = baseSize(); break;
        case 25: *reinterpret_cast< QPalette*>(_v) = palette(); break;
        case 26: *reinterpret_cast< QFont*>(_v) = font(); break;
        case 27: *reinterpret_cast< QCursor*>(_v) = cursor(); break;
        case 28: *reinterpret_cast< bool*>(_v) = hasMouseTracking(); break;
        case 29: *reinterpret_cast< bool*>(_v) = isActiveWindow(); break;
        case 30: *reinterpret_cast< Qt::FocusPolicy*>(_v) = focusPolicy(); break;
        case 31: *reinterpret_cast< bool*>(_v) = hasFocus(); break;
        case 32: *reinterpret_cast< Qt::ContextMenuPolicy*>(_v) = contextMenuPolicy(); break;
        case 33: *reinterpret_cast< bool*>(_v) = updatesEnabled(); break;
        case 34: *reinterpret_cast< bool*>(_v) = isVisible(); break;
        case 35: *reinterpret_cast< bool*>(_v) = isMinimized(); break;
        case 36: *reinterpret_cast< bool*>(_v) = isMaximized(); break;
        case 37: *reinterpret_cast< bool*>(_v) = isFullScreen(); break;
        case 38: *reinterpret_cast< QSize*>(_v) = sizeHint(); break;
        case 39: *reinterpret_cast< QSize*>(_v) = minimumSizeHint(); break;
        case 40: *reinterpret_cast< bool*>(_v) = acceptDrops(); break;
        case 41: *reinterpret_cast< QString*>(_v) = windowTitle(); break;
        case 42: *reinterpret_cast< QIcon*>(_v) = windowIcon(); break;
        case 43: *reinterpret_cast< QString*>(_v) = windowIconText(); break;
        case 44: *reinterpret_cast< double*>(_v) = windowOpacity(); break;
        case 45: *reinterpret_cast< bool*>(_v) = isWindowModified(); break;
        case 46: *reinterpret_cast< QString*>(_v) = toolTip(); break;
        case 47: *reinterpret_cast< QString*>(_v) = statusTip(); break;
        case 48: *reinterpret_cast< QString*>(_v) = whatsThis(); break;
        case 49: *reinterpret_cast< QString*>(_v) = accessibleName(); break;
        case 50: *reinterpret_cast< QString*>(_v) = accessibleDescription(); break;
        case 51: *reinterpret_cast< Qt::LayoutDirection*>(_v) = layoutDirection(); break;
        case 52: *reinterpret_cast< bool*>(_v) = autoFillBackground(); break;
        case 53: *reinterpret_cast< QString*>(_v) = styleSheet(); break;
        case 54: *reinterpret_cast< QLocale*>(_v) = locale(); break;
        case 55: *reinterpret_cast< QString*>(_v) = windowFilePath(); break;
        case 56: *reinterpret_cast< Qt::InputMethodHints*>(_v) = inputMethodHints(); break;
        }
        _id -= 57;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 1: setWindowModality(*reinterpret_cast< Qt::WindowModality*>(_v)); break;
        case 2: setEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 3: setGeometry(*reinterpret_cast< QRect*>(_v)); break;
        case 8: move(*reinterpret_cast< QPoint*>(_v)); break;
        case 10: resize(*reinterpret_cast< QSize*>(_v)); break;
        case 16: setSizePolicy(*reinterpret_cast< QSizePolicy*>(_v)); break;
        case 17: setMinimumSize(*reinterpret_cast< QSize*>(_v)); break;
        case 18: setMaximumSize(*reinterpret_cast< QSize*>(_v)); break;
        case 19: setMinimumWidth(*reinterpret_cast< int*>(_v)); break;
        case 20: setMinimumHeight(*reinterpret_cast< int*>(_v)); break;
        case 21: setMaximumWidth(*reinterpret_cast< int*>(_v)); break;
        case 22: setMaximumHeight(*reinterpret_cast< int*>(_v)); break;
        case 23: setSizeIncrement(*reinterpret_cast< QSize*>(_v)); break;
        case 24: setBaseSize(*reinterpret_cast< QSize*>(_v)); break;
        case 25: setPalette(*reinterpret_cast< QPalette*>(_v)); break;
        case 26: setFont(*reinterpret_cast< QFont*>(_v)); break;
        case 27: setCursor(*reinterpret_cast< QCursor*>(_v)); break;
        case 28: setMouseTracking(*reinterpret_cast< bool*>(_v)); break;
        case 30: setFocusPolicy(*reinterpret_cast< Qt::FocusPolicy*>(_v)); break;
        case 32: setContextMenuPolicy(*reinterpret_cast< Qt::ContextMenuPolicy*>(_v)); break;
        case 33: setUpdatesEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 34: setVisible(*reinterpret_cast< bool*>(_v)); break;
        case 40: setAcceptDrops(*reinterpret_cast< bool*>(_v)); break;
        case 41: setWindowTitle(*reinterpret_cast< QString*>(_v)); break;
        case 42: setWindowIcon(*reinterpret_cast< QIcon*>(_v)); break;
        case 43: setWindowIconText(*reinterpret_cast< QString*>(_v)); break;
        case 44: setWindowOpacity(*reinterpret_cast< double*>(_v)); break;
        case 45: setWindowModified(*reinterpret_cast< bool*>(_v)); break;
        case 46: setToolTip(*reinterpret_cast< QString*>(_v)); break;
        case 47: setStatusTip(*reinterpret_cast< QString*>(_v)); break;
        case 48: setWhatsThis(*reinterpret_cast< QString*>(_v)); break;
        case 49: setAccessibleName(*reinterpret_cast< QString*>(_v)); break;
        case 50: setAccessibleDescription(*reinterpret_cast< QString*>(_v)); break;
        case 51: setLayoutDirection(*reinterpret_cast< Qt::LayoutDirection*>(_v)); break;
        case 52: setAutoFillBackground(*reinterpret_cast< bool*>(_v)); break;
        case 53: setStyleSheet(*reinterpret_cast< QString*>(_v)); break;
        case 54: setLocale(*reinterpret_cast< QLocale*>(_v)); break;
        case 55: setWindowFilePath(*reinterpret_cast< QString*>(_v)); break;
        case 56: setInputMethodHints(*reinterpret_cast< Qt::InputMethodHints*>(_v)); break;
        }
        _id -= 57;
    } else if (_c == QMetaObject::ResetProperty) {
        switch (_id) {
        case 27: unsetCursor(); break;
        case 51: unsetLayoutDirection(); break;
        case 54: unsetLocale(); break;
        }
        _id -= 57;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        bool *_b = reinterpret_cast<bool*>(_a[0]);
        switch (_id) {
        case 41: *_b = isWindow(); break;
        case 42: *_b = isWindow(); break;
        case 43: *_b = isWindow(); break;
        case 44: *_b = isWindow(); break;
        case 45: *_b = isWindow(); break;
        case 55: *_b = isWindow(); break;
        }
        _id -= 57;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 57;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 57;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 57;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 57;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}