TimeControls::TimeControls( QWidget* parent ) : QToolBar( parent ) { QSettings settings( PENCIL2D, PENCIL2D ); mFpsBox = new QSpinBox(); mFpsBox->setFont( QFont("Helvetica", 10) ); mFpsBox->setFixedHeight(22); mFpsBox->setValue(settings.value("fps").toInt()); mFpsBox->setMinimum(1); mFpsBox->setMaximum(50); mFpsBox->setToolTip("Frames per second"); mFpsBox->setFocusPolicy(Qt::NoFocus); mLoopStartSpinBox = new QSpinBox(); mLoopStartSpinBox->setFont( QFont("Helvetica", 10) ); mLoopStartSpinBox->setFixedHeight(22); mLoopStartSpinBox->setValue(settings.value("loopStart").toInt()); mLoopStartSpinBox->setMinimum(1); mLoopStartSpinBox->setToolTip(tr("Start of loop")); mLoopStartSpinBox->setFocusPolicy(Qt::NoFocus); mLoopEndSpinBox= new QSpinBox(); mLoopEndSpinBox->setFont( QFont("Helvetica", 10) ); mLoopEndSpinBox->setFixedHeight(22); mLoopEndSpinBox->setMinimum(2); mLoopEndSpinBox->setToolTip(tr("End of loop")); mLoopEndSpinBox->setFocusPolicy(Qt::NoFocus); mLoopEndSpinBox->setValue( settings.value( "loopEnd" ).toInt() ); mPlaybackRangeCheckBox = new QCheckBox( tr("Range") ); mPlaybackRangeCheckBox->setFont( QFont("Helvetica", 10) ); mPlaybackRangeCheckBox->setFixedHeight(26); mPlaybackRangeCheckBox->setToolTip(tr("Loop control")); mPlayButton = new QPushButton( this ); mLoopButton = new QPushButton(); mSoundButton = new QPushButton(); mJumpToEndButton= new QPushButton(); mJumpToStartButton= new QPushButton(); QLabel* separator = new QLabel(); separator->setPixmap(QPixmap(":icons/controls/separator.png")); separator->setFixedSize(QSize(37,31)); QLabel* spacingLabel = new QLabel(""); spacingLabel->setIndent(6); QLabel* fpsLabel = new QLabel(tr("Fps: ")); fpsLabel->setIndent(6); QIcon playIcon(":icons/controls/play.png"); QIcon loopIcon(":icons/controls/loop.png"); QIcon soundIcon(":icons/controls/sound.png"); QIcon endplayIcon(":icons/controls/endplay.png"); QIcon startplayIcon(":icons/controls/startplay.png"); mPlayButton->setIcon(playIcon); mLoopButton->setIcon(loopIcon); mSoundButton->setIcon(soundIcon); mJumpToEndButton->setIcon(endplayIcon); mJumpToStartButton->setIcon(startplayIcon); mPlayButton->setToolTip(tr("Play")); mLoopButton->setToolTip(tr("Loop")); mSoundButton->setToolTip(tr("Sound on/off")); mJumpToEndButton->setToolTip(tr("End")); mJumpToStartButton->setToolTip(tr("Start")); mLoopButton->setCheckable(true); mSoundButton->setCheckable(true); mSoundButton->setChecked(true); addWidget(separator); addWidget(mJumpToStartButton); addWidget(mPlayButton); addWidget(mJumpToEndButton); addWidget(mLoopButton); addWidget(mPlaybackRangeCheckBox); addWidget(mLoopStartSpinBox); addWidget(mLoopEndSpinBox); addWidget(mSoundButton); addWidget(fpsLabel); addWidget(mFpsBox); makeConnections(); auto spinBoxValueChanged = static_cast< void ( QSpinBox::* )( int ) >( &QSpinBox::valueChanged ); connect( mLoopStartSpinBox, spinBoxValueChanged, this, &TimeControls::loopStartClick ); connect( mLoopEndSpinBox, spinBoxValueChanged, this, &TimeControls::loopEndClick ); connect( mPlaybackRangeCheckBox, &QCheckBox::toggled, mLoopStartSpinBox, &QSpinBox::setEnabled ); connect( mPlaybackRangeCheckBox, &QCheckBox::toggled, mLoopEndSpinBox, &QSpinBox::setEnabled ); connect( mSoundButton, &QPushButton::clicked, this, &TimeControls::soundClick ); connect( mFpsBox, spinBoxValueChanged, this, &TimeControls::fpsClick ); }
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware): ModelPanel(parent, model, generalSettings, firmware), initialized(false) #if defined(PHONON) , phononCurrent(-1), clickObject(NULL), clickOutput(NULL) #endif { QGridLayout * gridLayout = new QGridLayout(this); addLabel(gridLayout, tr("Switch"), 1); addLabel(gridLayout, tr("Action"), 2); addLabel(gridLayout, tr("Parameters"), 3); addLabel(gridLayout, tr("Enable"), 4, true ); addEmptyLabel(gridLayout, 5 ); lock = true; int num_fsw = firmware->getCapability(CustomFunctions); if (!firmware->getCapability(VoicesAsNumbers)) { tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength)); for (int i=0; i<num_fsw; i++) { if (model.funcSw[i].func==FuncPlayPrompt || model.funcSw[i].func==FuncBackgroundMusic) { QString temp = model.funcSw[i].paramarm; if (!temp.isEmpty()) { tracksSet.insert(temp); } } } qDebug() << tracksSet; } if (IS_TARANIS(firmware->getBoard())) { scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength)); for (int i=0; i<num_fsw; i++) { if (model.funcSw[i].func==FuncPlayScript) { QString temp = model.funcSw[i].paramarm; if (!temp.isEmpty()) { scriptsSet.insert(temp); } } } qDebug() << scriptsSet; } CompanionIcon playIcon("play.png"); for (int i=0; i<num_fsw; i++) { // The label QLabel * label = new QLabel(this); label->setContextMenuPolicy(Qt::CustomContextMenu); label->setMouseTracking(true); label->setProperty("index", i); label->setText(tr("SF%1").arg(i+1)); label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint))); gridLayout->addWidget(label, i+1, 0); // The switch fswtchSwtch[i] = new QComboBox(this); fswtchSwtch[i]->setProperty("index", i); fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); gridLayout->addWidget(fswtchSwtch[i], i+1, 1); // The function fswtchFunc[i] = new QComboBox(this); fswtchFunc[i]->setProperty("index", i); connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited())); gridLayout->addWidget(fswtchFunc[i], i+1, 2); QHBoxLayout *paramLayout = new QHBoxLayout(); gridLayout->addLayout(paramLayout, i+1, 3); fswtchGVmode[i] = new QComboBox(this); fswtchGVmode[i]->setProperty("index", i); connect(fswtchGVmode[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchGVmode[i]); fswtchParamGV[i] = new QCheckBox(this); fswtchParamGV[i]->setProperty("index", i); fswtchParamGV[i]->setText("GV"); fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); connect(fswtchParamGV[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchParamGV[i]); fswtchParam[i] = new QDoubleSpinBox(this); fswtchParam[i]->setProperty("index", i); fswtchParam[i]->setAccelerated(true); fswtchParam[i]->setDecimals(0); connect(fswtchParam[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchParam[i]); fswtchParamTime[i] = new QTimeEdit(this); fswtchParamTime[i]->setProperty("index", i); fswtchParamTime[i]->setAccelerated(true); fswtchParamTime[i]->setDisplayFormat("hh:mm:ss"); connect(fswtchParamTime[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchParamTime[i]); fswtchParamT[i] = new QComboBox(this); fswtchParamT[i]->setProperty("index", i); paramLayout->addWidget(fswtchParamT[i]); connect(fswtchParamT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); fswtchParamArmT[i] = new QComboBox(this); fswtchParamArmT[i]->setProperty("index", i); fswtchParamArmT[i]->setEditable(true); paramLayout->addWidget(fswtchParamArmT[i]); connect(fswtchParamArmT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited())); fswtchBLcolor[i] = new QSlider(this); fswtchBLcolor[i]->setProperty("index", i); fswtchBLcolor[i]->setMinimum(0); fswtchBLcolor[i]->setMaximum(100); fswtchBLcolor[i]->setSingleStep(1); fswtchBLcolor[i]->setOrientation(Qt::Horizontal); paramLayout->addWidget(fswtchBLcolor[i]); connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited())); #ifdef PHONON playBT[i] = new QPushButton(this); playBT[i]->setProperty("index", i); playBT[i]->setIcon(playIcon); paramLayout->addWidget(playBT[i]); connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic())); #endif QHBoxLayout *repeatLayout = new QHBoxLayout(); gridLayout->addLayout(repeatLayout, i+1, 4); fswtchRepeat[i] = new RepeatComboBox(this, model.funcSw[i].repeatParam); repeatLayout->addWidget(fswtchRepeat[i], i+1); connect(fswtchRepeat[i], SIGNAL(modified()), this, SLOT(onChildModified())); fswtchEnable[i] = new QCheckBox(this); fswtchEnable[i]->setProperty("index", i); fswtchEnable[i]->setText(tr("ON")); fswtchEnable[i]->setFixedWidth( 80 ); repeatLayout->addWidget(fswtchEnable[i], i+1); connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited())); } // Push rows upward addDoubleSpring(gridLayout, 5, num_fsw+1); disableMouseScrolling(); lock = false; }
void VideoPlayerTool::initPlayer() { fprintf(stderr, "[VideoPlayerT] %s:%d : initializing video codecs... FFMPEG version '" LIBAVCODEC_IDENT "'\n", __func__, __LINE__); m_fileVA = NULL; m_editBookmarksForm = NULL; playTimer = NULL; playSpeed = 1.f; playContinuous = false; QFileInfo fi(VideoFile); pWin->setCaption(tr("Movie:") + fi.fileName()); // buttons chdir(":/images/pixmaps"); playerVBox = new Q3VBox(pWin); playerVBox->resize(320, 266); playHBox = new Q3HBox(playerVBox); playHBox->setSpacing(1); rewindMovie = new QPushButton( playHBox); { QPixmap pixIcon; if(pixIcon.load(":/images/pixmaps/VcrRewind.png")) rewindMovie->setPixmap(pixIcon); else rewindMovie->setText(tr("Rewind")); } rewindMovie->setFlat(true); rewindMovie->setToggleButton(false); connect(rewindMovie, SIGNAL(clicked()), this, SLOT(slotRewindMovie())); QPushButton * stepBackMovie = new QPushButton( playHBox); { QPixmap pixIcon; if(pixIcon.load(":/images/pixmaps/VcrStepBackward.png")) stepBackMovie->setPixmap(pixIcon); else stepBackMovie->setText(tr("Back")); } stepBackMovie->setFlat(true); stepBackMovie->setToggleButton(false); connect(stepBackMovie, SIGNAL(clicked()), this, SLOT(slotStepBackwardMovie())); playMovie = new QPushButton( playHBox); { QPixmap pixIcon; if(pixIcon.load(":/images/pixmaps/VcrPlay.png")) playMovie->setPixmap(pixIcon); else playMovie->setText(tr("Play")); } playMovie->setFlat(true); playMovie->setToggleButton(false); connect(playMovie, SIGNAL(clicked()), this, SLOT(slotPlayPauseMovie())); stepMovie = new QPushButton( playHBox); { QPixmap pixIcon; if(pixIcon.load(":/images/pixmaps/VcrStepForward.png")) stepMovie->setPixmap(pixIcon); else stepMovie->setText(tr("Step")); } stepMovie->setFlat(true); stepMovie->setToggleButton(false); connect(stepMovie, SIGNAL(clicked()), this, SLOT(slotStepMovie())); playCombo = new QComboBox(playHBox); playCombo->insertItem("x 1/4", -1); playCombo->insertItem("x 1/2", -1); playCombo->insertItem("x 1", -1); playCombo->insertItem("x 2", -1); playCombo->insertItem("x 4", -1); playCombo->setCurrentItem(2); connect( playCombo, SIGNAL( activated( const QString &) ), this, SLOT( slotSpeedMovie( const QString & ) ) ); // play as grayscale grayButton = new QPushButton( playHBox); { QPixmap pixIcon; if(pixIcon.load(":/images/pixmaps/:images/22x22/view-color.png")) grayButton->setPixmap(pixIcon); else grayButton->setText(tr("Rewind")); } grayButton->setFlat(true); grayButton->setToggleButton(true); QToolTip::add(grayButton, tr("Toggle grayscale/color")); playGrayscale = false; connect(grayButton, SIGNAL(toggled(bool)), this, SLOT(on_grayButton_toggled(bool))); // Scrollbar playScrollBar = new QSlider(Qt::Horizontal, playHBox); //playScrollBar->setOrientation( Qt::Horizontal ); playScrollBar->setMinimum(0); playScrollBar->setPageStep(1); //playScrollBar->setRange(0, 100); playScrollBar->setMaximum(100); playScrollBar->setValue( 0 ); playScrollBar->setTracking(false); connect(playScrollBar, SIGNAL(sliderReleased()), this, SLOT(slotReleaseScrollbar())); connect(playScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotChangedScrollbar(int))); // bookmarks button and menu buttonBookmarks = new QPushButton( playHBox); { QPixmap pixMap; if(pixMap.load(":/images/pixmaps/IconBookmark.png")) buttonBookmarks->setPixmap(pixMap); else buttonBookmarks->setText(tr("Bkmk")); } buttonBookmarks->setFlat(true); buttonBookmarks->setToggleButton(true); buttonBookmarks->setToolTip(tr("Bookmarks")); menuBookmarks = new QMenu(playHBox); buttonBookmarks->setPopup(menuBookmarks); // Append add and edit buttons QIcon pixIcon("IconBookmark.png"); actAddBookmark = menuBookmarks->addAction(pixIcon, tr("Add")); actAddBookmark->setToolTip(tr("Add a bookmark at this position in movie")); actAddBookmark->setIconVisibleInMenu(true); QIcon editIcon("IconBookmarkEdit.png"); actEditBookmark = menuBookmarks->addAction(editIcon, tr("Edit")); actEditBookmark->setIconVisibleInMenu(true); actEditBookmark->setToolTip(tr("Edit bookmarks list")); QIcon playIcon("IconBookmarkPlay.png"); actPlayToBookmark = menuBookmarks->addAction(playIcon, tr("Play until bmrk")); actPlayToBookmark->setIconVisibleInMenu(true); actPlayToBookmark->setToolTip(tr("Play video until next bookmark")); menuBookmarks->addSeparator(); connect(menuBookmarks, SIGNAL(triggered(QAction *)), this, SLOT(on_menuBookmarks_triggered(QAction *))); play_period_ms = 40; // 25 fps // image detailsImage = new WorkshopImage( "full size image" ); detailsImage->QImage::create(320, 240, 32); // detailsView = new WorkshopImageTool( detailsImage, containerWorkshopImageTool, detailsView = new WorkshopImageTool( detailsImage, playerVBox, true, // show snap button true, // show record button "FullsizeImageViewer", Qt::WA_DeleteOnClose //WDestructiveClose ); // This won't force the image to be on workspace because it already has a parent detailsView->setWorkspace((QWorkspace *)pWorkspace); detailsView->display()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); detailsView->display()->update(); connect(pWin, SIGNAL(signalResizeEvent(QResizeEvent *)), this, SLOT(slotResizeTool(QResizeEvent *))); pWin->resize(380,320); }
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware): GenericPanel(parent, model, generalSettings, firmware), functions(model ? model->customFn : generalSettings.customFn) #if defined(PHONON) , phononCurrent(-1), clickObject(NULL), clickOutput(NULL) #endif { Stopwatch s1("CustomFunctionsPanel - populate"); lock = true; int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions); if (!firmware->getCapability(VoicesAsNumbers)) { tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength)); for (int i=0; i<num_fsw; i++) { if (functions[i].func==FuncPlayPrompt || functions[i].func==FuncBackgroundMusic) { QString temp = functions[i].paramarm; if (!temp.isEmpty()) { tracksSet.insert(temp); } } } } s1.report("get tracks"); if (IS_TARANIS(firmware->getBoard())) { scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/FUNCTIONS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength)); for (int i=0; i<num_fsw; i++) { if (functions[i].func==FuncPlayScript) { QString temp = functions[i].paramarm; if (!temp.isEmpty()) { scriptsSet.insert(temp); } } } } s1.report("get scripts"); CompanionIcon playIcon("play.png"); QStringList headerLabels; headerLabels << "#" << tr("Switch") << tr("Action") << tr("Parameters") << tr("Enable"); TableLayout * tableLayout = new TableLayout(this, num_fsw, headerLabels); for (int i=0; i<num_fsw; i++) { // The label QLabel * label = new QLabel(this); label->setContextMenuPolicy(Qt::CustomContextMenu); label->setMouseTracking(true); label->setProperty("index", i); if (model) label->setText(tr("SF%1").arg(i+1)); else label->setText(tr("GF%1").arg(i+1)); label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint))); tableLayout->addWidget(i, 0, label); // s1.report("label"); // The switch fswtchSwtch[i] = new QComboBox(this); fswtchSwtch[i]->setProperty("index", i); populateSwitchCB(fswtchSwtch[i], functions[i].swtch, generalSettings, model ? SpecialFunctionsContext : GlobalFunctionsContext); fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); fswtchSwtch[i]->setMaxVisibleItems(10); connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); tableLayout->addWidget(i, 1, fswtchSwtch[i]); // s1.report("switch"); // The function fswtchFunc[i] = new QComboBox(this); fswtchFunc[i]->setProperty("index", i); populateFuncCB(fswtchFunc[i], functions[i].func); connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited())); tableLayout->addWidget(i, 2, fswtchFunc[i]); // s1.report("func"); // The parameters QHBoxLayout * paramLayout = new QHBoxLayout(); tableLayout->addLayout(i, 3, paramLayout); fswtchGVmode[i] = new QComboBox(this); fswtchGVmode[i]->setProperty("index", i); populateGVmodeCB(fswtchGVmode[i], functions[i].adjustMode); fswtchGVmode[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); connect(fswtchGVmode[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchGVmode[i]); fswtchParamGV[i] = new QCheckBox(this); fswtchParamGV[i]->setProperty("index", i); fswtchParamGV[i]->setText("GV"); fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); connect(fswtchParamGV[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchParamGV[i]); fswtchParam[i] = new QDoubleSpinBox(this); fswtchParam[i]->setProperty("index", i); fswtchParam[i]->setAccelerated(true); fswtchParam[i]->setDecimals(0); connect(fswtchParam[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchParam[i]); fswtchParamTime[i] = new QTimeEdit(this); fswtchParamTime[i]->setProperty("index", i); fswtchParamTime[i]->setAccelerated(true); fswtchParamTime[i]->setDisplayFormat("hh:mm:ss"); connect(fswtchParamTime[i], SIGNAL(editingFinished()), this, SLOT(customFunctionEdited())); paramLayout->addWidget(fswtchParamTime[i]); fswtchParamT[i] = new QComboBox(this); fswtchParamT[i]->setProperty("index", i); populateFuncParamCB(fswtchParamT[i], functions[i].func, functions[i].param, functions[i].adjustMode); paramLayout->addWidget(fswtchParamT[i]); fswtchParamT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); connect(fswtchParamT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); fswtchParamArmT[i] = new QComboBox(this); fswtchParamArmT[i]->setProperty("index", i); fswtchParamArmT[i]->setEditable(true); fswtchParamArmT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); paramLayout->addWidget(fswtchParamArmT[i]); connect(fswtchParamArmT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited())); connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited())); fswtchBLcolor[i] = new QSlider(this); fswtchBLcolor[i]->setProperty("index", i); fswtchBLcolor[i]->setMinimum(0); fswtchBLcolor[i]->setMaximum(100); fswtchBLcolor[i]->setSingleStep(1); fswtchBLcolor[i]->setOrientation(Qt::Horizontal); paramLayout->addWidget(fswtchBLcolor[i]); connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited())); #ifdef PHONON playBT[i] = new QPushButton(this); playBT[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); playBT[i]->setProperty("index", i); playBT[i]->setIcon(playIcon); paramLayout->addWidget(playBT[i]); connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic())); #endif QHBoxLayout * repeatLayout = new QHBoxLayout(); tableLayout->addLayout(i, 4, repeatLayout); fswtchRepeat[i] = new RepeatComboBox(this, functions[i].repeatParam); repeatLayout->addWidget(fswtchRepeat[i], i+1); connect(fswtchRepeat[i], SIGNAL(modified()), this, SLOT(onChildModified())); fswtchEnable[i] = new QCheckBox(this); fswtchEnable[i]->setProperty("index", i); fswtchEnable[i]->setText(tr("ON")); fswtchEnable[i]->setFixedWidth(200); repeatLayout->addWidget(fswtchEnable[i], i+1); connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited())); } s1.report("add items"); disableMouseScrolling(); s1.report("disableMouseScrolling"); lock = false; update(); s1.report("update"); tableLayout->resizeColumnsToContents(); s1.report("resizeColumnsToContents"); tableLayout->setColumnWidth(3, 300); tableLayout->pushRowsUp(num_fsw+1); s1.report("end"); }
TimeControls::TimeControls(QWidget* parent) : QToolBar(parent) { QSettings settings("Pencil","Pencil"); //QFrame* frame = new QFrame(); QSpinBox* fpsBox = new QSpinBox(); //fpsBox->setFixedWidth(50); fpsBox->setFont( QFont("Helvetica", 10) ); fpsBox->setFixedHeight(22); fpsBox->setValue(settings.value("fps").toInt()); fpsBox->setMinimum(1); fpsBox->setMaximum(50); fpsBox->setToolTip("Frames per second"); fpsBox->setFocusPolicy(Qt::NoFocus); QPushButton* playButton = new QPushButton(); loopButton = new QPushButton(); soundButton = new QPushButton(); QLabel* separator = new QLabel(); separator->setPixmap(QPixmap(":icons/controls/separator.png")); separator->setFixedSize(QSize(37,31)); QLabel* spacingLabel = new QLabel(""); spacingLabel->setIndent(6); QLabel* fpsLabel = new QLabel(tr("Fps: ")); fpsLabel->setIndent(6); QIcon playIcon(":icons/controls/play.png"); QIcon loopIcon(":icons/controls/loop.png"); QIcon soundIcon(":icons/controls/sound.png"); #ifdef Q_WS_MAC /*loopButton->setFixedSize( QSize(35,30) ); loopButton->setIconSize( QSize(35,30) ); loopIcon.addFile (":icons/controls/loopOn.png", QSize(35,20), QIcon::Normal, QIcon::On ); loopIcon.addFile (":icons/controls/loopOff.png", QSize(35,20), QIcon::Normal, QIcon::Off); loopIcon.addFile (":icons/controls/loopOn.png", QSize(35,20), QIcon::Disabled, QIcon::On ); loopIcon.addFile (":icons/controls/loopOff.png", QSize(35,20), QIcon::Disabled, QIcon::Off); loopIcon.addFile (":icons/controls/loopOn.png", QSize(35,20), QIcon::Active, QIcon::On ); loopIcon.addFile (":icons/controls/loopOff.png", QSize(35,20), QIcon::Active, QIcon::Off);*/ #endif playButton->setIcon(playIcon); loopButton->setIcon(loopIcon); soundButton->setIcon(soundIcon); playButton->setToolTip(tr("Play")); loopButton->setToolTip(tr("Loop")); soundButton->setToolTip(tr("Sound on/off")); loopButton->setCheckable(true); soundButton->setCheckable(true); soundButton->setChecked(true); addWidget(separator); addWidget(playButton); addWidget(loopButton); addWidget(soundButton); addWidget(fpsLabel); addWidget(fpsBox); /*QHBoxLayout* frameLayout = new QHBoxLayout(); frameLayout->setMargin(0); frameLayout->setSpacing(0); frameLayout->addWidget(separator); frameLayout->addWidget(playButton); frameLayout->addWidget(loopButton); frameLayout->addWidget(soundButton); frameLayout->addWidget(fpsLabel); frameLayout->addWidget(fpsBox); frameLayout->addWidget(spacingLabel); setLayout(frameLayout); setFixedSize(300,32);*/ //QHBoxLayout* layout = new QHBoxLayout(); //layout->setAlignment(Qt::AlignRight); //layout->addWidget(frame); //layout->setMargin(0); //layout->setSizeConstraint(QLayout::SetNoConstraint); //setLayout(frameLayout); connect(playButton, SIGNAL(clicked()), this, SIGNAL(playClick())); connect(loopButton, SIGNAL(clicked()), this, SIGNAL(loopClick())); connect(soundButton, SIGNAL(clicked()), this, SIGNAL(soundClick())); connect(fpsBox,SIGNAL(valueChanged(int)), this, SIGNAL(fpsClick(int))); //updateButtons(false); }