INT_PTR CALLBACK MsgBox::dialogProc( HWND hwnd, UINT msg, WPARAM w, LPARAM l )
{
	switch( msg )
	{
	case WM_INITDIALOG:
		wndMap_[ hwnd ] = (MsgBox*)l;
		msgMap_[ (MsgBox*)l ] = hwnd;
		wndMap_[ hwnd ]->create( hwnd );
		if( wndMap_[ hwnd ]->timeOut_ != INFINITE )
			SetTimer( hwnd, 1, wndMap_[ hwnd ]->timeOut_, NULL );
		centerWindow( hwnd );
		break;
	case WM_TIMER:
		wndMap_[ hwnd ]->result_ = TIME_OUT;
		wndMap_[ hwnd ]->kill( hwnd );
		break;
	case WM_DESTROY:
		msgMap_.erase( msgMap_.find( wndMap_[ hwnd ] ) );
		wndMap_.erase( wndMap_.find( hwnd ) );
		break;
	case WM_COMMAND:
		wndMap_[ hwnd ]->result_ = (unsigned int)w;
		wndMap_[ hwnd ]->kill( hwnd );
		break;
	}
	return FALSE;
}
Beispiel #2
0
void CCEGLView::setFrameSize(float width, float height)
{
    CCEGLViewProtocol::setFrameSize(width, height);

    resize(width, height); // adjust window size for menubar
    centerWindow();
}
Beispiel #3
0
void CCEGLView::setFrameZoomFactor(float fZoomFactor)
{
    m_fFrameZoomFactor = fZoomFactor;
    resize(m_obScreenSize.width * fZoomFactor, m_obScreenSize.height * fZoomFactor);
    centerWindow();
	CAApplication::getApplication()->setProjection(CAApplication::getApplication()->getProjection());
}
Beispiel #4
0
void CCEGLView::setFrameZoomFactor(float fZoomFactor)
{
    m_fFrameZoomFactor = fZoomFactor;
    resize(m_obScreenSize.width * fZoomFactor, m_obScreenSize.height * fZoomFactor);
    centerWindow();
    CCDirector::sharedDirector()->setProjection(CCDirector::sharedDirector()->getProjection());
}
Beispiel #5
0
void GLView::setFrameZoomFactor(float fZoomFactor)
{
//    CCTRACE();
    m_fFrameZoomFactor = fZoomFactor;
    resize(_screenSize.width * fZoomFactor, _screenSize.height * fZoomFactor);
    centerWindow();
    Director::getInstance()->setProjection(Director::getInstance()->getProjection());
}
Beispiel #6
0
bool CCEGLView::setContentScaleFactor(float contentScaleFactor)
{
    CCEGLViewProtocol::setContentScaleFactor(contentScaleFactor);
    resize((int)(m_obScreenSize.width * contentScaleFactor), (int)(m_obScreenSize.height * contentScaleFactor));
    centerWindow();
    
    return true;
}
Beispiel #7
0
void CCEGLView::setFrameSize(float width, float height)
{
    Create((LPCTSTR)m_szViewName, (int)width, (int)height);
    CCEGLViewProtocol::setFrameSize(width, height);

    resize(width, height); // adjust window size for menubar
    centerWindow();
}
    GameSettings::GameSettings()
        : AbstractWindow("gamesettings.xml", WIT_MOUSE_INPUT)
    {
        // Register sound driver components
        std::list<SoundDriver*> soundDriverList = SoundManager::getSingleton().getDriverList();

        for (std::list<SoundDriver*>::iterator it = soundDriverList.begin();
             it != soundDriverList.end(); it++)
        {
            if ((*it)->isDriverPlugin())
            {
                //registerSoundDriverConfig((*it)->getConfigComponent());
            }
        }

        // Connect actions to callbacks
        getWindow()->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,
                                    boost::bind(&GameSettings::onCancel, this));

        mVideoRenderer = getCombobox("GameOptionsWindow/Video/Renderer");
        mVideoResolution = getCombobox("GameOptionsWindow/Video/Resolution");
        mVideoFullscreen = getCheckbox("GameOptionsWindow/Video/Fullscreen");
        
        mVideoColorDepth32 = getRadioButton("GameOptionsWindow/Video/ColorDepth/32");
        mVideoColorDepth32->setUserData(new Ogre::String("32"));
        mVideoColorDepth32->setGroupID(1);
        mVideoColorDepth16 = getRadioButton("GameOptionsWindow/Video/ColorDepth/16");
        mVideoColorDepth16->setUserData(new Ogre::String("16"));
        mVideoColorDepth16->setGroupID(1);
        
        mVideoFsaa0 = getRadioButton("GameOptionsWindow/Video/FSAA/Off");
        mVideoFsaa0->setUserData(new Ogre::String("0"));
        mVideoFsaa0->setGroupID(2);
        mVideoFsaa2 = getRadioButton("GameOptionsWindow/Video/FSAA/2x");
        mVideoFsaa2->setUserData(new Ogre::String("2"));
        mVideoFsaa2->setGroupID(2);
        mVideoFsaa4 = getRadioButton("GameOptionsWindow/Video/FSAA/4x");
        mVideoFsaa4->setUserData(new Ogre::String("4"));
        mVideoFsaa4->setGroupID(2);
        mVideoFsaa8 = getRadioButton("GameOptionsWindow/Video/FSAA/8x");
        mVideoFsaa8->setUserData(new Ogre::String("8"));
        mVideoFsaa8->setGroupID(2);
        
        mVideoRttModeFBO = getRadioButton("GameOptionsWindow/Video/RTT/FBO");
        mVideoRttModeFBO->setUserData(new Ogre::String("FBO"));
        mVideoRttModeFBO->setGroupID(3);
        mVideoRttModePBuffer = getRadioButton("GameOptionsWindow/Video/RTT/PBuffer");
        mVideoRttModePBuffer->setUserData(new Ogre::String("PBuffer"));
        mVideoRttModePBuffer->setGroupID(3);
        mVideoRttModeCopy = getRadioButton("GameOptionsWindow/Video/RTT/Copy");
        mVideoRttModeCopy->setUserData(new Ogre::String("Copy"));
        mVideoRttModeCopy->setGroupID(3);
        
        centerWindow();
        setVisible(false);
        update();
    }
