Example #1
0
bool ArchiveFileSelector::Create(void)
{
    bool foundtheme = false;

    // Load the theme for this screen
    foundtheme = LoadWindowFromXML("mythnative-ui.xml", "archivefile_selector", this);

    if (!foundtheme)
        return false;

    bool err = false;
    UIUtilW::Assign(this, m_titleText, "title");
    UIUtilE::Assign(this, m_fileButtonList, "filelist", &err);
    UIUtilE::Assign(this, m_locationEdit, "location_edit", &err);
    UIUtilE::Assign(this, m_backButton, "back_button", &err);
    UIUtilE::Assign(this, m_homeButton, "home_button", &err);
    UIUtilE::Assign(this, m_nextButton, "next_button", &err);
    UIUtilE::Assign(this, m_prevButton, "prev_button", &err);
    UIUtilE::Assign(this, m_cancelButton, "cancel_button", &err);
    UIUtilE::Assign(this, m_progTitle, "title_text", &err);
    UIUtilE::Assign(this, m_progSubtitle, "subtitle_text", &err);
    UIUtilE::Assign(this, m_progStartTime, "starttime_text", &err);

    if (err)
    {
        LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'archivefile_selector'");
        return false;
    }

    if (m_titleText)
        m_titleText->SetText(tr("Find File To Import"));

    connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(nextPressed()));
    connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(cancelPressed()));
    connect(m_prevButton, SIGNAL(Clicked()), this, SLOT(prevPressed()));

    connect(m_locationEdit, SIGNAL(LosingFocus()),
            this, SLOT(locationEditLostFocus()));
    m_locationEdit->SetText(m_curDirectory);

    connect(m_backButton, SIGNAL(Clicked()), this, SLOT(backPressed()));
    connect(m_homeButton, SIGNAL(Clicked()), this, SLOT(homePressed()));

    connect(m_fileButtonList, SIGNAL(itemSelected(MythUIButtonListItem *)),
            this, SLOT(itemSelected(MythUIButtonListItem *)));

    connect(m_fileButtonList, SIGNAL(itemClicked(MythUIButtonListItem *)),
            this, SLOT(itemClicked(MythUIButtonListItem *)));

    BuildFocusList();

    SetFocusWidget(m_fileButtonList);

    updateSelectedList();
    updateFileList();

    return true;
}
Example #2
0
bool ImportCoverArtDialog::Create()
{
    if (!LoadWindowFromXML("music-ui.xml", "import_coverart", this))
        return false;

    bool err = false;
    UIUtilE::Assign(this, m_filenameText,    "file", &err);
    UIUtilE::Assign(this, m_currentText,     "position", &err);
    UIUtilE::Assign(this, m_statusText,      "status", &err);
    UIUtilE::Assign(this, m_destinationText, "destination", &err);
    UIUtilE::Assign(this, m_coverartImage,   "coverart", &err);
    UIUtilE::Assign(this, m_copyButton,      "copy", &err);
    UIUtilE::Assign(this, m_exitButton,      "exit", &err);
    UIUtilE::Assign(this, m_prevButton,      "prev", &err);
    UIUtilE::Assign(this, m_nextButton,      "next", &err);
    UIUtilE::Assign(this, m_typeList,        "type", &err);

    if (err)
    {
        LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'import_coverart'");
        return false;
    }

    if (m_typeList)
    {
        new MythUIButtonListItem(m_typeList, tr("Front Cover"),
                                 qVariantFromValue(0));
        new MythUIButtonListItem(m_typeList, tr("Back Cover"),
                                 qVariantFromValue(1));
        new MythUIButtonListItem(m_typeList, tr("CD"),
                                 qVariantFromValue(2));
        new MythUIButtonListItem(m_typeList, tr("Inlay"),
                                 qVariantFromValue(3));
        new MythUIButtonListItem(m_typeList, tr("<Unknown>"),
                                 qVariantFromValue(4));

        connect(m_typeList, SIGNAL(itemSelected(MythUIButtonListItem *)),
                SLOT(selectorChanged()));
    }

    if (m_copyButton)
        connect(m_copyButton, SIGNAL(Clicked()), this, SLOT(copyPressed()));

    if (m_exitButton)
        connect(m_exitButton, SIGNAL(Clicked()), this, SLOT(Close()));

    if (m_prevButton)
        connect(m_prevButton, SIGNAL(Clicked()), this, SLOT(prevPressed()));

    if (m_nextButton)
        connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(nextPressed()));

    BuildFocusList();

    scanDirectory();

    return true;
}
Example #3
0
bool ImportMusicDialog::Create()
{
    if (!LoadWindowFromXML("music-ui.xml", "import_music", this))
        return false;

    bool err = false;
    UIUtilE::Assign(this, m_locationEdit,    "location", &err);
    UIUtilE::Assign(this, m_locationButton,  "directoryfinder", &err);
    UIUtilE::Assign(this, m_scanButton,      "scan", &err);
    UIUtilE::Assign(this, m_coverartButton,  "coverart", &err);
    UIUtilE::Assign(this, m_filenameText,    "filename", &err);
    UIUtilE::Assign(this, m_compartistText,  "compartist", &err);
    UIUtilE::Assign(this, m_artistText,      "artist", &err);
    UIUtilE::Assign(this, m_albumText,       "album", &err);
    UIUtilE::Assign(this, m_titleText,       "title", &err);
    UIUtilE::Assign(this, m_genreText,       "genre", &err);
    UIUtilE::Assign(this, m_yearText,        "year", &err);
    UIUtilE::Assign(this, m_trackText,       "track", &err);
    UIUtilE::Assign(this, m_currentText,     "position", &err);
    UIUtilE::Assign(this, m_statusText,      "status", &err);
    UIUtilE::Assign(this, m_compilationCheck,"compilation", &err);
    UIUtilE::Assign(this, m_playButton,      "play", &err);
    UIUtilE::Assign(this, m_nextnewButton,   "nextnew", &err);
    UIUtilE::Assign(this, m_addButton,       "add", &err);
    UIUtilE::Assign(this, m_addallnewButton, "addallnew", &err);
    UIUtilE::Assign(this, m_nextButton,      "next", &err);
    UIUtilE::Assign(this, m_prevButton,      "prev", &err);

    if (err)
    {
        LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'import_music'");
        return false;
    }

    connect(m_prevButton, SIGNAL(Clicked()), SLOT(prevPressed()));
    connect(m_locationButton, SIGNAL(Clicked()), SLOT(locationPressed()));
    connect(m_scanButton, SIGNAL(Clicked()), SLOT(startScan()));
    connect(m_coverartButton, SIGNAL(Clicked()), SLOT(coverArtPressed()));
    connect(m_playButton, SIGNAL(Clicked()), SLOT(playPressed()));
    connect(m_nextnewButton, SIGNAL(Clicked()), SLOT(nextNewPressed()));
    connect(m_addButton, SIGNAL(Clicked()), SLOT(addPressed()));
    connect(m_addallnewButton, SIGNAL(Clicked()), SLOT(addAllNewPressed()));
    connect(m_nextButton, SIGNAL(Clicked()), SLOT(nextPressed()));

    fillWidgets();

    BuildFocusList();

    m_locationEdit->SetText(gCoreContext->GetSetting("MythMusicLastImportDir", "/"));

    return true;
}
Example #4
0
void PlayerWidget::mousePressEvent(QMouseEvent *e) {
	QPoint pos(myrtlpoint(e->pos()));

	if (e->button() == Qt::LeftButton) {
		_down = OverNone;
		if (_song && _over == OverPlay) {
			playPausePressed();
			return;
		} else if (_over == OverPrev) {
			prevPressed();
		} else if (_over == OverNext) {
			nextPressed();
		} else if (_over == OverClose) {
			_down = OverClose;
		} else if (_over == OverVolume) {
			_down = OverVolume;
			_downCoord = pos.x() - _volumeRect.x();
			cSetSongVolume(snap((_downCoord - ((_volumeRect.width() - st::playerVolume.pxWidth()) / 2)) / float64(st::playerVolume.pxWidth()), 0., 1.));
			emit audioPlayer()->songVolumeChanged();
			rtlupdate(_volumeRect);
		} else if (_over == OverPlayback) {
			SongMsgId playing;
			AudioPlayerState playingState = AudioPlayerStopped;
			int64 playingPosition = 0, playingDuration = 0;
			int32 playingFrequency = 0;
			audioPlayer()->currentState(&playing, &playingState, &playingPosition, &playingDuration, &playingFrequency);
			if (playing == _song && playingDuration) {
				if (playingState == AudioPlayerPlaying || playingState == AudioPlayerStarting || playingState == AudioPlayerResuming) {
					audioPlayer()->pauseresume(OverviewDocuments);
				}
				_down = OverPlayback;
				_downProgress = snap((pos.x() - _playbackRect.x()) / float64(_playbackRect.width()), 0., 1.);
				_downDuration = playingDuration;
				_downFrequency = (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency);

				rtlupdate(_playbackRect);
				updateDownTime();
			}
		} else if (_over == OverFull && _song) {
			if (HistoryItem *item = App::histItemById(_song.msgId)) {
				App::main()->showMediaOverview(item->history()->peer, OverviewAudioDocuments);
			}
		} else if (_over == OverRepeat) {
			_repeat = !_repeat;
			updateOverRect(OverRepeat);
		}
	}
}
Example #5
0
bool ImportNative::Create(void)
{
    bool foundtheme = false;

    // Load the theme for this screen
    foundtheme = LoadWindowFromXML("mythnative-ui.xml", "importnative", this);

    if (!foundtheme)
        return false;

    bool err = false;
    UIUtilE::Assign(this, m_progTitle_text, "progtitle", &err);
    UIUtilE::Assign(this, m_progDateTime_text, "progdatetime", &err);
    UIUtilE::Assign(this, m_progDescription_text, "progdescription", &err);

    UIUtilE::Assign(this, m_chanID_text, "chanid", &err);
    UIUtilE::Assign(this, m_chanNo_text, "channo", &err);
    UIUtilE::Assign(this, m_chanName_text, "name", &err);
    UIUtilE::Assign(this, m_callsign_text, "callsign", &err);

    UIUtilE::Assign(this, m_localChanID_text, "local_chanid", &err);
    UIUtilE::Assign(this, m_localChanNo_text, "local_channo", &err);
    UIUtilE::Assign(this, m_localChanName_text, "local_name", &err);
    UIUtilE::Assign(this, m_localCallsign_text, "local_callsign", &err);

    UIUtilE::Assign(this, m_searchChanID_button, "searchchanid_button", &err);
    UIUtilE::Assign(this, m_searchChanNo_button, "searchchanno_button", &err);
    UIUtilE::Assign(this, m_searchChanName_button, "searchname_button", &err);
    UIUtilE::Assign(this, m_searchCallsign_button ,"searchcallsign_button", &err);

    UIUtilE::Assign(this, m_finishButton, "finish_button", &err);
    UIUtilE::Assign(this, m_prevButton, "prev_button", &err);
    UIUtilE::Assign(this, m_cancelButton, "cancel_button", &err);

    if (err)
    {
        LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'importarchive'");
        return false;
    }

    connect(m_finishButton, SIGNAL(Clicked()), this, SLOT(finishedPressed()));
    connect(m_prevButton, SIGNAL(Clicked()), this, SLOT(prevPressed()));
    connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(cancelPressed()));

    connect(m_searchChanID_button, SIGNAL(Clicked()), this, SLOT(searchChanID()));
    connect(m_searchChanNo_button, SIGNAL(Clicked()), this, SLOT(searchChanNo()));
    connect(m_searchChanName_button, SIGNAL(Clicked()), this, SLOT(searchName()));
    connect(m_searchCallsign_button, SIGNAL(Clicked()), this, SLOT(searchCallsign()));

    m_progTitle_text->SetText(m_details.title);

    m_progDateTime_text->SetText(m_details.startTime.toLocalTime()
                                 .toString("dd MMM yy (hh:mm)"));
    m_progDescription_text->SetText(
        (m_details.subtitle == "" ? m_details.subtitle + "\n" : "") + m_details.description);

    m_chanID_text->SetText(m_details.chanID);
    m_chanNo_text->SetText(m_details.chanNo);
    m_chanName_text->SetText(m_details.chanName);
    m_callsign_text->SetText(m_details.callsign);

    findChannelMatch(m_details.chanID, m_details.chanNo,
                     m_details.chanName, m_details.callsign);

    BuildFocusList();

    SetFocusWidget(m_finishButton);

    return true;
}
Example #6
0
ConversionDlg::ConversionDlg ( QWidget*parent )
    : QWidget(parent)
{
  inValueChanged = false;
  

  QVBoxLayout *vbox = new QVBoxLayout(this);
  grid* g = new grid(3,this);

  g->setContentsMargins(3,3,3,3);

  vbox->addWidget(g);

  new QWidget(g);
  new QLabel(" Hex:",g);
  leditors[HexLE] = new QLineEdit(g);

  new QWidget(g);
  new QLabel(" ASCII:",g);
  leditors[AsciiLE] = new QLineEdit(g);

  byteSwapFlag[IntegerBS] = new QCheckBox("b/s",g);
  new QLabel(" Int:",g);
  leditors[IntegerLE] = new QLineEdit(g);

  byteSwapFlag[FloatBS] = new QCheckBox("b/s",g);
  new QLabel(" Float:",g);
  leditors[FloatLE]  = new QLineEdit(g);

  byteSwapFlag[DoubleBS] = new QCheckBox("b/s",g);
  new QLabel(" Double:",g);
  leditors[DoubleLE] = new QLineEdit(g);

  // make sure to do an update if any of the byte swap flags toggle
  for(int i = MinBS; i < MaxBS; ++i) {
    connect(byteSwapFlag[i],SIGNAL(clicked()),
				   this,SLOT(valueChanged()));
    // add tool tip
    byteSwapFlag[i]->setToolTip("Byte Swap Data");
  }

  // setup validators
  leditors[DoubleLE]->setValidator( new QDoubleValidator(this) );
  QDoubleValidator *vd = new QDoubleValidator(this);
  vd->setRange( FLT_MAX, FLT_MAX );
  leditors[FloatLE]->setValidator( vd );
  leditors[IntegerLE]->setValidator( new QIntValidator(this) );
  leditors[HexLE]->setValidator( new HexValidator(this) );

  // setup editor connections
  connect(leditors[DoubleLE],SIGNAL(textChanged(const QString& )),
	  this,SLOT(doubleChanged(const QString&)) );
  connect(leditors[FloatLE],SIGNAL(textChanged(const QString& )),
	  this,SLOT(floatChanged(const QString&)) );
  connect(leditors[IntegerLE],SIGNAL(textChanged(const QString&)),
  	  this,SLOT(integerChanged(const QString&)) );
  connect(leditors[HexLE],SIGNAL(textChanged(const QString&)),
	  this,SLOT(valueChanged(const QString&)));
  connect(leditors[AsciiLE],SIGNAL(textChanged(const QString&)),
	  this,SLOT(asciiChanged(const QString&)));
  
  for( int i = MinLE; i < MaxLE; ++i ) {
      connect(leditors[i],SIGNAL(returnPressed()),
	      this,SIGNAL(nextPressed()));
  }
  
  hbox * h = new hbox(this);
  vbox->addWidget(h);
  vbox->addStretch(1);
  QPushButton* prev = new QPushButton("<",h);
  QPushButton* next = new QPushButton(">",h);

  connect(prev,SIGNAL(clicked()),this,SIGNAL(prevPressed()));
  connect(next,SIGNAL(clicked()),this,SIGNAL(nextPressed()));
  
  setWindowTitle("Conversion Dialog");
}