Exemple #1
0
	virtual void bytesReady( size_t offset, const dp::Data& data, bool eof )
	{
		if( !data.isNull() )
		{
			size_t buflen;
			const unsigned char * buf = data.data(&buflen);

			if (offset != m_DataBytesRead) 
			{
				reportError("Stream received non-sequentially");
				return;
			}

			if (m_DataCapacity < m_DataBytesRead + buflen) 
			{

				m_DataCapacity = m_DataBytesRead + buflen;
				unsigned char * tmp = new unsigned char[m_DataCapacity];
				if (m_pDataRead)
				{
					::memcpy(tmp, m_pDataRead, m_DataBytesRead);
					delete[] m_pDataRead;
				}
				m_pDataRead = tmp;
			}

			if( m_verbose )
				reportData( "out", offset, data );

			memcpy(m_pDataRead + m_DataBytesRead, buf, buflen);
			m_DataBytesRead += buflen;
		}
	}
QQmlProfilerAdapter::QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEnginePrivate *engine) :
    QQmlAbstractProfilerAdapter(service)
{
    engine->enableProfiler();
    connect(this, SIGNAL(profilingEnabled()), engine->profiler, SLOT(startProfiling()));
    connect(this, SIGNAL(profilingEnabledWhileWaiting()),
            engine->profiler, SLOT(startProfiling()), Qt::DirectConnection);
    connect(this, SIGNAL(profilingDisabled()), engine->profiler, SLOT(stopProfiling()));
    connect(this, SIGNAL(profilingDisabledWhileWaiting()),
            engine->profiler, SLOT(stopProfiling()), Qt::DirectConnection);
    connect(this, SIGNAL(dataRequested()), engine->profiler, SLOT(reportData()));
    connect(this, SIGNAL(referenceTimeKnown(QElapsedTimer)),
            engine->profiler, SLOT(setTimer(QElapsedTimer)));
    connect(engine->profiler, SIGNAL(dataReady(QList<QQmlProfilerData>)),
            this, SLOT(receiveData(QList<QQmlProfilerData>)));
}
Exemple #3
0
rc_t CC ReportCWD ( const ReportFuncs *f, uint32_t indent )
{
    KDirectory *wd;
    rc_t rc = KDirectoryNativeDir ( & wd );
    if ( rc != 0 )
        reportError(indent, rc, "KDirectoryNativeDir");
    else
    {
        char cwd [ PATH_MAX + 1 ];
        rc = KDirectoryResolvePath ( wd, true, cwd, sizeof cwd, "." );
        KDirectoryRelease ( wd );

        if ( rc != 0 )
            reportError(indent, rc, "KDirectoryResolvePath");
        else
            reportData(indent, "Cwd", cwd, 0);
    }

    return rc;
}
QT_BEGIN_NAMESPACE

QV4ProfilerAdapter::QV4ProfilerAdapter(QQmlProfilerService *service, QV4::ExecutionEngine *engine) :
    QQmlAbstractProfilerAdapter(service)
{
    engine->enableProfiler();
    connect(this, SIGNAL(profilingEnabled(quint64)),
            engine->profiler, SLOT(startProfiling(quint64)));
    connect(this, SIGNAL(profilingEnabledWhileWaiting(quint64)),
            engine->profiler, SLOT(startProfiling(quint64)), Qt::DirectConnection);
    connect(this, SIGNAL(profilingDisabled()), engine->profiler, SLOT(stopProfiling()));
    connect(this, SIGNAL(profilingDisabledWhileWaiting()), engine->profiler, SLOT(stopProfiling()),
            Qt::DirectConnection);
    connect(this, SIGNAL(dataRequested()), engine->profiler, SLOT(reportData()));
    connect(this, SIGNAL(referenceTimeKnown(QElapsedTimer)),
            engine->profiler, SLOT(setTimer(QElapsedTimer)));
    connect(engine->profiler, SIGNAL(dataReady(QList<QV4::Profiling::FunctionCallProperties>,
                                               QList<QV4::Profiling::MemoryAllocationProperties>)),
            this, SLOT(receiveData(QList<QV4::Profiling::FunctionCallProperties>,
                                   QList<QV4::Profiling::MemoryAllocationProperties>)));
}
Exemple #5
0
void QQmlProfiler::stopProfiling()
{
    featuresEnabled = false;
    reportData();
}
void QQmlProfiler::stopProfiling()
{
    enabled = false;
    reportData();
    m_data.clear();
}
Exemple #7
0
	// This is the writer call back function used by m_curl  
	size_t writer_callback( void *ptr, size_t size, size_t nmemb)
	{
		dputils::StreamGuard guard(this);

		if (!m_client)
			return 0;

		// What we will return  
		size_t result = 0;  
		size_t bytes = size * nmemb;
		switch (m_state)
		{
		case 0: //  broken state;
			return 0;
		case 1: // unexpected, but let's recover
#ifdef USE_CURL_PAUSE
			curl_easy_pause (m_curl, CURLPAUSE_SEND);
			m_state = 2;
#else
			m_state = 4;
#endif
			append ((unsigned char *)ptr, bytes);
			if (m_client)
			{
				m_client->propertiesReady();
			}
			break;
		case 2:
			{
				//it's the first time after requestBytes was called
				append((unsigned char *)ptr, bytes);
				dp::Data data (m_saved, m_savedSize);
				m_state = 3;
				if (m_client)
				{
					size_t oldOffset = m_writeOffset;
					m_writeOffset += bytes;
					if( m_verbose )
						reportData( "in", oldOffset, data );
					m_client->bytesReady(oldOffset, data, bytes == 0);
				}
			}
			break;
		case 3:
			{
				dp::Data data (static_cast<unsigned char *>(ptr), bytes);
				if (m_client)
				{
					size_t oldOffset = m_writeOffset;
					m_writeOffset += bytes;
					if( m_verbose )
						reportData( "in", oldOffset, data );
					m_client->bytesReady(oldOffset, data, bytes == 0);
				}
			}
			break;

#ifndef USE_CURL_PAUSE
		case 4:
			{
				append ((unsigned char *)ptr, bytes);
			}
			break;
#endif
		}
		if (m_client)
			result = bytes;

		return result;  
	}