Beispiel #9
0
void Window::openWindow()
{
  if (!getParent()) {
    if (m_isAutoRemap)
      centerWindow();

    Manager::getDefault()->_openWindow(this);
  }
}
Beispiel #10
0
void CCEGLView::setFrameSize(float width, float height)
{
    CCEGLViewProtocol::setFrameSize(width, height);

    resize(width, height); // adjust window size for menubar
#ifndef WUKONG_STUDIO
    centerWindow();
#endif
}
Beispiel #11
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    app.setApplicationName("puzzleSEQ client");

	MainWindow window;
	centerWindow(window);
	window.show();

    return app.exec();
}
Beispiel #12
0
void GameModeOptions::doResize(float w, float h)
{
    centerWindow(&winOptions.window);
	centerWindow(&winOptions.winOptionsGeneral.window);
	centerWindow(&winOptions.winOptionsConsole.window);
	centerWindow(&winOptions.winOptionsGraphics.window);
	centerWindow(&winOptions.winOptionsGraphicsAdvanced.window);
	centerWindow(&winOptions.winOptionsHotkeys.window);
    centerWindow(&winOptions.winOptionsNetwork.window);
}
Beispiel #13
0
//-------------------------------------------------------------------------------------
// Name: MainWindow()
// Desc: Constructor
//-------------------------------------------------------------------------------------
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    QSettings settings;
    playerFirst = settings.value("PlayerFirst", true).toBool();
    playerX = settings.value("PlayerX", true).toBool();

    ui->setupUi(this);
    setupActions();
    centerWindow();

}
Beispiel #14
0
void ContractForm::on_pushButtonTick_clicked()
{
    QString symbol = ui->lineEditSymbol->text();
    QString exchange = ui->lineEditExchange->text();

    if (symbol.length() != 0 && exchange.length() != 0) {
        TickForm* form = new TickForm();
        form->setWindowFlags(Qt::Window);
        form->init(symbol, exchange);
        centerWindow(form);
        form->show();
    }
}
Beispiel #15
0
void CCEGLView::setContentScaleFactor(float contentScaleFactor)
{
    m_fScreenScaleFactor = contentScaleFactor;
    if (m_bOrientationReverted)
    {
        resize((int)(m_tSizeInPoints.cy * contentScaleFactor), (int)(m_tSizeInPoints.cx * contentScaleFactor));
    }
    else
    {
        resize((int)(m_tSizeInPoints.cx * contentScaleFactor), (int)(m_tSizeInPoints.cy * contentScaleFactor));
    }
    centerWindow();
}
Beispiel #16
0
void ContractForm::on_pushButtonBar_clicked()
{
    QString symbol = ui->lineEditSymbol->text();
    QString exchange = ui->lineEditExchange->text();
    int period = ui->comboBox->currentIndex() + 1;

    if (symbol.length() != 0 && exchange.length() != 0) {
        BarForm* form = new BarForm();
        form->setWindowFlags(Qt::Window);
        form->init(symbol, exchange, period);
        centerWindow(form);
        form->show();
    }
}
    GameSaveLoadWindow::GameSaveLoadWindow() :
        AbstractWindow("gamesaveloadwindow.xml", WIT_MOUSE_INPUT | WIT_KEYBOARD_INPUT)
    {
        // Get a access to the filename edit box
        mFilename = getEditbox("GameSaveLoadWindow/FileSheet/Filename");
        RlAssert(mFilename != NULL, "GameSaveLoadWindow/FileSheet/Filename is null");

        mFilename->activate();

        // Get a access to the savegame table
        mSaveGameTable = getMultiColumnList("GameSaveLoadWindow/FileSheet/SaveGameTable");
        RlAssert(mSaveGameTable != NULL, "GameSaveLoadWindow/FileSheet/SaveGameTable is null");

        mSaveGameTable->addColumn( (utf8*)"Filename", 0, cegui_reldim(0.65));
        mSaveGameTable->addColumn( (utf8*)"Date", 1, cegui_reldim(0.35));

        mSaveGameTable->setSelectionMode(MultiColumnList::RowSingle);
        mSaveGameTable->subscribeEvent(MultiColumnList::EventSelectionChanged, boost::bind(&GameSaveLoadWindow::handleSelectSaveGame, this));

        centerWindow();

        getPushButton("GameSaveLoadWindow/ButtonSheet/LoadButton")->subscribeEvent(
        CEGUI::Window::EventMouseClick,
        boost::bind(
            &GameSaveLoadWindow::handleLoadEvent,
            this
        ));

        getPushButton("GameSaveLoadWindow/ButtonSheet/SaveButton")->subscribeEvent(
        CEGUI::Window::EventMouseClick,
        boost::bind(
            &GameSaveLoadWindow::handleSaveEvent,
            this
        ));

        getPushButton("GameSaveLoadWindow/ButtonSheet/DeleteButton")->subscribeEvent(
        CEGUI::Window::EventMouseClick,
        boost::bind(
            &GameSaveLoadWindow::handleDeleteEvent,
            this
        ));

        bindDestroyWindowToXButton();
        bindDestroyWindowToClick(getWindow("GameSaveLoadWindow/ButtonSheet/CancelButton"));

        mSelectionColour = CEGUI::ListboxItem::DefaultSelectionColour;
        mSelectionImageset = "RastullahLook-Images";
        mSelectionBrush = "ListboxSelectionBrush";
    }
	LogWindow::LogWindow()
		: CeGuiWindow("logwindow.xml", WND_MOUSE_INPUT)
	{
		mRastullahLog = getMultiLineEditbox("LogWindow/RastullahLog/Text");
		mOgreLog = getMultiLineEditbox("LogWindow/OgreLog/Text");
		mErrorLog = getMultiLineEditbox("LogWindow/ErrorLog/Text");

		getWindow("LogWindow/UpdateButton")->subscribeEvent(
			CEGUI::Window::EventMouseClick,
			boost::bind(&LogWindow::update, this));
		bindCloseToCloseButton();
		bindClickToCloseWindow(getWindow("LogWindow/CloseButton"));

		centerWindow();
	}
