예제 #1
0
파일: tabwidget.cpp 프로젝트: RavenB/CopyQ
void TabWidget::setTreeModeEnabled(bool enabled)
{
    if (isTreeModeEnabled() == enabled) {
        updateToolBar();
        return;
    }

    const QStringList tabs = this->tabs();

    if (enabled) {
        delete m_tabBar;
        m_tabBar = NULL;

        createTabTree();
        for (int i = 0; i < tabs.size(); ++i) {
            const QString &tabName = tabs[i];
            m_tabTree->insertTab(tabName, i, i == 0);
            m_tabTree->setTabItemCount(tabName, itemCountLabel(tabName));
        }

        m_tabTree->setCollapsedTabs(m_collapsedTabs);
    } else {
        m_collapsedTabs = m_tabTree->collapsedTabs();

        delete m_tabTree;
        m_tabTree = NULL;

        createTabBar();
        for (int i = 0; i < tabs.size(); ++i) {
            const QString &tabName = tabs[i];
            m_tabBar->insertTab(i, tabName);
            m_tabBar->setTabItemCount(tabName, itemCountLabel(tabName));
        }
    }
}
예제 #2
0
void TabWidget::createTabBar()
{
    m_tabBar = new TabBar(this);
    m_toolBar->addWidget(m_tabBar);

    m_tabBar->setObjectName("tab_bar");

    m_tabBar->setExpanding(false);
    m_tabBar->setMovable(true);

    connect( m_tabBar, SIGNAL(tabMenuRequested(QPoint, int)),
             this, SIGNAL(tabMenuRequested(QPoint, int)) );
    connect( m_tabBar, SIGNAL(tabRenamed(QString,int)),
             this, SIGNAL(tabRenamed(QString,int)) );
    connect( m_tabBar, SIGNAL(tabCloseRequested(int)),
             this, SIGNAL(tabCloseRequested(int)) );
    connect( m_tabBar, SIGNAL(dropItems(QString,QMimeData)),
             this, SIGNAL(dropItems(QString,QMimeData)) );
    connect( m_tabBar, SIGNAL(currentChanged(int)),
             this, SLOT(setCurrentIndex(int)) );
    connect( m_tabBar, SIGNAL(tabMoved(int, int)),
             this, SLOT(onTabMoved(int, int)) );

    updateToolBar();
}
void ImageProcessSystem::interactiveLacalEnhencementActionTriggered()
{
	if(interactiveStatus&INTERACTIVE_LOCAL_ENHENCEMENT_SELECTED)
		return;
	if(interactiveHasProduceResult)
	{
		interactiveHasProduceResult=false;
		updateMat();
	}
	interactiveStatus=0;
	interactiveStatus|=INTERACTIVE_LOCAL_ENHENCEMENT_SELECTED;
	delete ImageLabel;
	ImageLabel=new LocalEnhencementLabel(ui.centralWidget);
	initImageLabel();
	((LocalEnhencementLabel *)(ImageLabel))->setParameters(&srcImage,ui.pixelValueLabel,&regionMask.get(),&srcMat.get(),tolerance,featherRadius);
	connect(ImageLabel,SIGNAL(interactiveLocalEnhencementFinished()),this,SLOT(interactiveLocalEnhencementFinishSignalEmit()));
	interactiveOptionWidgetHasInit=true;
	delete interactiveOptionWidget;
	interactiveOptionWidget=new InteractiveLocalEnhencementWidget(ui.centralWidget,(LocalEnhencementLabel *)ImageLabel);
	interactiveOptionWidget->setGeometry(ImageLabel->x()+ImageLabel->width()+10,ImageLabel->y(),240,ImageLabel->height());
	interactiveOptionWidget->setVisible(true);
	interactiveLocalEnhencementConnecting();
	updateToolBar();
	updateDisplayImage();
}
void ImageProcessSystem::interactiveColorLevelTriggered()
{
	if(interactiveStatus&INTERACTIVE_COLOR_LEVEL_SELECTED)
		return;
	if(interactiveHasProduceResult)
	{
		interactiveHasProduceResult=false;
		updateMat();
	}
	interactiveStatus=0;
	interactiveStatus|=INTERACTIVE_COLOR_LEVEL_SELECTED;
	delete ImageLabel;
	ImageLabel=new OriginalImageLabel(ui.centralWidget);
	initImageLabel();
	interactiveOptionWidgetHasInit=true;
	delete interactiveOptionWidget;
	interactiveOptionWidget=new InteractiveColorLevelWidget(ui.centralWidget);
	interactiveOptionWidget->setGeometry(ImageLabel->x()+ImageLabel->width()+10,ImageLabel->y(),240,ImageLabel->height());
	interactiveOptionWidget->setVisible(true);
	connect(((InteractiveColorLevelWidget *)interactiveOptionWidget)->redSlider.get(),SIGNAL(valueChanged(int)),this,SLOT(interactiveColorLevelParametersChanged(int)));
	connect(((InteractiveColorLevelWidget *)interactiveOptionWidget)->lightnessSlider.get(),SIGNAL(valueChanged(int)),this,SLOT(interactiveColorLevelParametersChanged(int)));
	connect(((InteractiveColorLevelWidget *)interactiveOptionWidget)->saturationSlider.get(),SIGNAL(valueChanged(int)),this,SLOT(interactiveColorLevelParametersChanged(int)));
	connect(((InteractiveColorLevelWidget *)interactiveOptionWidget)->contrastSlider.get(),SIGNAL(valueChanged(int)),this,SLOT(interactiveColorLevelParametersChanged(int)));
	srcHSVMat.get()=Mat(srcMat->rows,srcMat->cols,CV_32FC3);
	ColorSpaceTransition::rgb2Hsv(srcMat.get(),srcHSVMat.get());
	updateToolBar();
	updateDisplayImage();
}
예제 #5
0
void EditorToolBar::addCenterToolBar(QWidget *toolBar)
{
    toolBar->setVisible(false); // will be made visible in setCurrentEditor
    d->m_toolBarPlaceholder->layout()->addWidget(toolBar);

    updateToolBar(toolBar);
}
void
QDBase::setMode(int cmd, bool do_redraw, int src)
{
   DEBUG_MSG("QDBase::setMode(): setting mode=" << cmd << "\n");

   if (mode_prio[mode_src]>mode_prio[src]) return;
   mode_src=src;
   
   if (cmd==IDC_DISPLAY_BLACKWHITE)
   {
      pm_cache.disable(); bm_cache.enable();
      cache_timer.start(0, TRUE);
   } else
   {
      bm_cache.disable(); pm_cache.enable();
      cache_timer.start(0, TRUE);
   }
   
      // Install new mode (remember, that there is "cmd_mode_override" too)
   if (cmd_mode!=cmd)
   {
      cmd_mode=cmd;
      updateToolBar();
      if (do_redraw) redraw();
   }
}
void ImageProcessSystem::sharpEffect()
{
	BasisOperation::sharpEffect(srcMat.get(),resultMat.get());
	updateMat();
	updateToolBar();
	updateDisplayImage();
}
void ImageProcessSystem::automaticLocalEnhencement()
{
	BasisOperation::colorLevel(srcMat.get(),resultMat.get(),0,255,2);
	updateMat();
	updateToolBar();
	updateDisplayImage();
}
예제 #9
0
파일: tabwidget.cpp 프로젝트: RavenB/CopyQ
bool TabWidget::eventFilter(QObject *, QEvent *event)
{
    if (event->type() == QEvent::Move)
        updateToolBar();

    return false;
}
예제 #10
0
/**
 * Sets the current status (progress) of this action.
 * The default implementation sets the class variable 'status' to the
 * given value and finishes the action if 'status' is negative.
 *
 * @param status Status number. It's up to the action implementor
 *               what the action uses the status for. However, a
 *               negative status number finishes the action. Usually
 *               the status of an action increases for every step
 *               of progress and decreases when the user goes one
 *               step back (i.e. presses the right mouse button).
 */