Exemple #8
0
ListGroups::ListGroups(QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());

  setCaption(tr("Rivendell Group List"));

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

  //
  //  Add Button
  //
  list_add_button=new QPushButton(this,"list_add_button");
  list_add_button->setFont(font);
  list_add_button->setText(tr("&Add"));
  connect(list_add_button,SIGNAL(clicked()),this,SLOT(addData()));

  //
  //  Edit Button
  //
  list_edit_button=new QPushButton(this,"list_edit_button");
  list_edit_button->setFont(font);
  list_edit_button->setText(tr("&Edit"));
  connect(list_edit_button,SIGNAL(clicked()),this,SLOT(editData()));

  //
  //  Rename Button
  //
  list_rename_button=new QPushButton(this,"list_rename_button");
  list_rename_button->setFont(font);
  list_rename_button->setText(tr("&Rename"));
  connect(list_rename_button,SIGNAL(clicked()),this,SLOT(renameData()));

  //
  //  Delete Button
  //
  list_delete_button=new QPushButton(this,"list_delete_button");
  list_delete_button->setFont(font);
  list_delete_button->setText(tr("&Delete"));
  connect(list_delete_button,SIGNAL(clicked()),this,SLOT(deleteData()));

  //
  //  Report Button
  //
  list_report_button=new QPushButton(this,"list_report_button");
  list_report_button->setFont(font);
  list_report_button->setText(tr("Generate\n&Report"));
  connect(list_report_button,SIGNAL(clicked()),this,SLOT(reportData()));

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

  //
  // Group List
  //
  list_groups_view=new RDListView(this,"list_groups_view");
  list_groups_view->setFont(list_font);
  list_groups_view->setAllColumnsShowFocus(true);
  list_groups_view->addColumn(tr("NAME"));
  list_groups_view->addColumn(tr("DESCRIPTION"));
  list_groups_view->addColumn(tr("START CART"));
  list_groups_view->setColumnAlignment(2,Qt::AlignCenter);
  list_groups_view->addColumn(tr("END CART"));
  list_groups_view->setColumnAlignment(3,Qt::AlignHCenter);
  list_groups_view->addColumn(tr("ENFORCE RANGE"));
  list_groups_view->setColumnAlignment(4,Qt::AlignHCenter);
  list_groups_view->addColumn(tr("DEFAULT TYPE"));
  list_groups_view->setColumnAlignment(5,Qt::AlignHCenter);
  list_groups_view->addColumn(tr("TRAFFIC REPORT"));
  list_groups_view->setColumnAlignment(6,Qt::AlignHCenter);
  list_groups_view->addColumn(tr("MUSIC REPORT"));
  list_groups_view->setColumnAlignment(7,Qt::AlignHCenter);
  list_groups_view->addColumn(tr("NOW & NEXT"));
  list_groups_view->setColumnAlignment(8,Qt::AlignHCenter);
  QLabel *list_box_label=new QLabel(list_groups_view,tr("&Groups:"),
				    this,"list_box_label");
  list_box_label->setFont(font);
  list_box_label->setGeometry(14,11,85,19);
  connect(list_groups_view,
	  SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),
	  this,
	  SLOT(doubleClickedData(QListViewItem *,const QPoint &,int)));

  RefreshList();
}
Exemple #9
0
ListCasts::ListCasts(unsigned feed_id,QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  list_feed_id=feed_id;

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

  setCaption(tr("Podcast List"));

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

  //
  // Create Icons
  //
  list_greenball_map=new QPixmap(greenball_xpm);
  list_redball_map=new QPixmap(redball_xpm);
  list_whiteball_map=new QPixmap(whiteball_xpm);

  //
  // The Feed
  //
  list_feed=new RDFeed(feed_id,this);

  //
  // Progress Dialog
  //
  list_progress_dialog=
    new QProgressDialog(tr("Uploading Audio..."),"Cancel",4,this);
  list_progress_dialog->setCaption(tr("Progress"));
  list_progress_dialog->setMinimumDuration(0);
  list_progress_dialog->setTotalSteps(list_feed->totalPostSteps());
  connect(list_feed,SIGNAL(postProgressChanged(int)),
	  this,SLOT(postProgressChangedData(int)));

  //
  // Filter
  //
  list_filter_edit=new QLineEdit(this,"list_filter_edit");
  list_filter_label=
    new QLabel(list_filter_edit,tr("Filter:"),this,"list_filter_label");
  list_filter_label->setFont(font);
  list_filter_label->setAlignment(AlignRight|AlignVCenter);
  connect(list_filter_edit,SIGNAL(textChanged(const QString &)),
	  this,SLOT(filterChangedData(const QString &)));

  //
  // Unexpired Check Box
  //
  list_unexpired_check=new QCheckBox(this,"list_unexpired_check");
  list_unexpired_label=
    new QLabel(list_unexpired_check,tr("Only Show Unexpired Casts"),this,
	       "list_unexpired_label");
  list_unexpired_label->setFont(font);
  list_unexpired_label->setAlignment(AlignLeft|AlignVCenter);
  connect(list_unexpired_check,SIGNAL(toggled(bool)),
	  this,SLOT(notexpiredToggledData(bool)));

  //
  // Active Check Box
  //
  list_active_check=new QCheckBox(this,"list_active_check");
  list_active_label=
    new QLabel(list_active_check,tr("Only Show Active Casts"),this,
	       "list_active_label");
  list_active_label->setFont(font);
  list_active_label->setAlignment(AlignLeft|AlignVCenter);
  connect(list_active_check,SIGNAL(toggled(bool)),
	  this,SLOT(activeToggledData(bool)));

  //
  // Group List
  //
  list_casts_view=new RDListView(this,"list_casts_view");
  list_casts_view->setAllColumnsShowFocus(true);
  list_casts_view->setItemMargin(5);
  list_casts_view->addColumn(tr(" "));
  list_casts_view->setColumnAlignment(0,AlignCenter);
  list_casts_view->addColumn(tr("Title"));
  list_casts_view->setColumnAlignment(1,AlignLeft);
  list_casts_view->addColumn(tr("Origin"));
  list_casts_view->setColumnAlignment(2,AlignLeft);
  list_casts_view->addColumn(tr("Expires"));
  list_casts_view->setColumnAlignment(3,AlignCenter);
  list_casts_view->addColumn(tr("Length"));
  list_casts_view->setColumnAlignment(4,AlignRight);
  list_casts_view->addColumn(tr("Description"));
  list_casts_view->setColumnAlignment(5,AlignLeft);
  list_casts_view->addColumn(tr("Category"));
  list_casts_view->setColumnAlignment(6,AlignCenter);
  list_casts_view->addColumn(tr("Link"));
  list_casts_view->setColumnAlignment(7,AlignCenter);
  connect(list_casts_view,
	  SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),
	  this,
	  SLOT(doubleClickedData(QListViewItem *,const QPoint &,int)));

  //
  //  Post Cart Button
  //
  list_cart_button=new QPushButton(this,"list_cart_button");
  list_cart_button->setFont(font);
  list_cart_button->setText(tr("Post From\nCar&t/Cut"));
  connect(list_cart_button,SIGNAL(clicked()),this,SLOT(addCartData()));

  //
  //  Post File Button
  //
  list_file_button=new QPushButton(this,"list_file_button");
  list_file_button->setFont(font);
  list_file_button->setText(tr("Post From\n&File"));
  connect(list_file_button,SIGNAL(clicked()),this,SLOT(addFileData()));

  //
  //  Edit Button
  //
  list_edit_button=new QPushButton(this,"list_edit_button");
  list_edit_button->setFont(font);
  list_edit_button->setText(tr("&Edit"));
  connect(list_edit_button,SIGNAL(clicked()),this,SLOT(editData()));

  //
  //  Delete Button
  //
  list_delete_button=new QPushButton(this,"list_delete_button");
  list_delete_button->setFont(font);
  list_delete_button->setText(tr("&Delete"));
  connect(list_delete_button,SIGNAL(clicked()),this,SLOT(deleteData()));

  //
  //  Report Button
  //
  list_report_button=new QPushButton(this,"list_report_button");
  list_report_button->setFont(font);
  list_report_button->setText(tr("Subscription\n&Report"));
  connect(list_report_button,SIGNAL(clicked()),this,SLOT(reportData()));

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

  RefreshList();
  GetEncoderId();
  connect(cast_ripc,SIGNAL(userChanged()),this,SLOT(userChangedData()));
  userChangedData();
}
Exemple #10
0
MainWidget::MainWidget(QWidget *parent)
  :Q3MainWindow(parent)
{
  new RDApplication(RDApplication::Gui,"rdlogedit",RDLOGEDIT_USAGE);

  QString str1;
  QString str2;
  log_log_list=NULL;
  QString sql;
  RDSqlQuery *q;

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

  //
  // Ensure that the system daemons are running
  //
#ifndef WIN32
  RDInitializeDaemons();
#endif  // WIN32

  //
  // Load Local Configs
  //
  str1=QString("RDLogEdit")+"v"+VERSION+" - "+tr("Host");
  str2=tr("User")+": ["+tr("Unknown")+"]";
  setCaption(QString().sprintf("%s: %s, %s",(const char *)str1,
			       (const char *)rda->config()->stationName(),
			       (const char *)str2));
  log_import_path=RDGetHomeDir();

#ifndef WIN32
  rda->cae()->connectHost();
#endif  // WIN32

  //
  // RIPC Connection
  //
#ifndef WIN32
  connect(rda->ripc(),SIGNAL(connected(bool)),this,SLOT(connectedData(bool)));
  connect(rda->ripc(),SIGNAL(userChanged()),this,SLOT(userData()));
  rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
#endif  // WIN32

  // 
  // Create Fonts
  //
  QFont default_font("Helvetica",12,QFont::Normal);
  default_font.setPixelSize(12);
  qApp->setFont(default_font);
  QFont button_font=QFont("Helvetica",12,QFont::Bold);
  button_font.setPixelSize(12);

  //
  // Create Icons
  //
  log_rivendell_map=new QPixmap(rivendell_xpm);
  setIcon(*log_rivendell_map);
  log_greencheckmark_map=new QPixmap(greencheckmark_xpm);
  log_redx_map=new QPixmap(redx_xpm);
  log_whiteball_map=new QPixmap(whiteball_xpm);
  log_greenball_map=new QPixmap(greenball_xpm);
  log_redball_map=new QPixmap(redball_xpm);

  //
  // User
  //
#ifndef WIN32
  //
  // Load Audio Assignments
  //
  RDSetMixerPorts(rda->config()->stationName(),rda->cae());
#else 
  rda->setUser(RD_USER_LOGIN_NAME);
#endif  // WIN32

  //
  // Service Selector
  //
  log_service_box=new QComboBox(this);
  log_service_box->setFont(default_font);
  connect(log_service_box,SIGNAL(activated(const QString &)),
	  this,SLOT(filterChangedData(const QString &)));
  log_service_box->insertItem(tr("ALL"));
  sql="select NAME from SERVICES order by NAME";
  q=new RDSqlQuery(sql);
  while(q->next()) {
    log_service_box->insertItem(q->value(0).toString());
  }
  delete q;
  log_service_label=new QLabel(log_service_box,tr("Service")+":",this);
  log_service_label->setFont(button_font);
  log_service_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);

  //
  // Filter
  //
  log_filter_edit=new QLineEdit(this);
  log_filter_edit->setFont(default_font);
  connect(log_filter_edit,SIGNAL(textChanged(const QString &)),
	  this,SLOT(filterChangedData(const QString &)));
  log_filter_label=new QLabel(log_filter_edit,tr("Filter")+":",this);
  log_filter_label->setFont(button_font);
  log_filter_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  log_filter_button=new QPushButton(tr("Clear"),this);
  log_filter_button->setFont(button_font);
  connect(log_filter_button,SIGNAL(clicked()),this,SLOT(filterClearedData()));

  //
  // Show Recent Checkbox
  //
  log_recent_check=new QCheckBox(this);
  connect(log_recent_check,SIGNAL(toggled(bool)),this,SLOT(recentData(bool)));
  log_recent_label=
    new QLabel(log_recent_check,tr("Show Only Recent Logs"),this);
  log_recent_label->setFont(button_font);

  //
  // Log List
  //
  log_log_list=new Q3ListView(this);
  log_log_list->setFont(default_font);
  log_log_list->setAllColumnsShowFocus(true);
  log_log_list->setItemMargin(5);
  connect(log_log_list,
	  SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)),
	  this,
	  SLOT(logDoubleclickedData(Q3ListViewItem *,const QPoint &,int)));
  log_log_list->addColumn("");
  log_log_list->setColumnAlignment(0,Qt::AlignCenter);
  log_log_list->addColumn(tr("LOG NAME"));
  log_log_list->setColumnAlignment(1,Qt::AlignHCenter);
  log_log_list->addColumn(tr("DESCRIPTION"));
  log_log_list->setColumnAlignment(2,Qt::AlignLeft);
  log_log_list->addColumn(tr("SERVICE"));
  log_log_list->setColumnAlignment(3,Qt::AlignLeft);
  log_log_list->addColumn(tr("MUSIC"));
  log_log_list->setColumnAlignment(4,Qt::AlignCenter);
  log_log_list->addColumn(tr("TRAFFIC"));
  log_log_list->setColumnAlignment(5,Qt::AlignCenter);
  log_log_list->addColumn(tr("TRACKS"));
  log_log_list->setColumnAlignment(6,Qt::AlignHCenter);
  log_log_list->addColumn(tr("VALID FROM"));
  log_log_list->setColumnAlignment(7,Qt::AlignHCenter);
  log_log_list->addColumn(tr("VALID TO"));
  log_log_list->setColumnAlignment(8,Qt::AlignHCenter);
  log_log_list->addColumn(tr("AUTO REFRESH"));
  log_log_list->setColumnAlignment(9,Qt::AlignHCenter);
  log_log_list->addColumn(tr("ORIGIN"));
  log_log_list->setColumnAlignment(10,Qt::AlignLeft);
  log_log_list->addColumn(tr("LAST LINKED"));
  log_log_list->setColumnAlignment(11,Qt::AlignLeft);
  log_log_list->addColumn(tr("LAST MODIFIED"));
  log_log_list->setColumnAlignment(12,Qt::AlignLeft);

  RefreshList();

  //
  // Add Button
  //
  log_add_button=new QPushButton(this);
  log_add_button->setFont(button_font);
  log_add_button->setText(tr("&Add"));
  connect(log_add_button,SIGNAL(clicked()),this,SLOT(addData()));

  //
  // Edit Button
  //
  log_edit_button=new QPushButton(this);
  log_edit_button->setFont(button_font);
  log_edit_button->setText(tr("&Edit"));
  connect(log_edit_button,SIGNAL(clicked()),this,SLOT(editData()));

  //
  // Delete Button
  //
  log_delete_button=new QPushButton(this);
  log_delete_button->setFont(button_font);
  log_delete_button->setText(tr("&Delete"));
  connect(log_delete_button,SIGNAL(clicked()),this,SLOT(deleteData()));

  //
  // Tracker Button
  //
  log_track_button=new QPushButton(this);
  log_track_button->setFont(button_font);
  log_track_button->setText(tr("Voice\n&Tracker"));
  connect(log_track_button,SIGNAL(clicked()),this,SLOT(trackData()));