Beispiel #19
0
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
{
	int argc;
	LPTSTR *argv = CommandLineToArgvW(pCmdLine, &argc);

	TCHAR path[MAX_PATH];
	GetModuleFileName(NULL, path, MAX_PATH);
	auto length = wcslen(path);
	if (!wmemcmp(argv[0], path, length))
	{
		MessageBox(NULL, TEXT("This app is designed to start another app."), TEXT("Error"), MB_OK);
		return 1;
	}

	STARTUPINFO si = { 0 };
	si.cb = sizeof(STARTUPINFO);
	si.dwFlags = STARTF_USESHOWWINDOW;
	si.wShowWindow = SW_HIDE;

	PROCESS_INFORMATION pi = { 0 };

	if (!CreateProcess(argv[0], NULL, NULL, NULL, FALSE, NULL, NULL, NULL, &si, &pi))
	{
		return 2;
	}

	while (!g_hWnd)
	{
		EnumWindows(EnumWindowsProc, pi.dwProcessId);
	}

	auto hWnd = g_hWnd;
	centerWindow(hWnd);
	SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);

	float percentage = 1;
	if (argc >= 2)
	{
		swscanf(argv[1], L"%f", &percentage);
	}
	SetLayeredWindowAttributes(hWnd, 0, static_cast<BYTE>(255 * percentage), LWA_ALPHA);
	SetForegroundWindow(hWnd);
	ShowWindow(hWnd, SW_SHOW);

	return 0;
}
Beispiel #20
0
void StatForm::on_pushButtonShowData_clicked()
{
    QString symbol = ui->lineEditSymbol->text();
    QString exchange = ui->lineEditExchange->text();
    QString period = ui->lineEditPeriod->text();

    if (symbol.length() != 0 && exchange.length() != 0 && period.length() != 0) {
        if (period == "tick") {
            TickForm* form = new TickForm();
            form->setWindowFlags(Qt::Window);
            form->init(symbol, exchange);
            centerWindow(form);
            form->show();
        } else {
        }
    }
}
Beispiel #21
0
void CCEGLView::setFrameSize(float width, float height)
{
	width /= 2;
	height /= 2;
    CCEGLViewProtocol::setFrameSize(width, height);

	if (width / height > 1.25f)
	{
		this->setStatusBarOrientation(CAInterfaceOrientationLandscape);
	}
	else
	{
		this->setStatusBarOrientation(CAInterfaceOrientationPortrait);
	}
    resize(width, height); // adjust window size for menubar
    centerWindow();
}
Beispiel #22
0
mainView::mainView(QWidget *parent)
    : QWidget(parent), ui(new Ui::mainView)
{
    ui->setupUi(this);

    ui->lineEdit->setEmptyMessage("Type 'mibit' to see what happens");

    tip1 = new MibitTip(this, ui->lineEdit, "tip.svg",QPixmap("important.png") );
    tip3 = new MibitTip(this, ui->btnTest3, "tip.svg", QPixmap("important.png"), tpAbove );

    dialog1 = new MibitDialog(this,"Nothing","dialog-theme.opaque.svg",QPixmap("face-smile.png"), atSlideDown );
    dialog1->setSize(300,150);


    floatPanel = new MibitFloatPanel(this,"rotated_panel.svg", Bottom);
    floatPanel->setSize(350,200);
    floatPanel->addWidget(ui->toFloat);
    QTimer::singleShot(3000,floatPanel,SLOT(showPanel()));

    notifier = new MibitNotifier(this,"notifier.svg",QPixmap("information.png"));//onTop = true

    connect(ui->btnClosePanel, SIGNAL(clicked()), floatPanel, SLOT(hideOnUserRequest()));
    connect(ui->btnQuit, SIGNAL(clicked()),qApp, SLOT(quit()));
    ui->slider->setRange(0,100);
    connect(ui->slider, SIGNAL(valueChanged(int)), ui->progressBar, SLOT(setValue(int)));

    connect(ui->btnTest1, SIGNAL(clicked()), SLOT(showTip1()));
    connect(ui->btnTest3, SIGNAL(clicked()), SLOT(showTip3()));

    connect(ui->btnDialog1, SIGNAL(clicked()), SLOT(showDialog1()));
    connect(ui->btnDialog2, SIGNAL(clicked()), SLOT(showDialog2()));
    connect(ui->btnDialog3, SIGNAL(clicked()), SLOT(showDialog3()));
    connect(ui->btnDialog4, SIGNAL(clicked()), SLOT(showDialog4()));

    connect(ui->btnNotify, SIGNAL(clicked()), this, SLOT(showNotify()) );
    connect(ui->btnNotify2, SIGNAL(clicked()), this, SLOT(showNotify2()) );
    connect(ui->lineEdit,SIGNAL(textEdited(QString)), this, SLOT(checkText(QString)));

    QTimer::singleShot(700,this,SLOT(showDialog1()));
    QTimer::singleShot(0,this,SLOT(centerWindow()));

}
PlaylistWindow::PlaylistWindow()
	: AbstractWindow("playlistwindow.xml", WIT_MOUSE_INPUT)
{
	mPlaylistTable = getMultiColumnList("PlaylistSheet/PlaylistSheet/Table");
	mPlaylistTable->addColumn((utf8*)"Name", 0, cegui_reldim(0.5));
	mPlaylistTable->addColumn((utf8*)"Dauer", 1, cegui_reldim(0.3));
	mPlaylistTable->setUserSortControlEnabled(false);

    /* getWindow("PlaylistWindow")->subscribeEvent(
            Window::EventMouseClick,
            boost::bind(&MainMenuWindow::handleChooseModules, this)); */

    getWindow("PlaylistSheet/ButtonSheet/Play")->subscribeEvent(
            Window::EventMouseClick,
            boost::bind(&PlaylistWindow::handlePlay, this));
    getWindow("PlaylistSheet/ButtonSheet/Quit")->subscribeEvent(
            Window::EventMouseClick,
            boost::bind(&PlaylistWindow::handleQuit, this));
    bindDestroyWindowToClick(getWindow("PlaylistSheet"));
	bindDestroyWindowToXButton();

    centerWindow();
}
PlaylistWindow::PlaylistWindow()
	: CeGuiWindow("playlistwindow.xml", WND_MOUSE_INPUT)
{
	mPlaylistTable = getMultiColumnList("PlaylistSheet/PlaylistSheet/Table");
	mPlaylistTable->addColumn((utf8*)"Name", 0, 0.5);
	mPlaylistTable->addColumn((utf8*)"Dauer", 1, 0.3);
	mPlaylistTable->setUserSortControlEnabled(false);
	
    /* getWindow("PlaylistWindow")->subscribeEvent(
            Window::EventMouseClick, 
            boost::bind(&MainMenuWindow::handleChooseModules, this)); */

    getWindow("PlaylistSheet/ButtonSheet/Play")->subscribeEvent(
            Window::EventMouseClick, 
            boost::bind(&PlaylistWindow::handlePlay, this));
    getWindow("PlaylistSheet/ButtonSheet/Quit")->subscribeEvent(
            Window::EventMouseClick, 
            boost::bind(&PlaylistWindow::handleQuit, this));
    bindClickToCloseWindow(getWindow("PlaylistSheet"));
	bindCloseToCloseButton();

    centerWindow();
}
	PropertiesWindow::PropertiesWindow(PropertyHolder* object) :
        AbstractWindow("propertieswindow.xml", WIT_MOUSE_INPUT),
		mObject(object)
	{
        // Get access to the tab control
        mTabPane = getTabControl("PropertiesWindow/PropertiesTabPane");
        RlAssert(mTabPane != NULL, "PropertiesWindow/PropertiesTabPane is null");

        // Get a access to the main Property table
        mMainTable = getMultiColumnList("PropertiesWindow/PropertiesTabControl/MainTable");
        RlAssert(mMainTable != NULL, "PropertiesWindow/PropertiesTabPane is null");

        mMainTable->addColumn( (utf8*)"Key", 0, cegui_reldim(0.3));
        mMainTable->addColumn( (utf8*)"Type", 1, cegui_reldim(0.3));
        mMainTable->addColumn( (utf8*)"Value", 2, cegui_reldim(0.4));

        centerWindow();

        bindDestroyWindowToXButton();
        bindDestroyWindowToClick(getWindow("PropertiesWindow/CloseButton"));

		initialize(mObject);
	}
