コード例 #1
0
void DrawPointTool::updateStatusText()
{
	if (isDragging())
	{
		auto angle = qRadiansToDegrees(preview_object->getRotation());
		setStatusBarText( trUtf8("<b>Angle:</b> %1° ").arg(QLocale().toString(angle, 'f', 1)) + QLatin1String("| ") +
		                  tr("<b>%1</b>: Fixed angles. ").arg(ModifierKey::control()) );
	}
	else if (static_cast<const PointSymbol*>(preview_object->getSymbol())->isRotatable())
	{
		auto parts = QStringList {
		    tr("<b>Click</b>: Create a point object."),
		    tr("<b>Drag</b>: Create an object and set its orientation."),
		};
		auto angle = qRadiansToDegrees(preview_object->getRotation());
		if (!qIsNull(angle))
		{
			parts.push_front(trUtf8("<b>Angle:</b> %1° ").arg(QLocale().toString(angle, 'f', 1)) + QLatin1Char('|'));
			parts.push_back(tr("<b>%1, 0</b>: Reset rotation.").arg(ModifierKey::escape()));
		}
		setStatusBarText(parts.join(QLatin1Char(' ')));
	}
	else
	{
		// Same as click_text above.
		setStatusBarText(tr("<b>Click</b>: Create a point object."));
	}
}
コード例 #2
0
ファイル: tool_draw_text.cpp プロジェクト: aivarszo/mapper
void DrawTextTool::updateStatusText()
{
	if (text_editor)
		setStatusBarText(tr("<b>%1</b>: Finish editing. ").arg(ModifierKey::escape()));
	else
		setStatusBarText(tr("<b>Click</b>: Create a text object with a single anchor. <b>Drag</b>: Create a text box. "));
}
コード例 #3
0
HWND initMainWindow(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine)
{
	WNDCLASSEX wcex;
	wcex.cbSize = sizeof(WNDCLASSEX);
	wcex.style = CS_HREDRAW | CS_VREDRAW;
	wcex.lpfnWndProc = WndProc;
	wcex.cbClsExtra = 0;
	wcex.cbWndExtra = 0;
	wcex.hInstance = hInstance;
	wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
	wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
	wcex.hbrBackground = CreateSolidBrush(RGB(240, 240, 240));
	wcex.lpszMenuName = nullptr;
	wcex.lpszClassName = szWindowClass;
	wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
	if (!RegisterClassEx(&wcex))
	{
		setStatusBarText(L"Call to RegisterClassEx failed!");
		return nullptr;
	}
	hInst = hInstance;
	auto hWnd = CreateWindow(szWindowClass, szTitle,
		(WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX),
		CW_USEDEFAULT, CW_USEDEFAULT, 590, 195, NULL, NULL, hInstance, NULL);
	if (!hWnd)
	{
		setStatusBarText(L"Call to CreateWindow failed!");
		return nullptr;
	}
	return hWnd;
}
コード例 #4
0
ファイル: tool_scale.cpp プロジェクト: 999999333/mapper
void ScaleTool::updateStatusText()
{
	if (scaling)
		setStatusBarText(tr("<b>Scaling:</b> %1%").arg(QLocale().toString(scaling_factor * 100, 'f', 1)));
	else if (!scaling_center_set)
		setStatusBarText(tr("<b>Click</b>: Set the scaling center. "));
	else
		setStatusBarText(tr("<b>Click</b>: Set the scaling center. ") +
		                 tr("<b>Drag</b>: Scale the selected objects. "));
}
コード例 #5
0
void onLoadCMClicked(HWND hWnd)
{
	setStatusBarText(L"Загрузка...");
	if (currentDeviceNumber < 0)
	{
		setStatusBarText(L"Не выбрано устройство!");
		return;
	}

	auto szFileName = new char[MAX_PATH];
	GetWindowTextA(confWayLE, szFileName, MAX_PATH);
	std::string pathToCommodFile(szFileName);	
	delete[] szFileName;

	if (!isFileExists(pathToCommodFile)) {
		setStatusBarText(L"Не найден файл конфигурации");
		return;
	}
	auto manager = new StrategyDeployment(pathToCommodFile);
	incrProgressBar(hWnd, 20);
	bool isOK;
	if (fileSize(pathToCommodFile) > 0x10000)
	{
		manager->setZip(true);
		manager->setCreateCompressedFile(true);
		manager->setZipLocation(getZipLocation(hWnd));
		manager->setParse(true);
		manager->setzipCompressionLevel(7);
		isOK = manager->convert();
	}	
	incrProgressBar(hWnd, 30);
	isOK = manager->validateCurrentConfiguration();	
	if (!isOK)
	{
		incrProgressBar(hWnd, 50);
		SetWindowTextA(stateSB, "Ошибка: неверная конфигурация! Отмена загрузки.");
		manager->saveLog();
		delete manager;
		return;
	}
		
	incrProgressBar(hWnd, 20);
	isOK = manager->loadConfiguration(currentDeviceNumber);
	manager->saveLog();
	auto resultLog(manager->getLastConfName());
	delete manager;
	incrProgressBar(hWnd, 30);
	isOK ? resultLog.append(" - конфигурация загружена успешно.") :
		resultLog.append(" -конфигурация не загружена.");
	
	SetWindowTextA(stateSB, resultLog.c_str());
}
コード例 #6
0
ファイル: tool_draw_point.cpp プロジェクト: aivarszo/mapper
void DrawPointTool::updateStatusText()
{
	if (isDragging() && rotating)
	{
		static const double pi_x_2 = M_PI * 2.0;
		static const double to_deg = 180.0 / M_PI;
		double angle = fmod(calculateRotation(constrained_pos, constrained_pos_map) + pi_x_2, pi_x_2) * to_deg;
		setStatusBarText( trUtf8("<b>Angle:</b> %1° ").arg(QLocale().toString(angle, 'f', 1)) + "| " +
		                  tr("<b>%1</b>: Fixed angles. ").arg(ModifierKey::control()) );
	}
	else
	{
		setStatusBarText( tr("<b>Click</b>: Create a point object. <b>Drag</b>: Create an object and set its orientation (if rotatable). "));
	}
}
コード例 #7
0
void
GUIApplicationWindow::load(const std::string& file, bool isNet, bool isReload) {
    getApp()->beginWaitCursor();
    myAmLoading = true;
    closeAllWindows();
    if (isReload) {
        myLoadThread->start();
        setStatusBarText("Reloading.");
    } else {
        gSchemeStorage.saveViewport(0, 0, -1); // recenter view
        myLoadThread->load(file, isNet);
        setStatusBarText("Loading '" + file + "'.");
    }
    update();
}
コード例 #8
0
ファイル: tool_rotate.cpp プロジェクト: sembruk/mapper
void RotateTool::updateStatusText()
{
	QString text;
	if (isDragging())
	{
		auto display_rotation = qRadiansToDegrees(current_rotation);
		if (display_rotation <= -180)
			display_rotation += 360;
		else if (display_rotation > 180)
			display_rotation -= 360;
		else if (display_rotation > -0.05 && display_rotation < 0.0)
			display_rotation = +0.0;
		text = trUtf8("<b>Rotation:</b> %1° ").arg(QLocale().toString(display_rotation, 'f', 1));
		if (!angle_helper->isActive())
			text += QLatin1String("| ");
	}
	else
	{
		text = tr("<b>Click</b>: Set the center of rotation. ") +
		       tr("<b>Drag</b>: Rotate the selected objects. ");
	}
	
	if (!angle_helper->isActive())
	{
		text += tr("<b>%1</b>: Fixed angles. ").arg(ModifierKey::control());
	}
	
	setStatusBarText(text);
}
コード例 #9
0
ファイル: print_tool.cpp プロジェクト: 999999333/mapper
void PrintTool::init()
{
	setStatusBarText(tr("<b>Drag</b>: Move the map, the print area or the area's borders. "));
	updatePrintArea();
	
	MapEditorTool::init();
}
コード例 #10
0
ファイル: tool_draw_freehand.cpp プロジェクト: FEK10/mapper
void DrawFreehandTool::updateStatusText()
{
	QString text;
	text = tr("<b>Drag</b>: Draw a path. ") +
			MapEditorTool::tr("<b>%1</b>: Abort. ").arg(ModifierKey::escape());
	setStatusBarText(text);
}
コード例 #11
0
void onRefreshDevicesPBClicked(HWND hWnd)
{
	SendMessage(devicesDL, CB_RESETCONTENT, 0, 0);
	unsigned int devicesCount = StrategyDeployment::getDevicesCount();
	if (devicesCount <= 0)
	{
		setStatusBarText(L"Не обнаружено FTDI устройств.");
		currentDeviceNumber = -1;
		return;
	}
	currentDeviceNumber = 0;

	for (int i = 0; i < devicesCount; ++i)
	{
		char *buffer = new char[64];
		char *serialNumber = new char[64];
		StrategyDeployment::getSerialNumber(i, serialNumber);
		StrategyDeployment::getDeviceDesrc(i, buffer);
		strcat_s(buffer, 64, " Serial num: ");
		strcat_s(buffer, 64, serialNumber);
		SendMessageA(devicesDL, CB_ADDSTRING, static_cast<WPARAM>(0), reinterpret_cast<LPARAM>(buffer));
		SendMessage(devicesDL, CB_SETCURSEL, static_cast<WPARAM>(0), 0);

		delete[] serialNumber;
		delete[] buffer;
	}

}
コード例 #12
0
MainWindow::MainWindow(std::string path, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow) {

    /* Get pointers to the following components:
     *     Dropdown list
     *     Text box
     *     Clear button
     * */
    dictionaryPath = (path.compare("") == 0) ? std::string("../freq_dict.txt") : path;
    ui->setupUi(this);
    dropDown = centralWidget()->findChild<WordList *>("listWidget");
    textField = centralWidget()->findChild<MyLineEdit *>("lineEdit");
    QPushButton * pushButton =
                centralWidget()->findChild<QPushButton *>("pushButton");
    statusBar()->clearMessage();

    // connection of events /w ui components
    if (textFieldEnabled) {
        connect(pushButton, SIGNAL(clicked(bool)),
                textField, SLOT(clearTextBox()));
        connect(textField, SIGNAL(textEdited(const QString &)),
                dropDown, SLOT(setItems(const QString &)));
    } else {
        textField->setDisabled(true);
        textField->setStyleSheet(tr("background-color: rgb(211, 211, 211);"));
        setStatusBarText(tr(
          "Failed to open dictionary. Is the dictionary file in the parent directory?"));
    }
    dropDown->setVisible(false);
}
コード例 #13
0
// This can happen after openUrl returns, or directly from m_image->ref()
void KHTMLImage::notifyFinished( khtml::CachedObject *o )
{
    if ( !m_image || o != m_image )
        return;

    //const QPixmap &pix = m_image->pixmap();
    QString caption;

    KMimeType::Ptr mimeType;
    if ( !m_mimeType.isEmpty() )
        mimeType = KMimeType::mimeType(m_mimeType, KMimeType::ResolveAliases);

    if ( mimeType ) {
        if ( !m_image->suggestedTitle().isEmpty() ) {
            caption = i18n( "%1 (%2 - %3x%4 Pixels)", m_image->suggestedTitle(), mimeType->comment(), m_image->pixmap_size().width(), m_image->pixmap_size().height() );
        } else {
            caption = i18n( "%1 - %2x%3 Pixels" ,  mimeType->comment() ,
                  m_image->pixmap_size().width() ,  m_image->pixmap_size().height() );
        }
    } else {
        if ( !m_image->suggestedTitle().isEmpty() ) {
            caption = i18n( "%1 (%2x%3 Pixels)" , m_image->suggestedTitle(),  m_image->pixmap_size().width() ,  m_image->pixmap_size().height() );
        } else {
            caption = i18n( "Image - %1x%2 Pixels" ,  m_image->pixmap_size().width() ,  m_image->pixmap_size().height() );
        }
    }

    emit setWindowCaption( caption );
    emit completed();
    emit setStatusBarText(i18n("Done."));
}
コード例 #14
0
void DrawRectangleTool::updateStatusText()
{
	QString text;
	static const QString text_more_shift_control_space(MapEditorTool::tr("More: %1, %2, %3").arg(ModifierKey::shift(), ModifierKey::control(), ModifierKey::space()));
	static const QString text_more_shift_space(MapEditorTool::tr("More: %1, %2").arg(ModifierKey::shift(), ModifierKey::space()));
	static const QString text_more_control_space(MapEditorTool::tr("More: %1, %2").arg(ModifierKey::control(), ModifierKey::space()));
	QString text_more(text_more_shift_control_space);
	
	if (draw_dash_points)
		text += DrawLineAndAreaTool::tr("<b>Dash points on.</b> ") + "| ";
	
	if (!editingInProgress())
	{
		if (ctrl_pressed)
		{
			text += DrawLineAndAreaTool::tr("<b>%1+Click</b>: Pick direction from existing objects. ").arg(ModifierKey::control());
			text_more = text_more_shift_space;
		}
		else if (shift_pressed)
		{
			text += DrawLineAndAreaTool::tr("<b>%1+Click</b>: Snap to existing objects. ").arg(ModifierKey::shift());
			text_more = text_more_control_space;
		}
		else
		{
			text += tr("<b>Click or Drag</b>: Start drawing a rectangle. ");	
		}
	}
	else
	{
		if (ctrl_pressed)
		{
			if (angles.size() == 1)
			{
				text += DrawLineAndAreaTool::tr("<b>%1</b>: Fixed angles. ").arg(ModifierKey::control());
			}
			else
			{
				text += tr("<b>%1</b>: Snap to previous lines. ").arg(ModifierKey::control());
			}
			text_more = text_more_shift_space;
		}
		else if (shift_pressed)
		{
			text += DrawLineAndAreaTool::tr("<b>%1+Click</b>: Snap to existing objects. ").arg(ModifierKey::shift());
			text_more = text_more_control_space;
		}
		else
		{
			text += tr("<b>Click</b>: Set a corner point. <b>Right or double click</b>: Finish the rectangle. ");
			text += DrawLineAndAreaTool::tr("<b>%1</b>: Undo last point. ").arg(ModifierKey::backspace());
			text += MapEditorTool::tr("<b>%1</b>: Abort. ").arg(ModifierKey::escape());
		}
	}
	
	text += "| " + text_more;
	
	setStatusBarText(text);
}
コード例 #15
0
ファイル: tool_cut_hole.cpp プロジェクト: aivarszo/mapper
void CutHoleTool::updateStatusText()
{
	if (!path_tool)
	{
		// FIXME: The path_tool would have better instruction, but is not initialized yet.
		setStatusBarText(tr("<b>Click or drag</b>: Start drawing the hole. "));
	}
}
コード例 #16
0
ファイル: mainwindow.cpp プロジェクト: fpoli/qCharts
Sheet* MainWindow::newSheet()
{
    Sheet *childSheet = new Sheet(tabWidget);
    tabWidget->addTab(childSheet, childSheet->getShortTitle());
    tabWidget->setCurrentWidget(childSheet);
    updateActions();

    connect(childSheet, SIGNAL(statusEvent(QString)), this, SLOT(setStatusBarText(QString)));
    connect(childSheet, SIGNAL(titleChanged()), this, SLOT(updateTabsTitle()));
    return childSheet;
}
コード例 #17
0
ファイル: tool_rotate.cpp プロジェクト: FEK10/mapper
void RotateTool::updateStatusText()
{
	if (rotating)
	{
		static const double pi_x_2 = M_PI * 2.0;
		static const double to_deg = 180.0 / M_PI;
		double delta_rotation = old_rotation - original_rotation;
		if (delta_rotation < -M_PI)
			delta_rotation = delta_rotation + pi_x_2;
		else if (delta_rotation > M_PI)
			delta_rotation = delta_rotation - pi_x_2;
		setStatusBarText( trUtf8("<b>Rotation:</b> %1° ").arg(QLocale().toString(-delta_rotation * to_deg, 'f', 1)) + QLatin1String("| ") +
		                  tr("<b>%1</b>: Fixed angles. ").arg(ModifierKey::control()) );
	}
	else if (!rotation_center_set)
	{
		setStatusBarText( tr("<b>Click</b>: Set the center of rotation. ") );
	}
	else
	{
		setStatusBarText( tr("<b>Click</b>: Set the center of rotation. ") +
		                  tr("<b>Drag</b>: Rotate the selected objects. ") );
	}
}
コード例 #18
0
ファイル: tool_cutout.cpp プロジェクト: 999999333/mapper
void CutoutTool::updateStatusText()
{
	QString text;
	if (map()->getNumSelectedObjects() == 0)
	{
		text = tr("<b>%1</b>: Clip the whole map. ").arg(ModifierKey::return_key()) +
		       tr("<b>%1+Click or drag</b>: Select the objects to be clipped. ").arg(ModifierKey::shift());
	}
	else
	{
		text = tr("<b>%1+Click or drag</b>: Select the objects to be clipped. ").arg(ModifierKey::shift()) +
		       tr("<b>%1</b>: Clip the selected objects. ").arg(ModifierKey::return_key());
	}
	text += MapEditorTool::tr("<b>%1</b>: Abort. ").arg(ModifierKey::escape());
	setStatusBarText(text);	
}
コード例 #19
0
ファイル: tool_draw_circle.cpp プロジェクト: 999999333/mapper
void DrawCircleTool::updateStatusText()
{
	QString text;
	if (!first_point_set || (!second_point_set && dragging))
	{
		text = tr("<b>Click</b>: Start a circle or ellipse. ") + 
		       tr("<b>Drag</b>: Draw a circle. ") +
			   "| " +
			   tr("Hold %1 to start drawing from the center.").arg(ModifierKey::control());
	}
	else
	{
		text = tr("<b>Click</b>: Finish the circle. ") +
		       tr("<b>Drag</b>: Draw an ellipse. ") +
		       MapEditorTool::tr("<b>%1</b>: Abort. ").arg(ModifierKey::escape());
	}
	setStatusBarText(text);
}
コード例 #20
0
WebView::WebView(QWidget* parent)
    : QWebView(parent)
    , m_progress(0)
    , m_page(new WebPage(this))
{
    setPage(m_page);
    connect(page(), SIGNAL(statusBarMessage(QString)),
            SLOT(setStatusBarText(QString)));
    connect(this, SIGNAL(loadProgress(int)),
            this, SLOT(setProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)),
            this, SLOT(loadFinished()));
    connect(page(), SIGNAL(loadingUrl(QUrl)),
            this, SIGNAL(urlChanged(QUrl)));
    connect(page(), SIGNAL(downloadRequested(QNetworkRequest)),
            this, SLOT(downloadRequested(QNetworkRequest)));
    page()->setForwardUnsupportedContent(true);

}
コード例 #21
0
ファイル: player.cpp プロジェクト: serghei/kde3-kdemultimedia
void Kaboodle::Player::tickerTimeout(void)
{
	if(engine->state() == Stop)
	{
		if ( uncompleted )
		{
			stop();
			if( isLooping() )
			{
				play();
			}
			else
			{
				uncompleted = false;
				emit completed();
			}
		}
		if(embedded)
		{
			widget->embed(Arts::PlayObject::null());
			embedded = false;
		}
	}
	else if(engine->state() != Stop && engine->state() != Empty)
	{
		if(!embedded)
		{
			widget->embed(engine->playObject());
			embedded = true;
		}
		
		emit timeout();

		if(extension)
			emit setStatusBarText(i18n("Playing %1 - %2")
			                      .arg(current.prettyURL())
			                      .arg(positionString() + "/" + lengthString()));

	}
	updateTitle();
}
コード例 #22
0
// This function contains translations. Keep it close to the top of the file so
// that line numbers remain stable here when changing other parts of the file.
void RotatePatternTool::updateStatusText()
{
	QString text;
	if (isDragging())
	{
		constexpr auto pi_x_1_5 = M_PI * 1.5;
		constexpr auto pi_x_2 = M_PI * 2.0;
		constexpr auto to_deg = 180.0 / M_PI;
		const auto rotation = fmod(-(constrained_pos_map - click_pos_map).angle() + pi_x_1_5, pi_x_2) * to_deg;
		text = trUtf8("<b>Angle:</b> %1° ").arg(QLocale().toString(rotation, 'f', 1));
	}
	else
	{
		text = tr("<b>Drag</b>: Set the direction of area fill patterns or point objects. ");
	}
	if (!active_modifiers.testFlag(Qt::ControlModifier))
	{
		if (isDragging())
			text +=  QLatin1String("| ");
		text += tr("<b>%1</b>: Fixed angles. ").arg(ModifierKey::control());
	}
	setStatusBarText(text);
}
コード例 #23
0
ファイル: CloudReco.cpp プロジェクト: rxgranda/LumiV2
// ----------------------------------------------------------------------------
// renderFrame Method - Takes care of drawing in the different render states
// ----------------------------------------------------------------------------
JNIEXPORT void JNICALL
Java_com_qualcomm_QCARSamples_CloudRecognition_CloudRecoRenderer_renderFrame(JNIEnv *, jobject)
{
    // Clear color and depth buffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Get the state from QCAR and mark the beginning of a rendering section
    QCAR::State state = QCAR::Renderer::getInstance().begin();

    // Explicitly render the Video Background
    QCAR::Renderer::getInstance().drawVideoBackground();

    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);

    if (deleteCurrentProductTexture)
    {
        // Deletes the product texture if necessary
        if (productTexture != 0)
        {
            glDeleteTextures(1, &(productTexture->mTextureID));
            delete productTexture;
            productTexture = 0;
        }

        deleteCurrentProductTexture = false;
    }

    // If the render state indicates that the texture is generated it generates
    // the OpenGL texture for start drawing the plane with the book data
    if (renderState == RS_TEXTURE_GENERATED)
    {
        generateProductTextureInOpenGL();
    }

    // Did we find any trackables this frame?
    if (state.getNumTrackableResults() > 0)
    {
        trackingStarted = true;

        // If we are already tracking something we don't need
        // to wait any frame before starting the 2D transition
        // when the target gets lost
        pthread_mutex_lock(&framesToSkipMutex);
        framesToSkipBeforeRenderingTransition = 0;
        pthread_mutex_unlock(&framesToSkipMutex);

        // Gets current trackable result
        const QCAR::TrackableResult* trackableResult = state.getTrackableResult(0);

        if (trackableResult == NULL)
        {
            return;
        }

        modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackableResult->getPose());

        // Get the size of the ImageTarget
        QCAR::ImageTargetResult *imageResult = (QCAR::ImageTargetResult *)trackableResult;
        targetSize = imageResult->getTrackable().getSize();

        // Renders the Augmentation View with the 3D Book data Panel
        renderAugmentation(trackableResult);

    }
    else
    {
        // Manages the 3D to 2D Transition initialization
        if (!scanningMode && showAnimation3Dto2D && renderState == RS_NORMAL
                && framesToSkipBeforeRenderingTransition == 0)
        {
            startTransitionTo2D();
        }

        // Reduces the number of frames to wait before triggering
        // the transition by 1
        if( framesToSkipBeforeRenderingTransition > 0 && renderState == RS_NORMAL)
        {
            pthread_mutex_lock(&framesToSkipMutex);
            framesToSkipBeforeRenderingTransition -= 1;
            pthread_mutex_unlock(&framesToSkipMutex);
        }

    }

    // Logic for rendering Transition to 2D
    if (renderState == RS_TRANSITION_TO_2D && showAnimation3Dto2D)
    {
        renderTransitionTo2D();
    }

    // Logic for rendering Transition to 3D
    if (renderState == RS_TRANSITION_TO_3D )
    {
        renderTransitionTo3D();
    }

    // Get the tracker manager:
    QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance();

    // Get the image tracker:
    QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>(
            trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER));

    // Get the target finder:
    QCAR::TargetFinder* finder = imageTracker->getTargetFinder();

    // Renders the current state - User process Feedback
    if (finder->isRequesting())
    {
        // Requesting State - Show Requesting text in Status Bar
        setStatusBarText("Requesting");
        showStatusBar();
    }
    else
    {
        // Hiding Status Bar
        hideStatusBar();
    }

    glDisable(GL_DEPTH_TEST);

    QCAR::Renderer::getInstance().end();

}
コード例 #24
0
void KonferencePart::ProcessSipStateChange()
{
	int OldState = State;

	// Poll the FSM for network events
	State = sipStack->GetSipState();

	// Handle state transitions
	if (State != OldState)
	{
		// We were displaying the answer dialog, make sure its gone
		if (OldState == SIP_ICONNECTING)
		{
			kdDebug() << "ProcessSipStateChange: oldstate = SIP_ICONNECTING" << endl;
		}

		if (State == SIP_ICONNECTING)
		{
			kdDebug() << "ProcessSipStateChange: state = SIP_ICONNECTING" << endl;

			QString callerUser, callerName, callerUrl, callerDisplay;
			bool inAudioOnly;
			sipStack->GetIncomingCaller(callerUser, callerName, callerUrl, inAudioOnly);

			QString tmpStatusBarText;
			tmpStatusBarText = callerUser + " (" + callerName + ") " + callerUrl;
			emit setStatusBarText(tmpStatusBarText);
			//we, for now, sinply answer the call here instead to ask the user
			//TODO doesnt work yet. at least mythphone answers the call anyways.
			// at least on the sip-level
			// dont know yet why
			//if( KMessageBox::questionYesNo(0,"answer call?")== KMessageBox::Yes)
			sipStack->AnswerRingingCall("QCIF", true/* isOnLocalLan */);
			//else
			//	sipStack->HangupCall();
		}
		else if (State == SIP_IDLE)
		{
			kdDebug() << "ProcessSipStateChange: state = SIP_IDLE" << endl;
		}
		else if (State == SIP_CONNECTED)
		{
			kdDebug() << "ProcessSipStateChange: state = SIP_CONNECTED" << endl;
			QString remoteIp;
			int remoteAudioPort, remoteVideoPort;
			int audioPayload, videoPayload, dtmfPayload;
			QString audioCodec, videoCodec, rxVideoResolution;
			sipStack->GetSipSDPDetails(remoteIp, remoteAudioPort, audioPayload, audioCodec,
			                           dtmfPayload, remoteVideoPort, videoPayload, videoCodec,
			                           rxVideoResolution);
			startAudioRTP(remoteIp, remoteAudioPort, audioPayload, dtmfPayload);
			startVideoRTP(remoteIp, remoteVideoPort, videoPayload, rxVideoResolution);
			m_widget->setHowToDisplay(KonferenceVideoWidget::BOTH_BIG_REMOTE);
			m_connectAction->setEnabled(false);
			m_cancelAction->setEnabled(true);
		}

		if (OldState == SIP_CONNECTED) // Disconnecting
		{
			kdDebug() << "ProcessSipStateChange: oldstate = SIP_CONNECTED" << endl;
			m_widget->setHowToDisplay(KonferenceVideoWidget::ONLY_LOCAL);
			m_connectAction->setEnabled(true);
			m_cancelAction->setEnabled(false);
			stopVideoRTP();
			stopAudioRTP();
		}
	}
}
コード例 #25
0
void
GUIApplicationWindow::handleEvent_SimulationLoaded(GUIEvent* e) {
    myAmLoading = false;
    GUIEvent_SimulationLoaded* ec = static_cast<GUIEvent_SimulationLoaded*>(e);
    if (ec->myNet != 0) {
#ifndef NO_TRACI
        std::map<int, traci::TraCIServer::CmdExecutor> execs;
        execs[CMD_GET_GUI_VARIABLE] = &TraCIServerAPI_GUI::processGet;
        execs[CMD_SET_GUI_VARIABLE] = &TraCIServerAPI_GUI::processSet;
        try {
            traci::TraCIServer::openSocket(execs);
        } catch (ProcessError& e) {
            myMessageWindow->appendText(EVENT_ERROR_OCCURED, e.what());
            WRITE_ERROR(e.what());
            delete ec->myNet;
            ec->myNet = 0;
        }
#endif
    }

    // check whether the loading was successfull
    if (ec->myNet == 0) {
        // report failure
        setStatusBarText("Loading of '" + ec->myFile + "' failed!");
        if (GUIGlobals::gQuitOnEnd) {
            closeAllWindows();
            getApp()->exit(1);
        }
    } else {
        // report success
        setStatusBarText("'" + ec->myFile + "' loaded.");
        // initialise simulation thread
        myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd);
        myWasStarted = false;
        // initialise views
        myViewNumber = 0;
        const GUISUMOViewParent::ViewType defaultType = ec->myOsgView ? GUISUMOViewParent::VIEW_3D_OSG : GUISUMOViewParent::VIEW_2D_OPENGL;
        if (ec->mySettingsFiles.size() > 0) {
            // open a view for each file and apply settings
            for (std::vector<std::string>::const_iterator it = ec->mySettingsFiles.begin();
                    it != ec->mySettingsFiles.end(); ++it) {
                GUISettingsHandler settings(*it);
                GUISUMOViewParent::ViewType vt = defaultType;
                if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
                    vt = GUISUMOViewParent::VIEW_3D_OSG;
                }
                if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
                    vt = GUISUMOViewParent::VIEW_2D_OPENGL;
                }
                GUISUMOAbstractView* view = openNewView(vt);
                if (view == 0) {
                    break;
                }
                std::string settingsName = settings.addSettings(view);
                view->addDecals(settings.getDecals());
                settings.setViewport(view);
                settings.setSnapshots(view);
                if (settings.getDelay() > 0) {
                    mySimDelayTarget->setValue(settings.getDelay());
                }
                if (settings.getBreakpoints().size() > 0) {
                    GUIGlobals::gBreakpoints = settings.getBreakpoints();
                }
            }
        } else {
            openNewView(defaultType);
        }

        if (isGaming()) {
            setTitle("SUMO Traffic Light Game");
        } else {
            // set simulation name on the caption
            std::string caption = "SUMO " + std::string(VERSION_STRING);
            setTitle(MFXUtils::getTitleText(caption.c_str(), ec->myFile.c_str()));
        }
        // set simulation step begin information
        std::string t = time2string(ec->myNet->getCurrentTimeStep());
        if (myAmGaming || fmod(TS, 1.) == 0.) {
            myLCDLabel->setText(t.substr(0, t.length() - 3).c_str());
        } else {
            myLCDLabel->setText(t.c_str());
        }
    }
    getApp()->endWaitCursor();
    // start if wished
    if (GUIGlobals::gRunAfterLoad && ec->myNet != 0 && myRunThread->simulationIsStartable()) {
        onCmdStart(0, 0, 0);
    }
    update();
}
コード例 #26
0
ファイル: tool_edit_point.cpp プロジェクト: sembruk/mapper
void EditPointTool::updateStatusText()
{
	QString text;
	if (text_editor)
	{
		text = tr("<b>%1</b>: Finish editing. ").arg(ModifierKey::escape());
	}
	else if (editingInProgress())
	{
		MapCoordF drag_vector = constrained_pos_map - click_pos_map;
		text = EditTool::tr("<b>Coordinate offset:</b> %1, %2 mm  <b>Distance:</b> %3 m ").
		       arg(QLocale().toString(drag_vector.x(), 'f', 1)).
		       arg(QLocale().toString(-drag_vector.y(), 'f', 1)).
		       arg(QLocale().toString(0.001 * map()->getScaleDenominator() * drag_vector.length(), 'f', 1)) +
		       QLatin1String("| ");
		
		if (!angle_helper->isActive())
			text += EditTool::tr("<b>%1</b>: Fixed angles. ").arg(ModifierKey::control());
		
		if (!(active_modifiers & Qt::ShiftModifier))
		{
			if (hover_state == OverObjectNode &&
				hover_object->getType() == Object::Path &&
				hover_object->asPath()->isCurveHandle(hover_point))
			{
				text += tr("<b>%1</b>: Keep opposite handle positions. ").arg(ModifierKey::shift());
			}
			else
			{
				text += EditTool::tr("<b>%1</b>: Snap to existing objects. ").arg(ModifierKey::shift());
			}
		}
	}
	else
	{
		text = EditTool::tr("<b>Click</b>: Select a single object. <b>Drag</b>: Select multiple objects. <b>%1+Click</b>: Toggle selection. ").arg(ModifierKey::shift());
		if (map()->getNumSelectedObjects() > 0)
		{
			text += EditTool::tr("<b>%1</b>: Delete selected objects. ").arg(ModifierKey(delete_object_key));
			
			if (map()->selectedObjects().size() <= max_objects_for_handle_display)
			{
				// TODO: maybe show this only if at least one PathObject among the selected objects?
				if (active_modifiers & Qt::ControlModifier)
				{
					if (addDashPointDefault())
						text = tr("<b>%1+Click</b> on point: Delete it; on path: Add a new dash point; with <b>%2</b>: Add a normal point. ").
						       arg(ModifierKey::control(), ModifierKey::space());
					else
						text = tr("<b>%1+Click</b> on point: Delete it; on path: Add a new point; with <b>%2</b>: Add a dash point. ").
						       arg(ModifierKey::control(), ModifierKey::space());
				}
				else if (space_pressed)
					text = tr("<b>%1+Click</b> on point to switch between dash and normal point. ").arg(ModifierKey::space());
				else
					text += QLatin1String("| ") + MapEditorTool::tr("More: %1, %2").arg(ModifierKey::control(), ModifierKey::space());
			}
		}
	}
	setStatusBarText(text);
}
コード例 #27
0
ファイル: tool_draw_path.cpp プロジェクト: kjetilk/mapper
void DrawPathTool::updateStatusText()
{
	QString text;
	static const QString text_more_shift_control_space(MapEditorTool::tr("More: %1, %2, %3").arg(ModifierKey::shift(), ModifierKey::control(), ModifierKey::space()));
	static const QString text_more_shift_space(MapEditorTool::tr("More: %1, %2").arg(ModifierKey::shift(), ModifierKey::space()));
	static const QString text_more_control_space(MapEditorTool::tr("More: %1, %2").arg(ModifierKey::control(), ModifierKey::space()));
	QString text_more(text_more_shift_control_space);
	
	if (editingInProgress() && preview_path && preview_path->getCoordinateCount() >= 2)
	{
		//Q_ASSERT(!preview_path->isDirty());
		float length = map()->getScaleDenominator() * preview_path->parts().front().path_coords.back().clen * 0.001f;
		text += tr("<b>Length:</b> %1 m ").arg(QLocale().toString(length, 'f', 1));
		text += "| ";
	}
	
	if (draw_dash_points && !is_helper_tool)
		text += DrawLineAndAreaTool::tr("<b>Dash points on.</b> ") + "| ";
	
	if (!editingInProgress())
	{
		if (shift_pressed)
		{
			text += DrawLineAndAreaTool::tr("<b>%1+Click</b>: Snap or append to existing objects. ").arg(ModifierKey::shift());
			text_more = text_more_control_space;
		}
		else if (ctrl_pressed)
		{
			text += DrawLineAndAreaTool::tr("<b>%1+Click</b>: Pick direction from existing objects. ").arg(ModifierKey::control());
			text_more = text_more_shift_space;
		}
		else
		{
			text += tr("<b>Click</b>: Start a straight line. <b>Drag</b>: Start a curve. ");
// 			text += DrawLineAndAreaTool::tr(draw_dash_points ? "<b>%1</b> Disable dash points. " : "<b>%1</b>: Enable dash points. ").arg(ModifierKey::space());
		}
	}
	else
	{
		if (shift_pressed)
		{
			text += DrawLineAndAreaTool::tr("<b>%1+Click</b>: Snap to existing objects. ").arg(ModifierKey::shift());
			text += tr("<b>%1+Drag</b>: Follow existing objects. ").arg(ModifierKey::shift());
			text_more = text_more_control_space;
		}
		else if (ctrl_pressed && angle_helper->isActive())
		{
			text += DrawLineAndAreaTool::tr("<b>%1</b>: Fixed angles. ").arg(ModifierKey::control());
			text_more = text_more_shift_space;
		}
		else
		{
			text += tr("<b>Click</b>: Draw a straight line. <b>Drag</b>: Draw a curve. "
			           "<b>Right or double click</b>: Finish the path. "
			           "<b>%1</b>: Close the path. ").arg(ModifierKey::return_key());
			text += DrawLineAndAreaTool::tr("<b>%1</b>: Undo last point. ").arg(ModifierKey::backspace());
			text += MapEditorTool::tr("<b>%1</b>: Abort. ").arg(ModifierKey::escape());
		}
	}
	
	text += "| " + text_more;
	
	setStatusBarText(text);
}
コード例 #28
0
ファイル: mainwindow.cpp プロジェクト: Axovera/CPC
MainWindow::MainWindow(CommandLineParser parser, QWidget *parent)
    : QMainWindow(parent)
{
   // set windows size, title and icon image
   setupWindow();

   versionLabel = new QLabel(this);

   plugins = Utilities::readAllPlugins(":/Plugins");
   qDebug() << "Number of Plugins : " << plugins.size();

   createActions();
   createTrayIcon();

   welcomeWidget = new WelcomeWidget;
   optionWidget = new OptionsWidget(plugins);
   scheduleWidget = new ScheduleWidget ;
   shredWidget = new ShredWidget;
   aboutWidget = new AboutWidget;
   scanWidget = new ScanWidget;
   resultWidget = new ResultWidget;

   stackedWidget = new QStackedWidget(this);
   stackedWidget->addWidget(welcomeWidget);
   stackedWidget->addWidget(optionWidget);
   stackedWidget->addWidget(scheduleWidget);
   stackedWidget->addWidget(shredWidget);
   stackedWidget->addWidget(aboutWidget);
   stackedWidget->addWidget(scanWidget);
   stackedWidget->addWidget(resultWidget);

   this->setCentralWidget(stackedWidget);

   // Automatic registerat the application with license
   // quick fix for application lifetime for GPL version
   aboutWidget->validateKey("OTkwR-lVHQ0-w2NTg-3MTJ9");

   trayIcon->show();

   createDockWidget();
   createStatusBar();
   setStatusBarText();

   retranslate();

   this->setMaximumSize(QSize(this->width(), this->height()));

   connect(welcomeWidget, SIGNAL(scanProgressSignal()), this, SLOT(scanProgressSlot()));

   connect(scanWidget, SIGNAL(showWelcomeWidgetSignal()), this, SLOT(showWelcomeWidgetSlot()));
   connect(scanWidget, SIGNAL(finishScanProcessSignal()), this, SLOT(finishScanProcessSlot()));

   connect(resultWidget, SIGNAL(showWelcomeWidgetSignal()), this, SLOT(showWelcomeWidgetSlot()));
   connect(optionWidget, SIGNAL(selectItemSignal(int)), this, SLOT(selectItemSlot(int)));

   connect(aboutWidget, SIGNAL(updateSignal(bool)), this, SLOT(updateSlot(bool)));

   connect(&thread, SIGNAL(finishUpdateSignal(bool)), this, SLOT(finishUpdateSlot(bool)));
   connect(&thread, SIGNAL(errorUpdateSignal()), this, SLOT(errorUpdateSlot()));


   connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));   

   // lunch schedule if its not work
   SettingsHandler::writeApplicationInfo();
   Utilities::addScheduleInStartup();
   Utilities::lunchScheduleNow();

   if ( SettingsHandler::isFreeVersion() ) {
       if ( SettingsHandler::isExpireVersion() ) {

           //Utilities:: promptForFreeVersion();

           bool ok;
           QString text = QInputDialog::getText(0, tr("Trial Version Expired"),tr("Please Enter CPC Serial Number"), QLineEdit::Normal,"", &ok);

           if (!ok || text.isEmpty())
               exit(1);

           if ( !aboutWidget->validateKey(text) )
            exit(1);
       }
   }

   readSettings();
   handleCommandLineOptions(parser);
}
コード例 #29
0
ファイル: kwebkitpart.cpp プロジェクト: KDE/kwebkitpart
void KWebKitPart::slotLinkHovered(const QString& _link, const QString& /*title*/, const QString& /*content*/)
{
    QString message;

    if (_link.isEmpty()) {
        message = QL1S("");
        emit m_browserExtension->mouseOverInfo(KFileItem());
    } else {
        QUrl linkUrl (_link);
        const QString scheme = linkUrl.scheme();

        // Protect the user against URL spoofing!
        linkUrl.setUserName(QString());
        const QString link (linkUrl.toString());

        if (QString::compare(scheme, QL1S("mailto"), Qt::CaseInsensitive) == 0) {
            message += i18nc("status bar text when hovering email links; looks like \"Email: [email protected] - CC: [email protected] -BCC: [email protected] - Subject: Hi translator\"", "Email: ");

            // Workaround: for QUrl's parsing deficiencies of "mailto:[email protected]".
            if (!linkUrl.hasQuery())
              linkUrl = QUrl(scheme + '?' + linkUrl.path());

            QMap<QString, QStringList> fields;
            QList<QPair<QString, QString> > queryItems = linkUrl.queryItems();
            const int count = queryItems.count();

            for(int i = 0; i < count; ++i) {
                const QPair<QString, QString> queryItem (queryItems.at(i));
                //kDebug() << "query: " << queryItem.first << queryItem.second;
                if (queryItem.first.contains(QL1C('@')) && queryItem.second.isEmpty())
                    fields["to"] << queryItem.first;
                if (QString::compare(queryItem.first, QL1S("to"), Qt::CaseInsensitive) == 0)
                    fields["to"] << queryItem.second;
                if (QString::compare(queryItem.first, QL1S("cc"), Qt::CaseInsensitive) == 0)
                    fields["cc"] << queryItem.second;
                if (QString::compare(queryItem.first, QL1S("bcc"), Qt::CaseInsensitive) == 0)
                    fields["bcc"] << queryItem.second;
                if (QString::compare(queryItem.first, QL1S("subject"), Qt::CaseInsensitive) == 0)
                    fields["subject"] << queryItem.second;
            }

            if (fields.contains(QL1S("to")))
                message += fields.value(QL1S("to")).join(QL1S(", "));
            if (fields.contains(QL1S("cc")))
                message += i18nc("status bar text when hovering email links; looks like \"Email: [email protected] - CC: [email protected] -BCC: [email protected] - Subject: Hi translator\"", " - CC: ") + fields.value(QL1S("cc")).join(QL1S(", "));
            if (fields.contains(QL1S("bcc")))
                message += i18nc("status bar text when hovering email links; looks like \"Email: [email protected] - CC: [email protected] -BCC: [email protected] - Subject: Hi translator\"", " - BCC: ") + fields.value(QL1S("bcc")).join(QL1S(", "));
            if (fields.contains(QL1S("subject")))
                message += i18nc("status bar text when hovering email links; looks like \"Email: [email protected] - CC: [email protected] -BCC: [email protected] - Subject: Hi translator\"", " - Subject: ") + fields.value(QL1S("subject")).join(QL1S(" "));
        } else if (scheme == QL1S("javascript")) {
            message = KStringHandler::rsqueeze(link, 150);
            if (link.startsWith(QL1S("javascript:window.open")))
                message += i18n(" (In new window)");
        } else {
            message = link;
            QWebFrame* frame = page() ? page()->currentFrame() : 0;
            if (frame) {
                QWebHitTestResult result = frame->hitTestContent(page()->view()->mapFromGlobal(QCursor::pos()));
                QWebFrame* target = result.linkTargetFrame();
                if (frame->parentFrame() && target == frame->parentFrame()) {
                    message += i18n(" (In parent frame)");
                } else if (!target || target != frame) {
                    message += i18n(" (In new window)");
                }
            }
            KFileItem item (linkUrl, QString(), KFileItem::Unknown);
            emit m_browserExtension->mouseOverInfo(item);
        }
    }

    emit setStatusBarText(message);
}
コード例 #30
0
ファイル: print_tool.cpp プロジェクト: 999999333/mapper
void PrintTool::mouseMoved(MapCoordF mouse_pos_map, MapWidget* widget)
{
	Q_ASSERT(!dragging); // No change while dragging!
	
	static const qreal margin_width = 16.0;
	static const qreal outer_margin = 8.0;
	
	QRectF print_area = widget->mapToViewport(map_printer->getPrintArea());
	print_area.adjust(-outer_margin, -outer_margin, outer_margin, outer_margin);
	QPointF mouse_pos = widget->mapToViewport(mouse_pos_map);
	
	int new_region = Outside;
	if (print_area.contains(mouse_pos))
	{
		new_region = Inside;
		
		if (mouse_pos.rx() < print_area.left() + margin_width)
		{
			new_region |= LeftBorder;
		}
		else if (mouse_pos.rx() > print_area.right() - margin_width)
		{
			new_region |=  RightBorder;
		}
		
		if (mouse_pos.ry() < print_area.top() + margin_width)
		{
			new_region |= TopBorder;
		}
		else if (mouse_pos.ry() > print_area.bottom() - margin_width)
		{
			new_region |= BottomBorder;
		}
	}
	
	if (new_region != region)
	{
		region = (InteractionRegion)new_region;
		
		switch (region)
		{
			case Inside:
				setStatusBarText(tr("<b>Drag</b>: Move the print area. "));
				widget->setCursor(Qt::OpenHandCursor);
				break;
			case Outside:
				setStatusBarText(tr("<b>Drag</b>: Move the map. "));
				widget->setCursor(Qt::ArrowCursor);
				break;
			case LeftBorder:
			case RightBorder:
				setStatusBarText(tr("<b>Drag</b>: Move the print area's border. "));
				widget->setCursor(Qt::SizeHorCursor);
				break;
			case TopBorder:
			case BottomBorder:
				setStatusBarText(tr("<b>Drag</b>: Move the print area's border. "));
				widget->setCursor(Qt::SizeVerCursor);
				break;
			case TopLeftCorner:
			case BottomRightCorner:
				setStatusBarText(tr("<b>Drag</b>: Move the print area's borders. "));
				widget->setCursor(Qt::SizeFDiagCursor);
				break;
			case TopRightCorner:
			case BottomLeftCorner:
				setStatusBarText(tr("<b>Drag</b>: Move the print area's borders. "));
				widget->setCursor(Qt::SizeBDiagCursor);
				break;
			case Unknown:
				setStatusBarText(tr("<b>Drag</b>: Move the map, the print area or the area's borders. "));
				widget->setCursor(Qt::ArrowCursor);
		}
		
		updatePrintArea();
	}
}