void RS_ActionInterface::setStatus(int status) {
    this->status = status;
    updateMouseButtonHints();
    updateToolBar();
    updateMouseCursor();
    if(status<0) finish();
}
예제 #11
0
void TabWidget::setTreeModeEnabled(bool enabled)
{
    if (isTreeModeEnabled() == enabled) {
        updateToolBar();
        return;
    }

    const QStringList tabs = this->tabs();

    if (enabled) {
        delete m_tabBar;
        m_tabBar = NULL;

        createTabTree();
        for (int i = 0; i < tabs.size(); ++i)
            m_tabTree->insertTab(tabs[i], i, i == 0);
    } else {
        delete m_tabTree;
        m_tabTree = NULL;

        createTabBar();
        for (int i = 0; i < tabs.size(); ++i)
            m_tabBar->insertTab(i, tabs[i]);
    }
}
예제 #12
0
void EditorToolBar::setCurrentEditor(IEditor *editor)
{
//    d->m_editorList->setCurrentIndex(d->m_editorsModel->indexOf(editor).row());

    updateToolBar(editor->toolBar());

    updateEditorStatus(editor);
}
예제 #13
0
void GraphicUI::edit()
{
	bool Isok;
	QWidget* Scenewidget = ZERO;
	QString Description = QInputDialog::getText(Scenewidget, tr("Input Dialog"), tr("Please input your description"), QLineEdit::Normal, "", &Isok);
	if (Isok == true)
		Gui_presentation->editDecription(Description.toStdString());
	updateToolBar();
}
예제 #14
0
void GraphicUI::save()
{
	Gui_presentation->initialCommand();
	QString fileName = QFileDialog::getSaveFileName(this, tr("Save Mind Map"), "C:\\", tr("Mind Map files(*.mm)"));
	if (Gui_presentation->saveMindMap(fileName.toStdString()).compare("No MindMap!\n") == 0)
		QMessageBox::critical(NULL, "ERROR", "You didn't create the Mind Map!", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
	updateToolBar();

}
void ImageProcessSystem::cancelOperation()
{
	srcImage=images.top();
	currentDisplayImageImproper=false;
	BasisOperation::qimage2Mat(srcImage,srcMat.get());
	images.pop();
	resetStatus();
	updateToolBar();
	updateDisplayImage();
}
void ImageProcessSystem::listWidgetClicked(QListWidgetItem *item)
{
	int r=ui.listWidget->row(item);
	fileName=fileNames[r];
	resetStatus();
	interactiveHasProduceResult=false;
	loadImage();
	updateToolBar();
	initMat();
	initImageLabel();
}
예제 #17
0
void EditorToolBar::setCurrentEditor(IEditor *editor)
{
    IDocument *document = editor ? editor->document() : 0;
    d->m_editorList->setCurrentIndex(DocumentModel::rowOfDocument(document));

    // If we never added the toolbar from the editor,  we will never change
    // the editor, so there's no need to update the toolbar either.
    if (!d->m_isStandalone)
        updateToolBar(editor ? editor->toolBar() : 0);

    updateDocumentStatus(document);
}
void ImageProcessSystem::automaticHighlightRemoval()
{
	highlightDetection();
	srcMat.get().copyTo(resultMat.get());
	HighLightRemoval::removal(srcMat.get(),resultMat.get(),highlightMask.get(),face,HIGHLIGHT_REMOVAL_POSSION_MATHOD);
	updateMat();
	updateToolBar();
#ifdef DEBUG
	imshow("result",resultMat.get());
#else
	updateDisplayImage();
#endif
}
void ImageProcessSystem::automaticColorCorrection()
{
	if(colorCorrection())
	{
		updateMat();
		updateToolBar();
#ifdef DEBUG
		imshow("result",resultMat.get());
#else
		updateDisplayImage();
#endif
	}
}
void ImageProcessSystem::openFile()
{
	fileName=QFileDialog::getOpenFileName(this,"Open File",QDir::currentPath(),"Images (*.bmp *.gif *.jpg *.jpeg *.png *.tiff)");
	if(!loadImage())
		return ;
	resetStatus();
	interactiveHasProduceResult=false;
	updateToolBar();
	initMat();
	delete ImageLabel;
	ImageLabel=new OriginalImageLabel(ui.centralWidget);
	initImageLabel();
}
예제 #21
0
/**
 * Called to initiate an action. This funtcion is often
 * overwritten by the implementing action.
 *
 * @param status The status on which to initiate this action.
 * default is 0 to begin the action.
 */
void RS_ActionInterface::init(int status) {
    RS_Snapper::init();

    setStatus(status);
    if (status>=0) {
        //graphicView->setMouseCursor(cursor);
                updateMouseButtonHints();
        updateMouseCursor();
        updateToolBar();
    }else{
        //delete snapper when finished, bug#3416878
        deleteSnapper();
    }
}
예제 #22
0
void RS_ActionDrawImage::trigger() {
    deletePreview();

    if (!data.file.isEmpty()) {
        RS_Creation creation(container, graphicView);
        creation.createImage(data);
    }

	graphicView->redraw(RS2::RedrawDrawing); 

    //RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
    finish();
	updateToolBar();
}
예제 #23
0
/**
 * Finishes this action.
 */
void RS_ActionInterface::finish(bool updateTB) {
    RS_DEBUG->print("RS_ActionInterface::finish");
    //    if(rtti() != RS2::ActionDefault) {//refuse to quit the default action
    if(!(rtti() == RS2::ActionDefault || rtti()==RS2::ActionFilePrintPreview) ) {//refuse to quit the default action
        status = -1;
        finished = true;
        hideOptions();
        if(updateTB) {
            updateToolBar();
        }
        RS_Snapper::finish();
    }
    graphicView->setMouseCursor(RS2::ArrowCursor);

    RS_DEBUG->print("RS_ActionInterface::finish: OK");
}
void ImageProcessSystem::automaticHighlightDetecting()
{
	highlightDetection();
	images.push(srcImage);
	currentDisplayImageImproper=true;
#ifdef DEBUG
	imshow("highlight",highlightMask.get());
#else
	Mat highlightMaskThreeChannel;
	cvtColor(highlightMask.get(),highlightMaskThreeChannel,CV_GRAY2BGR);
	QImage highlightMaskImage(highlightMask->cols,highlightMask->rows,QImage::Format_RGB32);
	BasisOperation::mat2QImage(highlightMaskThreeChannel,highlightMaskImage);
	ImageLabel->displayImage(highlightMaskImage);
#endif
	updateToolBar();
}
//for toolbar
void ImageProcessSystem::automaticFaceDetecting()
{
	faceDetectingCombined();
	images.push(srcImage);
	currentDisplayImageImproper=true;
#ifdef DEBUG
	imshow("faceMask",faceMask.get());
#else
	Mat faceMaskThreeChannel;
	cvtColor(faceMask.get(),faceMaskThreeChannel,CV_GRAY2BGR);
	QImage faceMaskImage(faceMask->cols,faceMask->rows,QImage::Format_RGB32);
	BasisOperation::mat2QImage(faceMaskThreeChannel,faceMaskImage);
	ImageLabel->displayImage(faceMaskImage);
#endif
	updateToolBar();
}
예제 #26
0
void TabWidget::removeTab(int tabIndex)
{
    if (tabIndex == currentIndex())
        setCurrentIndex(0);

    QWidget *w = m_stackedWidget->widget(tabIndex);
    m_stackedWidget->removeWidget(w);
    delete w;

    if ( isTreeModeEnabled() )
        m_tabTree->removeTab(tabIndex);
    else
        m_tabBar->removeTab(tabIndex);

    updateToolBar();
}
void ImageProcessSystem::interactiveTriangleActionTriggered()
{
	if(interactiveStatus&INTERACTIVE_TRIANGLE_SELECTED)
		return;
	if(interactiveHasProduceResult)
	{
		interactiveHasProduceResult=false;
		updateMat();
	}
	interactiveStatus=INTERACTIVE_TRIANGLE_SELECTED;
	delete ImageLabel;
	ImageLabel=new InteractiveTriangleLabel(pointX,pointY,ui.centralWidget);
	initImageLabel();
	((InteractiveTriangleLabel *)ImageLabel)->initDrawingImage();
	updateToolBar();
	updateDisplayImage();
}
void ImageProcessSystem::interactiveLocalEnhencementFinishSignalEmit()
{
	BasisOperation::qimage2OneChannelMat(((LocalEnhencementLabel *)ImageLabel)->paintMask,INTERACTIVE_PIXEL_VALUE,regionMask.get(),PIXEL_SELECTED_VALUE);
	blur(regionMask.get(),regionMask.get(),Size(featherRadius,featherRadius));
	double x=0.5,y;
	if(((InteractiveLocalEnhencementWidget *)interactiveOptionWidget)->dodgeRadioButton->isChecked())
	{
		y=0.45;
	}
	else
		y=0.55;
	srcMat.get().copyTo(resultMat.get());
	BasisOperation::localEnhencementUsingMappingMethod(resultMat.get(),&regionMask.get(),x,y);
	updateMat();
	updateToolBar();
	updateDisplayImage();
}
void ImageProcessSystem::interactiveMeshEditingActionTriggered()
{
	if(interactiveStatus&INTERACTIVE_MESH_EDITING)
		return;
	if(interactiveHasProduceResult)
	{
		interactiveHasProduceResult=false;
		updateMat();
	}
	interactiveStatus=INTERACTIVE_MESH_EDITING;
	interactiveOptionWidgetHasInit=true;
	delete ImageLabel;
	ImageLabel=new InteractiveMeshEditingLabel(io,symmIO,ui.centralWidget);
	initImageLabel();
	((InteractiveMeshEditingLabel *)ImageLabel)->displayTriangle();
	updateToolBar();
	//updateDisplayImage();
}
예제 #30
0
파일: tabwidget.cpp 프로젝트: RavenB/CopyQ
void TabWidget::insertTab(int tabIndex, QWidget *widget, const QString &tabText)
{
    bool firstTab = count() == 0;
    m_stackedWidget->insertWidget(tabIndex, widget);

    if ( isTreeModeEnabled() ) {
        m_tabTree->insertTab(tabText, tabIndex, firstTab);
        m_toolBarTree->layout()->setSizeConstraint(QLayout::SetMinAndMaxSize);
    } else {
        m_tabBar->insertTab(tabIndex, tabText);
        m_toolBar->layout()->setSizeConstraint(QLayout::SetMinAndMaxSize);
    }

    if (firstTab)
        emit currentChanged(0, -1);

    updateTabItemCount(tabText);
    updateToolBar();
}