Beispiel #26
0
//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   hInst = hInstance; // Store instance handle in our global variable

   int width = W_WIDTH;
   int height = W_HEIGHT;
   int x = width;
   int y = height;

   centerWindow(GetDesktopWindow(), x, y);

   HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME & ~WS_MAXIMIZEBOX,
      x, y, width, height, nullptr, nullptr, hInstance, nullptr);

   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}
Beispiel #27
0
int main( int argc, char** argv )
{
  #ifdef USE_PYTHON
  // Initialize the Python interpreter
  Py_SetProgramName( argv[0] );
  Py_Initialize();

  // Initialize a callback that will close down the interpreter
  atexit( exitCleanup );

  // Allow subsequent Python commands to use the sys module
  PythonTools::pythonCommand( "import sys" );

  // Prevent Python from intercepting the interrupt signal
  PythonTools::pythonCommand( "import signal" );
  PythonTools::pythonCommand( "signal.signal( signal.SIGINT, signal.SIG_DFL )" );

  // Initialize the callbacks
  PythonScripting::initializeCallbacks();
  #endif

  QApplication app{ argc, argv };
  const QStringList arguments{ app.arguments() };
  if( arguments.count() > 2 )
  {
    std::cerr << "Error, must provide a valid configuration file name or no argument. Exiting." << std::endl;
    return EXIT_FAILURE;
  }
  Window window{ arguments.count() == 2 ? arguments[1] : "" };
  window.resize( window.sizeHint() );
  window.setWindowTitle( "3D Rigid Body Simulation" );
  centerWindow( window );
  window.show();
  window.raise();
  return app.exec();
}
bool CommandDlg::handleInitDialog() {
	setHelpId(IDH_USER_COMMAND);

	WinUtil::setHelpIds(this, helpItems);

	// Translate
	setText(T_("Create / Modify User Command"));
	setItemText(IDC_SETTINGS_TYPE, T_("Command Type"));
	setItemText(IDC_SETTINGS_CONTEXT, T_("Context"));
	setItemText(IDC_SETTINGS_PARAMETERS, T_("Parameters"));
	setItemText(IDC_SETTINGS_NAME, T_("Name"));
	setItemText(IDC_SETTINGS_COMMAND, T_("Command"));
	setItemText(IDC_SETTINGS_HUB, T_("Hub IP / DNS (empty = all, 'op' = where operator)"));
	setItemText(IDC_SETTINGS_TO, T_("To"));
	setItemText(IDC_USER_CMD_PREVIEW, T_("Text sent to hub"));

	attachChild(separator, IDC_SETTINGS_SEPARATOR);
	separator->setText(T_("Separator"));
	separator->onClicked(std::tr1::bind(&CommandDlg::handleTypeChanged, this));

	attachChild(raw, IDC_SETTINGS_RAW);
	raw->setText(T_("Raw"));
	raw->onClicked(std::tr1::bind(&CommandDlg::handleTypeChanged, this));

	attachChild(chat, IDC_SETTINGS_CHAT);
	chat->setText(T_("Chat"));
	chat->onClicked(std::tr1::bind(&CommandDlg::handleTypeChanged, this));

	attachChild(PM, IDC_SETTINGS_PM);
	PM->setText(T_("PM"));
	PM->onClicked(std::tr1::bind(&CommandDlg::handleTypeChanged, this));

	hubMenu = attachChild<CheckBox>(IDC_SETTINGS_HUB_MENU);
	hubMenu->setText(T_("Hub Menu"));

	userMenu = attachChild<CheckBox>(IDC_SETTINGS_USER_MENU);
	userMenu->setText(T_("User Menu"));

	searchMenu = attachChild<CheckBox>(IDC_SETTINGS_SEARCH_MENU);
	searchMenu->setText(T_("Search Menu"));

	fileListMenu = attachChild<CheckBox>(IDC_SETTINGS_FILELIST_MENU);
	fileListMenu->setText(T_( "Filelist Menu"));

	nameBox = attachChild<TextBox>(IDC_NAME);

	commandBox = attachChild<TextBox>(IDC_COMMAND);
	commandBox->onUpdated(std::tr1::bind(&CommandDlg::updateCommand, this));

	hubBox = attachChild<TextBox>(IDC_HUB);

	nick = attachChild<TextBox>(IDC_NICK);
	nick->onUpdated(std::tr1::bind(&CommandDlg::updateCommand, this));

	once = attachChild<CheckBox>(IDC_SETTINGS_ONCE);
	once->setText(T_("Send once per nick"));

	result = attachChild<TextBox>(IDC_RESULT);

	openHelp = attachChild<CheckBox>(IDC_USER_CMD_OPEN_HELP);
	openHelp->setText(T_("Always open help file with this dialog"));
	bool bOpenHelp = BOOLSETTING(OPEN_USER_CMD_HELP);
	openHelp->setChecked(bOpenHelp);

	{
		ButtonPtr button = attachChild<Button>(IDOK);
		button->setText(T_("OK"));
		button->onClicked(std::tr1::bind(&CommandDlg::handleOKClicked, this));

		button = attachChild<Button>(IDCANCEL);
		button->setText(T_("Cancel"));
		button->onClicked(std::tr1::bind(&CommandDlg::endDialog, this, IDCANCEL));

		button = attachChild<Button>(IDHELP);
		button->setText(T_("Help"));
		button->onClicked(std::tr1::bind(&WinUtil::help, handle(), IDH_USER_COMMAND));
	}

	if(bOpenHelp) {
		// launch the help file, instead of having the help in the dialog
		WinUtil::help(handle(), IDH_USER_COMMAND);
	}

	if(type == UserCommand::TYPE_SEPARATOR) {
		separator->setChecked(true);
	} else {
		// More difficult, determine type by what it seems to be...
		if((_tcsncmp(command.c_str(), _T("$To: "), 5) == 0) &&
			(command.find(_T(" From: %[myNI] $<%[myNI]> ")) != string::npos ||
			command.find(_T(" From: %[mynick] $<%[mynick]> ")) != string::npos) &&
			command.find(_T('|')) == command.length() - 1) // if it has | anywhere but the end, it is raw
		{
			string::size_type i = command.find(_T(' '), 5);
			dcassert(i != string::npos);
			tstring to = command.substr(5, i-5);
			string::size_type cmd_pos = command.find(_T('>'), 5) + 2;
			tstring cmd = Text::toT(NmdcHub::validateMessage(Text::fromT(command.substr(cmd_pos, command.length()-cmd_pos-1)), true));
			PM->setChecked(true);
			nick->setText(to);
			commandBox->setText(cmd.c_str());
		} else if(((_tcsncmp(command.c_str(), _T("<%[mynick]> "), 12) == 0) ||
			(_tcsncmp(command.c_str(), _T("<%[myNI]> "), 10) == 0)) &&
			command[command.length()-1] == '|')
		{
			// Looks like a chat thing...
			string::size_type cmd_pos = command.find(_T('>')) + 2;
			tstring cmd = Text::toT(NmdcHub::validateMessage(Text::fromT(command.substr(cmd_pos, command.length()-cmd_pos-1)), true));
			chat->setChecked(true);
			commandBox->setText(cmd);
		} else {
			tstring cmd = command;
			raw->setChecked(true);
			commandBox->setText(cmd);
		}
		if(type == UserCommand::TYPE_RAW_ONCE) {
			once->setChecked(true);
			type = 1;
		}
	}

	hubBox->setText(hub);
	nameBox->setText(name);

	if(ctx & UserCommand::CONTEXT_HUB)
		hubMenu->setChecked(true);
	if(ctx & UserCommand::CONTEXT_CHAT)
		userMenu->setChecked(true);
	if(ctx & UserCommand::CONTEXT_SEARCH)
		searchMenu->setChecked(true);
	if(ctx & UserCommand::CONTEXT_FILELIST)
		fileListMenu->setChecked(true);

	updateControls();
	updateCommand();

	separator->setFocus();

	centerWindow();
	return false;
}
Beispiel #29
0
MainWindow::MainWindow (Platform *platform,
                        const char *cmddevice,
                        const char *cmdfile,
                        bool unsafe,
                        bool maximized,
                        QWidget *parent)
 : QWidget(parent)
{
    pPlatform = platform;
    QDBusConnection dbusConnection = QDBusConnection::systemBus();
    file = QString();
    mMaximized = maximized;
    mUnsafe = unsafe;
    fileSize = new QLabel("      ");
    fileLabel = new QLabel("     ");

// The "new" UI won't compile on 10.3 or SLE10, so fallback in that case to the older, uglier one
#if (QT_VERSION >= 0x040400)
    useNewUI();
#else
    useOldUI();
#endif

    setWindowTitle(QString("SUSE Studio Imagewriter %1").arg(APP_VERSION));
    reloadDeviceList(cmddevice);

    if (cmdfile != NULL)
    {
        if(QFile(cmdfile).exists())
        {
          setFile(cmdfile);
          setSizeLabel(cmdfile);
        }
    }

#ifdef USEHAL
    // Hook into DBUS insertion and removal notifications
    dbusConnection.connect("",
                           "/org/freedesktop/Hal/Manager",
                           "org.freedesktop.Hal.Manager",
                           "DeviceAdded",
                           this,
                           SLOT(deviceInserted(QDBusMessage)));

    dbusConnection.connect("",
                           "/org/freedesktop/Hal/Manager",
                           "org.freedesktop.Hal.Manager",
                           "DeviceRemoved",
                           this,
                           SLOT(deviceRemoved(QDBusMessage)));
#else
    dbusConnection.connect("",
                           "/org/freedesktop/UDisks",
                           "org.freedesktop.UDisks",
                           "DeviceAdded",
                           this,
                           SLOT(deviceInserted(QDBusMessage)));

    dbusConnection.connect("",
                           "/org/freedesktop/UDisks",
                           "org.freedesktop.UDisks",
                           "DeviceRemoved",
                           this,
                           SLOT(deviceRemoved(QDBusMessage)));
#endif
    if (!mMaximized)
        centerWindow();
}
Beispiel #30
0
void EGLView::setFrameSize(float width, float height)
{
	m_obDesignResolutionSize = m_obScreenSize = CCSizeMake(width, height);
    resize(width, height); // adjust window size for menubar
    centerWindow();
}