Exemplo n.º 1
0
QVariant Package::data(int role) const {
    switch (role) {
    case CategoryRole:
        return category();
    case CreateSubfolderRole:
        return createSubfolder();
    case ErrorStringRole:
        return errorString();
    case IdRole:
        return id();
    case NameRole:
        return name();
    case PriorityRole:
        return priority();
    case PriorityStringRole:
        return priorityString();
    case ProgressRole:
        return progress();
    case ProgressStringRole:
        return progressString();
    case StatusRole:
        return status();
    case StatusStringRole:
        return statusString();
    case SuffixRole:
        return suffix();
    default:
        return TransferItem::data(role);
    }
}
Exemplo n.º 2
0
QMap<int, QVariant> Package::itemData() const {
    QMap<int, QVariant> map = TransferItem::itemData();
    map[CategoryRole] = category();
    map[CreateSubfolderRole] = createSubfolder();
    map[ErrorStringRole] = errorString();
    map[IdRole] = id();
    map[NameRole] = name();
    map[PriorityRole] = priority();
    map[PriorityStringRole] = priorityString();
    map[ProgressRole] = progress();
    map[ProgressStringRole] = progressString();
    map[StatusRole] = status();
    map[StatusStringRole] = statusString();
    map[SuffixRole] = suffix();
    return map;
}
Exemplo n.º 3
0
QVariantMap Package::itemDataWithRoleNames() const {
    QVariantMap map = TransferItem::itemDataWithRoleNames();
    map[roleNames().value(CategoryRole)] = category();
    map[roleNames().value(CreateSubfolderRole)] = createSubfolder();
    map[roleNames().value(ErrorStringRole)] = errorString();
    map[roleNames().value(IdRole)] = id();
    map[roleNames().value(NameRole)] = name();
    map[roleNames().value(PriorityRole)] = priority();
    map[roleNames().value(PriorityStringRole)] = priorityString();
    map[roleNames().value(ProgressRole)] = progress();
    map[roleNames().value(ProgressStringRole)] = progressString();
    map[roleNames().value(StatusRole)] = status();
    map[roleNames().value(StatusStringRole)] = statusString();
    map[roleNames().value(SuffixRole)] = suffix();
    return map;
}
Exemplo n.º 4
0
HWND
D3D11Client::clbkCreateRenderWindow()
{
    oapiWriteLogV("D3D11Client::clbkCreateRenderWindow");
    WLOG2( APP_TITLE" is starting up..." );

    // Must callback to base
    m_hWindow = oapi::GraphicsClient::clbkCreateRenderWindow();
    /*auto currStyle = GetWindowLong(m_hWindow, GWL_STYLE);
    auto currExStyle = GetWindowLong(m_hWindow, GWL_EXSTYLE);
    auto style = WS_POPUP;
    auto exStyle = WS_EX_TOPMOST;*/
    SetWindowTextA( m_hWindow, "- "APP_TITLE );

    // Get Windows display settings
    EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, &m_CurrentMode);

    // Get the user preferences for video in Orbiter Launchpad
    auto data = GetVideoData();
    if (!data->fullscreen) {
        // Fullscreen not requested by Orbinaut, so we store whatever dimensions the current
        // window has.
        WINDOWINFO winfo;
        winfo.cbSize = sizeof( WINDOWINFO );
        GetWindowInfo( m_hWindow, &winfo );
        m_Config.clientWidth = abs( winfo.rcClient.right - winfo.rcClient.left );
        m_Config.clientHeight = abs( winfo.rcClient.bottom - winfo.rcClient.top );
    }
    else {
        // Fullscreen requested, apparently we do not do a true FullScreen
        // The window is simply enlarged according to the dimensions in 'data' to
        // cover the entire screen but is still movable. Hence the MoveWindow()

        // First a style setting, window should stay on top
        auto currExStyle = GetWindowLong(m_hWindow, GWL_EXSTYLE);
        currExStyle |= WS_EX_TOPMOST;
        SetWindowLong(m_hWindow, GWL_EXSTYLE, currExStyle);

        // Get window 'fullscreen' dims from data, here the dims in 'data' will
        // be the user set dims(Check). We retrieve the user preferred dims and
        // impose it on the window.
        m_Config.clientWidth = data->winw;
        m_Config.clientHeight = data->winh;
        if (m_CurrentMode.dmPelsWidth != m_Config.clientWidth ||
                m_CurrentMode.dmPelsHeight != m_Config.clientHeight) {

            DEVMODE mode;
            CopyMemory(&mode, &m_CurrentMode, sizeof(DEVMODE));
            mode.dmBitsPerPel = 32;
            mode.dmPelsWidth = m_Config.clientWidth;
            mode.dmPelsHeight = m_Config.clientHeight;
            mode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
            ChangeDisplaySettings(&mode, 0);
            m_bModeChanged = true;
        }
        MoveWindow(m_hWindow, 0, 0, m_Config.clientWidth, m_Config.clientHeight, true);
    }
	m_Config.fAspect = (float)m_Config.clientWidth / (float)m_Config.clientHeight;

	// Enumerate devices if not done already
    if( !m_bEnumerate ) {
    //    Device enumeration always fails when placed before clbkCreateRenderWindow).
        m_Config.enumerateDisplaysCreateD3DDevice( GetVideoData() );
        m_Config.loadConfig();
        m_bEnumerate = true;
    }

    // The config was changed above, some dependent properties may need updating
    m_Config.applyConfig();

    // Create the Scene & initialize it
    m_pScene = new Rendering::Scene(*this);
    m_pScene->init3D();
	
	// TODO: See how this works !
    progressString("Scene Allocated", 2);   

    return m_hWindow;
}
Exemplo n.º 5
0
void ProgressMonitor::run() {
	cout << clear_to_eos;
	while (active()) {
		cout << show_cursor( FALSE );
		boost::mutex::scoped_lock l(mutex);
		unsigned maxLength = 0;
		for (unsigned u = 0; u < ProgressBars.size(); u++)
			maxLength = maxLength < ProgressBars[u]->title.size() ? ProgressBars[u]->title.size() : maxLength;
		cout << cursor_up(eraseLines);
		for (unsigned u = 0; u < ProgressBars.size(); u++) {
			cout << setw(maxLength + 1) << setfill(' ') << left << ProgressBars[u]->title << ": " << progressString(
					ProgressBars[u]) << endl;
		}
		eraseLines = ProgressBars.size();
		boost::posix_time::seconds workTime(1);
		boost::this_thread::sleep(workTime);
	}
	cout << finalize;
}