Пример #1
0
PlayerWidget::PlayerWidget(QWidget *parent) : QWidget(parent), ui(new Ui::PlayerWidget()){
  ui->setupUi(this); //load the designer form
  PLAYER = new QMediaPlayer(this);
    PLAYER->setVolume(100);
    PLAYER->setNotifyInterval(1000); //1 second interval (just needs to be a rough estimate)
  PLAYLIST = new QMediaPlaylist(this);
    PLAYLIST->setPlaybackMode(QMediaPlaylist::Sequential);
    PLAYER->setPlaylist(PLAYLIST);
	
  configMenu = new QMenu(this);
    ui->tool_config->setMenu(configMenu);
  addMenu = new QMenu(this);
    ui->tool_add->setMenu(addMenu);
	
  updatinglists = false; //start off as false
	
  LoadIcons();
  playerStateChanged(); //update button visibility
  currentSongChanged();
  //Connect all the signals/slots
  //connect(infoTimer, SIGNAL(timeout()), this, SLOT(rotateTrackInfo()) );
  connect(PLAYER, SIGNAL(positionChanged(qint64)),this, SLOT(updateProgress(qint64)) );
  connect(PLAYER, SIGNAL(durationChanged(qint64)), this, SLOT(updateMaxProgress(qint64)) );
  connect(PLAYLIST, SIGNAL(mediaChanged(int, int)), this, SLOT(playlistChanged()) );
  connect(PLAYER, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(playerStateChanged()) );
  connect(PLAYLIST, SIGNAL(currentMediaChanged(const QMediaContent&)), this, SLOT(currentSongChanged()) );
  connect(ui->combo_playlist, SIGNAL(currentIndexChanged(int)), this, SLOT(userlistSelectionChanged()) );
  connect(ui->tool_play, SIGNAL(clicked()), this, SLOT(playClicked()) );
  connect(ui->tool_pause, SIGNAL(clicked()), this, SLOT(pauseClicked()) );
  connect(ui->tool_stop, SIGNAL(clicked()), this, SLOT(stopClicked()) );
  connect(ui->tool_next, SIGNAL(clicked()), this, SLOT(nextClicked()) );
  connect(ui->tool_prev, SIGNAL(clicked()), this, SLOT(prevClicked()) );
  
}
Пример #2
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    findVisible = false;
    ownFile     = false;
    ownChanges  = false;
    man = new manViever;
    findTool = new findDialog;
    findTool->setVisible(findVisible);
    ui->statusBar->setVisible(findVisible);

   /* ui->actionComment->setEnabled(false);
    ui->actionUncomment->setEnabled(false);
    ui->actionIndent->setEnabled(false);
    ui->actionUnindent->setEnabled(false);*/
    //ui->actionPaste->setEnabled(false);
    ui->statusBar->addWidget(findTool);
    ui->dockWidget->setWidget(man);

    fileName = "";
    filter = "All files (*.*);; Hybris Source (*.hs)";

    ui->editor_tab->removeTab(0);
    ui->editor_tab->removeTab(0);
    //lineNumber *edit = new lineNumber();
    //ui->editor_tab->addTab(edit, "Docuement");

    connect(ui->actionQuit,SIGNAL(triggered()),this,SLOT(close()));
    connect(findTool,SIGNAL(nextClicked()),this,SLOT(findNext()));
    connect(findTool,SIGNAL(prevClicked()),this,SLOT(findPrev()));
    connect(ui->editor_tab, SIGNAL(currentChanged(int)), this, SLOT(currentTab(int)));
    connect(ui->editor_tab, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
}
Пример #3
0
NoteView::NoteView(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::NoteView)
{
    //initialize controller
    ui->setupUi(this);
    this->_controller = new NoteController();

    //prepare green button
    QFile data(":/new/prefix1/greenButton.qss");
    data.open(QFile::ReadOnly);
    QTextStream styleIn(&data);
    this->_greenButton = styleIn.readAll();
    data.close();

    //fix screen size
    this->setFixedSize(this->width(), this->height());

    //setup error fields
    ui->addError->setStyleSheet("QLabel {color:red};");
    ui->bodyError->setStyleSheet("QLabel {color:red};");
    clear();

    //connect signals and slots
    connect(ui->doneButton, SIGNAL(clicked()), this, SLOT(doneClicked()));
    connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextClicked()));
    connect(ui->prevButton, SIGNAL(clicked()), this, SLOT(prevClicked()));
    connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked()));
    connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addClicked()));
    connect(ui->editButton,SIGNAL(clicked()),this,SLOT(editClicked()));
}
Пример #4
0
QgsTipGui::QgsTipGui( QWidget *parent )
    : QDialog( parent, Qt::WindowSystemMenuHint )  // Dialog with close button only