#ifdef WIN32
  log_track_button->hide();
#endif

  //
  // Log Report Button
  //
  log_report_button=new QPushButton(this);
  log_report_button->setFont(button_font);
  log_report_button->setText(tr("Log\nReport"));
  connect(log_report_button,SIGNAL(clicked()),this,SLOT(reportData()));

  //
  // Close Button
  //
  log_close_button=new QPushButton(this);
  log_close_button->setFont(button_font);
  log_close_button->setText(tr("&Close"));
  connect(log_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget()));

#ifndef WIN32
  // 
  // Setup Signal Handling 
  //
  ::signal(SIGCHLD,SigHandler);
#endif  // WIN32
}
Exemple #11
0
ListGroups::ListGroups(QWidget *parent)
  : QDialog(parent)
{
  //
  // Fix the Window Size
  //
  setMinimumSize(sizeHint());

  setWindowTitle("RDAdmin - "+tr("Rivendell Group List"));

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

  //
  //  Add Button
  //
  list_add_button=new QPushButton(this);
  list_add_button->setFont(font);
  list_add_button->setText(tr("&Add"));
  connect(list_add_button,SIGNAL(clicked()),this,SLOT(addData()));

  //
  //  Edit Button
  //
  list_edit_button=new QPushButton(this);
  list_edit_button->setFont(font);
  list_edit_button->setText(tr("&Edit"));
  connect(list_edit_button,SIGNAL(clicked()),this,SLOT(editData()));

  //
  //  Rename Button
  //
  list_rename_button=new QPushButton(this);
  list_rename_button->setFont(font);
  list_rename_button->setText(tr("&Rename"));
  connect(list_rename_button,SIGNAL(clicked()),this,SLOT(renameData()));

  //
  //  Delete Button
  //
  list_delete_button=new QPushButton(this);
  list_delete_button->setFont(font);
  list_delete_button->setText(tr("&Delete"));
  connect(list_delete_button,SIGNAL(clicked()),this,SLOT(deleteData()));

  //
  //  Report Button
  //
  list_report_button=new QPushButton(this);
  list_report_button->setFont(font);
  list_report_button->setText(tr("Generate\n&Report"));
  connect(list_report_button,SIGNAL(clicked()),this,SLOT(reportData()));

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

  //
  // Group List
  //
  QLabel *list_box_label=new QLabel(tr("&Groups:"),this);
  list_box_label->setFont(font);
  list_box_label->setGeometry(14,11,85,19);
  list_model=new RDSqlTableModel(this);
  QString sql=QString("select ")+
    "NAME,"+                   // 00
    "DESCRIPTION,"+            // 01
    "DEFAULT_LOW_CART,"+       // 02
    "DEFAULT_HIGH_CART,"+      // 03
    "ENFORCE_CART_RANGE,"+     // 04
    "DEFAULT_CART_TYPE,"+      // 05
    "REPORT_TFC,"+             // 06
    "REPORT_MUS,"+             // 07
    "ENABLE_NOW_NEXT,"+        // 08
    "COLOR "+                  // 09
    "from GROUPS";
  list_model->setQuery(sql);
  list_model->setHeaderData(0,Qt::Horizontal,tr("Name"));
  list_model->setFieldType(0,RDSqlTableModel::ColorTextType,9);
  list_model->setHeaderData(1,Qt::Horizontal,tr("Description"));
  list_model->setHeaderData(2,Qt::Horizontal,tr("Start Cart"));
  list_model->setHeaderData(3,Qt::Horizontal,tr("End Cart"));
  list_model->setHeaderData(4,Qt::Horizontal,tr("Enforce Range"));
  list_model->setHeaderData(5,Qt::Horizontal,tr("Default Type"));
  list_model->setHeaderData(6,Qt::Horizontal,tr("Traffic Report"));
  list_model->setHeaderData(7,Qt::Horizontal,tr("Music Report"));
  list_model->setHeaderData(8,Qt::Horizontal,tr("Now & Next"));
  list_view=new RDTableView(this);
  list_view->setModel(list_model);
  list_view->hideColumn(9);
  connect(list_view,SIGNAL(doubleClicked(const QModelIndex &)),
	  this,SLOT(doubleClickedData(const QModelIndex &)));
}
Exemple #12
0
EditCast::EditCast(unsigned cast_id,QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  QString sql;
  RDSqlQuery *q;
  RDSqlQuery *q1;
  int ypos=0;

  cast_cast=new RDPodcast(cast_id);
  cast_feed=new RDFeed(cast_cast->feedId());
  cast_status=cast_cast->status();
  setCaption(tr("Editing PodCast"));

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

  //
  // Item Media Link
  //
  cast_item_medialink_edit=new QLineEdit(this,"cast_item_medialink_edit");
  cast_item_medialink_edit->setGeometry(115,10,sizeHint().width()-125,20);
  cast_item_medialink_edit->setReadOnly(true);
  QLabel *cast_item_medialink_label=
    new QLabel(cast_item_medialink_edit,tr("Media Link:"),this,
	       "cast_item_medialink_label");
  cast_item_medialink_label->setGeometry(20,10,90,20);
  cast_item_medialink_label->setFont(font);
  cast_item_medialink_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  if(cast_feed->mediaLinkMode()==RDFeed::LinkNone) {
    cast_item_medialink_edit->hide();
    cast_item_medialink_label->hide();
    ypos=10;
  }
  else {
    ypos=42;
  }

  //
  // Item Title
  //
  cast_item_title_edit=new QLineEdit(this,"cast_item_title_edit");
  cast_item_title_edit->setGeometry(115,ypos,sizeHint().width()-125,20);
  cast_item_title_edit->setMaxLength(255);
  QLabel *cast_item_title_label=
    new QLabel(cast_item_title_edit,tr("Title:"),this,
	       "cast_item_title_label");
  cast_item_title_label->setGeometry(20,ypos,90,20);
  cast_item_title_label->setFont(font);
  cast_item_title_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Author
  //
  cast_item_author_edit=new QLineEdit(this,"cast_item_author_edit");
  cast_item_author_edit->setGeometry(115,ypos+22,sizeHint().width()-125,20);
  cast_item_author_edit->setMaxLength(255);
  QLabel *cast_item_author_label=
    new QLabel(cast_item_author_edit,tr("Author E-Mail:"),this,
	       "cast_item_author_label");
  cast_item_author_label->setGeometry(20,ypos+22,90,20);
  cast_item_author_label->setFont(font);
  cast_item_author_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Category
  //
  cast_item_category_edit=new QLineEdit(this,"cast_item_category_edit");
  cast_item_category_edit->setGeometry(115,ypos+44,sizeHint().width()-125,20);
  cast_item_category_edit->setMaxLength(64);
  QLabel *cast_item_category_label=
    new QLabel(cast_item_category_edit,tr("Category:"),this,
	       "cast_item_category_label");
  cast_item_category_label->setGeometry(20,ypos+44,90,20);
  cast_item_category_label->setFont(font);
  cast_item_category_label->
    setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Link
  //
  cast_item_link_edit=new QLineEdit(this,"cast_item_link_edit");
  cast_item_link_edit->setGeometry(115,ypos+66,sizeHint().width()-125,20);
  cast_item_link_edit->setMaxLength(255);
  QLabel *cast_item_link_label=
    new QLabel(cast_item_link_edit,tr("Link URL:"),this,
	       "cast_item_link_label");
  cast_item_link_label->setGeometry(20,ypos+66,90,20);
  cast_item_link_label->setFont(font);
  cast_item_link_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Description
  //
  cast_item_description_edit=
    new QTextEdit(this,"cast_item_description_edit");
  cast_item_description_edit->
    setGeometry(115,ypos+88,sizeHint().width()-125,76);
  QLabel *cast_item_description_label=
    new QLabel(cast_item_description_edit,tr("Description:"),this,
	       "cast_item_description_label");
  cast_item_description_label->setGeometry(20,ypos+88,90,20);
  cast_item_description_label->setFont(font);
  cast_item_description_label->
    setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Source Text
  //
  cast_item_sourcetext_edit=new QLineEdit(this,"cast_item_sourcetext_edit");
  cast_item_sourcetext_edit->setGeometry(115,ypos+169,sizeHint().width()-125,20);
  cast_item_sourcetext_edit->setMaxLength(64);
  QLabel *cast_item_sourcetext_label=
    new QLabel(cast_item_sourcetext_edit,tr("Source Text:"),this,
	       "cast_item_sourcetext_label");
  cast_item_sourcetext_label->setGeometry(20,ypos+169,90,20);
  cast_item_sourcetext_label->setFont(font);
  cast_item_sourcetext_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Source URL
  //
  cast_item_sourceurl_edit=new QLineEdit(this,"cast_item_sourceurl_edit");
  cast_item_sourceurl_edit->setGeometry(115,ypos+191,sizeHint().width()-125,20);
  cast_item_sourceurl_edit->setMaxLength(64);
  QLabel *cast_item_sourceurl_label=
    new QLabel(cast_item_sourceurl_edit,tr("Source URL:"),this,
	       "cast_item_sourceurl_label");
  cast_item_sourceurl_label->setGeometry(20,ypos+191,90,20);
  cast_item_sourceurl_label->setFont(font);
  cast_item_sourceurl_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Item Comments
  //
  cast_item_comments_edit=new QLineEdit(this,"cast_item_comments_edit");
  cast_item_comments_edit->setGeometry(115,ypos+213,sizeHint().width()-125,20);
  cast_item_comments_edit->setMaxLength(64);
  QLabel *cast_item_comments_label=
    new QLabel(cast_item_comments_edit,tr("Comments URL:"),this,
	       "cast_item_comments_label");
  cast_item_comments_label->setGeometry(10,ypos+213,100,20);
  cast_item_comments_label->setFont(font);
  cast_item_comments_label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Auxiliary Fields
  //
  cast_ypos=233+ypos;
  QString keyname=cast_cast->keyName();
  keyname.replace(" ","_");
  QLabel *label;
  sql=QString().sprintf("select VAR_NAME,CAPTION from AUX_METADATA \
                         where FEED_ID=%u order by VAR_NAME",
			cast_cast->feedId());
  q=new RDSqlQuery(sql);
  while(q->next()) {
    cast_aux_varnames.push_back(q->value(0).toString().
				mid(1,q->value(0).toString().length()-2));
    cast_aux_edits.push_back(new QLineEdit(this));
    cast_aux_edits.back()->
      setGeometry(115,cast_ypos,sizeHint().width()-125,20);
    cast_aux_edits.back()->setMaxLength(255);
    sql=QString().sprintf("select %s from %s_FIELDS where CAST_ID=%u",
			  (const char *)cast_aux_varnames.back(),
			  (const char *)keyname,cast_cast->id());
    q1=new RDSqlQuery(sql);
    if(q1->first()) {
      cast_aux_edits.back()->setText(q1->value(0).toString());
    }
    delete q1;
    label=new QLabel(cast_aux_edits.back(),q->value(1).toString()+":",this);
    label->setGeometry(20,cast_ypos,90,20);
    label->setFont(font);
    label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
    cast_ypos+=22;
  }
  delete q;
  cast_ypos+=3;

  //
  // Effective DateTime
  //
  cast_item_effective_edit=new QDateTimeEdit(this);
  cast_item_effective_edit->
    setGeometry(115,cast_ypos,165,20);
  label=new QLabel(cast_item_effective_edit,tr("Air Date/Time:"),this,
		   "cast_item_effective_label");
  label->setGeometry(20,cast_ypos,90,20);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  QPushButton *button=new QPushButton(this,"cast_item_effective_button");
  button->setGeometry(290,cast_ypos-3,50,25);
  button->setFont(select_font);
  button->setText(tr("&Select"));
  connect(button,SIGNAL(clicked()),this,SLOT(effectiveSelectData()));
  cast_ypos+=22;

  //
  // Item Origin
  //
  cast_item_origin_edit=new QLineEdit(this,"cast_item_origin_edit");
  cast_item_origin_edit->setReadOnly(true);
  cast_item_origin_edit->setGeometry(115,cast_ypos,165,20);
  cast_item_origin_edit->setMaxLength(64);
  QLabel *cast_item_origin_label=
    new QLabel(cast_item_origin_edit,tr("Posted At:"),this,
	       "cast_item_origin_label");
  cast_item_origin_label->setGeometry(20,cast_ypos,90,20);
  cast_item_origin_label->setFont(font);
  cast_item_origin_label->
    setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  cast_ypos+=22;

  //
  // Item Expiration
  //
  cast_item_expiration_box=new QComboBox(this,"cast_item_expiration_box");
  cast_item_expiration_box->setGeometry(115,cast_ypos,50,20);
  cast_item_expiration_box->insertItem(tr("No"));
  cast_item_expiration_box->insertItem(tr("Yes"));
  connect(cast_item_expiration_box,SIGNAL(activated(int)),
	  this,SLOT(expirationSelectedData(int)));
  label=new QLabel(cast_item_expiration_box,tr("Cast Expires:"),this,"label");
  label->setGeometry(20,cast_ypos,90,20);
  label->setFont(font);
  label->
    setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  cast_ypos+=22;
  cast_item_expiration_box->setEnabled(cast_status!=RDPodcast::StatusExpired);
  label->setEnabled(cast_status!=RDPodcast::StatusExpired);

  cast_item_expiration_edit=new QDateEdit(this);
  cast_item_expiration_edit->setGeometry(115,cast_ypos,95,20);
  cast_item_expiration_label=
    new QLabel(cast_item_expiration_edit,tr("Expires On:"),this,
	       "cast_item_expiration_label");
  cast_item_expiration_label->setGeometry(20,cast_ypos,90,20);
  cast_item_expiration_label->setFont(font);
  cast_item_expiration_label->
    setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  cast_item_expiration_button=
    new QPushButton(this,"cast_item_expiration_button");
  cast_item_expiration_button->setGeometry(220,cast_ypos-3,50,25);
  cast_item_expiration_button->setFont(select_font);
  cast_item_expiration_button->setText(tr("&Select"));
  connect(cast_item_expiration_button,SIGNAL(clicked()),
	  this,SLOT(expirationSelectData()));
  cast_ypos+=27;
  cast_item_expiration_edit->setEnabled(cast_status!=RDPodcast::StatusExpired);
  cast_item_expiration_label->
    setEnabled(cast_status!=RDPodcast::StatusExpired);
  cast_item_expiration_button->
    setEnabled(cast_status!=RDPodcast::StatusExpired);

  //
  // Cast Status
  //
  cast_item_status_group=new QButtonGroup(this,"cast_item_status_group");
  cast_item_status_group->setExclusive(true);
  cast_item_status_group->hide();

  QRadioButton *rbutton=new QRadioButton(this,"hold_button");
  rbutton->setGeometry(120,cast_ypos,15,15);
  cast_item_status_group->insert(rbutton);
  label=new QLabel(rbutton,tr("Hold"),this,"hold_label");
  label->setFont(select_font);
  label->setGeometry(140,cast_ypos,30,15);
  label->setAlignment(AlignVCenter|AlignLeft);
  rbutton->setChecked(true);
  label->setEnabled(cast_status!=RDPodcast::StatusExpired);
  rbutton->setEnabled(cast_status!=RDPodcast::StatusExpired);

  rbutton=new QRadioButton(this,"active_button");
  rbutton->setGeometry(190,cast_ypos,15,15);
  cast_item_status_group->insert(rbutton);
  label=new QLabel(rbutton,tr("Active"),this,"hold_label");
  label->setFont(select_font);
  label->setGeometry(210,cast_ypos,80,15);
  label->setAlignment(AlignVCenter|AlignLeft);
  label->setEnabled(cast_status!=RDPodcast::StatusExpired);
  label=new QLabel(cast_item_status_group,tr("Posting Status:"),this,
		   "cast_item_status_label");
  label->setGeometry(20,cast_ypos-1,90,20);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
  label->setEnabled(cast_status!=RDPodcast::StatusExpired);
  rbutton->setEnabled(cast_status!=RDPodcast::StatusExpired);

  //
  //  Report Button
  //
  button=new QPushButton(this,"button");
  button->setGeometry(10,sizeHint().height()-60,80,50);
  button->setFont(font);
  button->setText(tr("Episode\n&Report"));
  connect(button,SIGNAL(clicked()),this,SLOT(reportData()));

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

  //
  //  Cancel Button
  //
  button=new QPushButton(this,"button");
  button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
			     80,50);
  button->setFont(font);
  button->setText(tr("&Cancel"));
  connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));

  //
  // Populate Values
  //
  cast_item_medialink_edit->
    setText(cast_feed->audioUrl(cast_feed->mediaLinkMode(),
				"[web-hostname]",cast_cast->id()));
  cast_item_title_edit->setText(cast_cast->itemTitle());
  cast_item_author_edit->setText(cast_cast->itemAuthor());
  cast_item_origin_edit->setText(RDUtcToLocal(cast_cast->originDateTime()).
				 toString("MM/dd/yyyy - hh:mm:ss"));
  cast_item_category_edit->setText(cast_cast->itemCategory());
  cast_item_link_edit->setText(cast_cast->itemLink());
  cast_item_sourcetext_edit->setText(cast_cast->itemSourceText());
  cast_item_sourceurl_edit->setText(cast_cast->itemSourceUrl());
  cast_item_description_edit->setText(cast_cast->itemDescription());
  cast_item_comments_edit->setText(cast_cast->itemComments());
  cast_item_effective_edit->
    setDateTime(RDUtcToLocal(cast_cast->effectiveDateTime()));
  if(cast_cast->shelfLife()>0) {
    cast_item_expiration_box->setCurrentItem(1);
  }
  cast_item_expiration_edit->
    setDate(RDUtcToLocal(cast_cast->originDateTime()).date().
	    addDays(cast_cast->shelfLife()));
  expirationSelectedData(cast_item_expiration_box->currentItem());
  switch(cast_status) {
      case RDPodcast::StatusActive:
	cast_item_status_group->setButton(1);
	break;

      case RDPodcast::StatusPending:
	cast_item_status_group->setButton(0);
	break;

    case RDPodcast::StatusExpired:
      cast_item_status_group->setDisabled(true);
      break;
  }

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