#else
QgsTipGui::QgsTipGui( QWidget *parent )
    : QDialog( parent )  // Normal dialog in non Mac-OS
#endif
{
  setupUi( this );
  init();
}

QgsTipGui::~QgsTipGui()
{
}

void QgsTipGui::init()
{

  QgsTipFactory myFactory;
  QgsTip myTip = myFactory.getTip();
  mTipPosition = myFactory.position( myTip );

  showTip( myTip );

  QPushButton *pb;
  pb = new QPushButton( tr( "&Previous" ) );
  connect( pb, SIGNAL( clicked() ), this, SLOT( prevClicked() ) );
  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );

  pb = new QPushButton( tr( "&Next" ) );
  connect( pb, SIGNAL( clicked() ), this, SLOT( nextClicked() ) );
  buttonBox->addButton( pb, QDialogButtonBox::ActionRole );
}
Пример #5
0
Scene::Scene(const QString &title, QWidget *parent) :
    QWidget(parent), _ui(new Ui::Scene)
{
    _ui->setupUi(this);
    _ui->label->setText(title);
    connect(_ui->prevButton, SIGNAL(clicked()), this, SIGNAL(prevClicked()));
    connect(_ui->nextButton, SIGNAL(clicked()), this, SIGNAL(nextClicked()));

    std::cout << "Allocated " <<
                 title.toLocal8Bit().constData() <<
                 std::endl;
}
Пример #6
0
void Mpdf::initTop2()
{
    pageLabel = new QLabel;
    pageLabel->setText("Pages");

    prevButton = new QPushButton;
    prevButton->setText("prev");
    prevButton->setMinimumWidth(30);
    prevButton->setFlat(true);

    top2Layout = new QHBoxLayout;
    top2Layout->addWidget(pageLabel);
    top2Layout->addWidget(prevButton);

    numberButtonVec = new QVector<QPushButton *>;
    signalMapper = new QSignalMapper(this);

    for (int i = 0; i < 9; i++)
    {
        QPushButton *numberButton = new QPushButton;
        numberButton->setText(QString::number(i + 1));
        numberButton->setMinimumWidth(15);
        numberButton->setFlat(true);
        numberButtonVec->push_back(numberButton);
        top2Layout->addWidget(numberButton);

        signalMapper->setMapping(numberButton, i);
        connect(numberButton, SIGNAL(clicked()),
            signalMapper, SLOT(map()));
    }
    
    nextButton = new QPushButton;
    nextButton->setText("next");
    nextButton->setMinimumWidth(30);
    nextButton->setFlat(true);
    top2Layout->addWidget(nextButton);

    searchButton = new QPushButton;
    searchButton->setText("Search");
    top2Layout->addWidget(searchButton);

    connect(prevButton, SIGNAL(clicked()),
            this, SLOT(prevClicked()));
    connect(signalMapper, SIGNAL(mapped(int)),
            this, SLOT(numberClicked(int)));
    connect(nextButton, SIGNAL(clicked()),
            this, SLOT(nextClicked()));
    connect(searchButton, SIGNAL(clicked()),
            this, SLOT(searchClicked()));
}
Пример #7
0
void FadingNavigationWidget::initFrame()
{
    mFrame = new Plasma::Frame(parent);
    mFrame->setZValue(10);
    QGraphicsLinearLayout* l = new QGraphicsLinearLayout();
    mPrevButton = new Plasma::PushButton(mFrame);
    mPrevButton->nativeWidget()->setIcon(QIcon::fromTheme("arrow-left"));
    mPrevButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    mPrevButton->setMaximumSize(IconSize(KIconLoader::MainToolbar), IconSize(KIconLoader::MainToolbar));
    connect(mPrevButton, SIGNAL(clicked()), this , SIGNAL(prevClicked()));
    l->addItem(mPrevButton);
    mNextButton = new Plasma::PushButton(mFrame);
    mNextButton->nativeWidget()->setIcon(QIcon::fromTheme("arrow-right"));
    mNextButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    mNextButton->setMaximumSize(IconSize(KIconLoader::MainToolbar), IconSize(KIconLoader::MainToolbar));
    connect(mNextButton, SIGNAL(clicked()), this , SIGNAL(nextClicked()));
    l->addItem(mNextButton);
    mFrame->setLayout(l);
    mFrame->setFrameShadow(Plasma::Frame::Raised);
    l->activate(); // makes sure the size is correct
    mFrame->hide();
    mFadingItem = new FadingItem(mFrame);
    mFadingItem->hide();
}
Пример #8
0
DiaryWindow::DiaryWindow(MainWindow *mainWindow) :
    GcWindow(mainWindow), mainWindow(mainWindow), active(false)
{
    setInstanceName("Diary Window");
    setControls(NULL);

    // get config
    fieldDefinitions = mainWindow->rideMetadata()->getFields();

    QVBoxLayout *vlayout = new QVBoxLayout(this);

    // controls
    QHBoxLayout *controls = new QHBoxLayout;
    QFont bold;
    bold.setPointSize(14);
    bold.setWeight(QFont::Bold);
    title = new QLabel("", this);
    title->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
    title->setFont(bold);

    QIcon prevIcon(":images/toolbar/back_alt.png");
    QIcon nextIcon(":images/toolbar/forward_alt.png");
    next = new QPushButton(nextIcon, "", this);
    prev = new QPushButton(prevIcon, "", this);
#ifdef Q_OS_MAC
    next->setFlat(true);
    prev->setFlat(true);
#endif

#if 0
    // viewMode - monthly or weekly
    viewMode = new QComboBox;
    viewMode->addItem("View Month");
    viewMode->addItem("View Week"); // we can add more later...
    viewMode->addItem("View Ride"); // we can add more later...
    viewMode->setFixedWidth(120);

    viewMode->setCurrentIndex(appsettings->cvalue(mainWindow->cyclist, GC_DIARY_VIEW, "1").toInt());
#endif

    controls->addWidget(prev);
    controls->addWidget(next);
    controls->addStretch();
    controls->addWidget(title, Qt::AlignCenter | Qt::AlignVCenter);
    controls->addStretch();
#if 0
    controls->addWidget(viewMode);
#endif

    vlayout->addLayout(controls);

    // monthly view via QCalendarWidget
    calendarModel = new GcCalendarModel(this, &fieldDefinitions, mainWindow);
    calendarModel->setSourceModel(mainWindow->listView->sqlModel);

    monthlyView = new QTableView(this);
    monthlyView->setItemDelegate(new GcCalendarDelegate);
    monthlyView->setModel(calendarModel);
    monthlyView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
    monthlyView->verticalHeader()->setResizeMode(QHeaderView::Stretch);
    monthlyView->verticalHeader()->hide();
    monthlyView->viewport()->installEventFilter(this);
    monthlyView->setGridStyle(Qt::DotLine);
    monthlyView->setFrameStyle(QFrame::NoFrame);

    // weekly view via QxtScheduleView
    weeklyView = new QxtScheduleView;
    weeklyViewProxy = new QxtScheduleViewProxy(this, &fieldDefinitions, mainWindow);
    weeklyViewProxy->setSourceModel(mainWindow->listView->sqlModel);
    weeklyView->setCurrentZoomDepth (30, Qxt::Minute);
    weeklyView->setDateRange(QDate(2010,9,2), QDate(2010,9,8));
    weeklyView->setModel(weeklyViewProxy);

    RideSummaryWindow *rideSummary = new RideSummaryWindow(mainWindow);
    allViews = new QStackedWidget(this);
    allViews->addWidget(monthlyView);
    allViews->addWidget(weeklyView);
    allViews->addWidget(rideSummary);
    //allViews->setCurrentIndex(viewMode->currentIndex());
    allViews->setCurrentIndex(0);

    vlayout->addWidget(allViews);

    //connect(viewMode, SIGNAL(currentIndexChanged(int)), allViews, SLOT(setCurrentIndex(int)));
    //connect(viewMode, SIGNAL(currentIndexChanged(int)), this, SLOT(setDefaultView(int)));
    //connect(viewMode, SIGNAL(currentIndexChanged(int)), this, SLOT(rideSelected()));
    connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
    //connect(mainWindow, SIGNAL(rideSelected()), this, SLOT(rideSelected()));
    connect(mainWindow, SIGNAL(configChanged()), this, SLOT(configChanged()));
    connect(weeklyView, SIGNAL(indexSelected(QModelIndex)), this, SLOT(weeklySelected(QModelIndex)));
    connect(next, SIGNAL(clicked()), this, SLOT(nextClicked()));
    connect(prev, SIGNAL(clicked()), this, SLOT(prevClicked()));
}
Пример #9
0
DiaryWindow::DiaryWindow(Context *context) :
    GcWindow(context), context(context), active(false)
{
    setInstanceName("Diary Window");
    setControls(NULL);

    // get config
    fieldDefinitions = context->athlete->rideMetadata()->getFields();

    QVBoxLayout *vlayout = new QVBoxLayout(this);

    // controls
    QHBoxLayout *controls = new QHBoxLayout;
    QFont bold;
    bold.setPointSize(14);
    bold.setWeight(QFont::Bold);
    title = new QLabel("", this);
    title->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
    title->setFont(bold);

    QIcon prevIcon(":images/toolbar/back_alt.png");
    QIcon nextIcon(":images/toolbar/forward_alt.png");
    next = new QPushButton(nextIcon, "", this);
    prev = new QPushButton(prevIcon, "", this);
#ifdef Q_OS_MAC
    next->setFlat(true);
    prev->setFlat(true);
#endif

    controls->addWidget(prev);
    controls->addWidget(next);
    controls->addStretch();
    controls->addWidget(title, Qt::AlignCenter | Qt::AlignVCenter);
    controls->addStretch();

    vlayout->addLayout(controls);

    // monthly view via QCalendarWidget
    calendarModel = new GcCalendarModel(this, &fieldDefinitions, context);
    calendarModel->setSourceModel(context->athlete->sqlModel);

    monthlyView = new QTableView(this);
    monthlyView->setItemDelegate(new GcCalendarDelegate);
    monthlyView->setModel(calendarModel);
    monthlyView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
    monthlyView->verticalHeader()->setResizeMode(QHeaderView::Stretch);
    monthlyView->verticalHeader()->hide();
    monthlyView->viewport()->installEventFilter(this);
    monthlyView->setGridStyle(Qt::DotLine);
    monthlyView->setFrameStyle(QFrame::NoFrame);

    allViews = new QStackedWidget(this);
    allViews->addWidget(monthlyView);
    allViews->setCurrentIndex(0);

    vlayout->addWidget(allViews);

    connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
    connect(context, SIGNAL(filterChanged()), this, SLOT(rideSelected()));
    connect(context, SIGNAL(configChanged()), this, SLOT(configChanged()));
    connect(next, SIGNAL(clicked()), this, SLOT(nextClicked()));
    connect(prev, SIGNAL(clicked()), this, SLOT(prevClicked()));
}