void QmitkUSNavigationProcessWidget::SetSettingsWidget(QmitkUSNavigationAbstractSettingsWidget* settingsWidget)
{
  // disconnect slots to settings widget if there was a widget before
  if ( m_SettingsWidget )
  {
    disconnect( ui->settingsSaveButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnSave()) );
    disconnect( ui->settingsCancelButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnCancel()) );

    disconnect (m_SettingsWidget, SIGNAL(Saved()), this, SLOT(OnSettingsWidgetReturned()) );
    disconnect (m_SettingsWidget, SIGNAL(Canceled()), this, SLOT(OnSettingsWidgetReturned()) );
    disconnect (m_SettingsWidget, SIGNAL(SettingsChanged(itk::SmartPointer<mitk::DataNode>)), this, SLOT(OnSettingsChanged(itk::SmartPointer<mitk::DataNode>)) );

    ui->settingsWidget->removeWidget(m_SettingsWidget);
  }

  m_SettingsWidget = settingsWidget;
  if ( m_SettingsWidget )
  {
    m_SettingsWidget->LoadSettings();

    connect( ui->settingsSaveButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnSave()) );
    connect( ui->settingsCancelButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnCancel()) );

    connect (m_SettingsWidget, SIGNAL(Saved()), this, SLOT(OnSettingsWidgetReturned()) );
    connect (m_SettingsWidget, SIGNAL(Canceled()), this, SLOT(OnSettingsWidgetReturned()) );
    connect (m_SettingsWidget, SIGNAL(SettingsChanged(itk::SmartPointer<mitk::DataNode>)), this, SLOT(OnSettingsChanged(itk::SmartPointer<mitk::DataNode>)) );

    if ( m_SettingsNode.IsNotNull() ) { m_SettingsWidget->SetSettingsNode(m_SettingsNode, true); }

    ui->settingsWidget->addWidget(m_SettingsWidget);
  }
  ui->settingsButton->setEnabled(m_SettingsWidget != 0);
}
Exemplo n.º 2
0
// Handles WM_ACTIVATE message
LRESULT CNoteDlg::OnActivateWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	if (LOWORD(wParam) == WA_INACTIVE)	// the window gets deactivated
	{
		// Change title bar's color to an inactive window caption color
		m_wndStaticBar.SetColor(GetSysColor(COLOR_INACTIVECAPTION));

		// Change 'Close' button color to an inactive
		m_wndBtnClose.SetTextColor(GREY);

		// Note should be saved whenever it loses the focus.
		// The m_bClosing flag is used to avoid saving a note twice when we close it since
		// this function is also called.
		// The m_bDeleted flag is used to avoid saving a note again after it has
		// been deleted.
		if (!m_bClosing)
		{
			if (!m_bDeleted)
				OnSave(true);
		}
	}
	else								// the window gets activated
	{
		// Change title bar's color to an active window caption color
		m_wndStaticBar.SetColor(GetSysColor(COLOR_ACTIVECAPTION));
		m_wndEdit.SetFocus();

		// Change 'Close' button color to an active
		m_wndBtnClose.SetTextColor(BLACK);
	}
	
	m_wndStaticBar.Invalidate(FALSE);
	m_wndBtnClose.Invalidate(FALSE);
	return 0;
}
Exemplo n.º 3
0
/**
 * RegEdit
 */
RegEdit::RegEdit(Backend *backend, QWidget *parent)
    :QWidget(parent), m_backend(backend)
{
    QVBoxLayout *m_vert_layout = new QVBoxLayout();
    m_file_group = new QGroupBox("File selection", this);
    QHBoxLayout *m_file_group_layout = new QHBoxLayout();
    m_file_edit = new QLineEdit(this);
    m_file_edit->setReadOnly(true);
    m_file_open = new QToolButton(this);
    m_file_open->setText("Open");
    m_file_open->setIcon(QIcon::fromTheme("document-open"));
    m_file_open->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    QMenu *file_open_menu = new QMenu(this);
    QAction *new_act = file_open_menu->addAction(QIcon::fromTheme("document-new"), "New...");
    m_file_open->setMenu(file_open_menu);

    m_file_save = new QToolButton(this);
    m_file_save->setText("Save");
    m_file_save->setIcon(QIcon::fromTheme("document-save"));
    m_file_save->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    QMenu *file_save_menu = new QMenu(this);
    QAction *saveas_act = file_save_menu->addAction(QIcon::fromTheme("document-save-as"), "Save as...");
    m_file_save->setMenu(file_save_menu);
    m_file_group_layout->addWidget(m_file_open);
    m_file_group_layout->addWidget(m_file_save);
    m_file_group_layout->addWidget(m_file_edit);

    m_splitter = new QSplitter(this);
    m_soc_tree = new QTreeWidget(this);
    m_soc_tree->setColumnCount(1);
    m_soc_tree->setHeaderLabel(QString("Name"));
    m_soc_tree->setContextMenuPolicy(Qt::ActionsContextMenu);
    QAction *soc_tree_delete_action = new QAction("&Delete", this);
    soc_tree_delete_action->setIcon(QIcon::fromTheme("list-remove"));
    connect(soc_tree_delete_action, SIGNAL(triggered()), this, SLOT(OnSocItemDelete()));
    m_soc_tree->addAction(soc_tree_delete_action);
    m_splitter->addWidget(m_soc_tree);
    m_splitter->setStretchFactor(0, 0);

    m_file_group->setLayout(m_file_group_layout);
    m_vert_layout->addWidget(m_file_group);
    m_vert_layout->addWidget(m_splitter, 1);

    setLayout(m_vert_layout);

    SetModified(false, false);
    m_right_panel = 0;
    SetPanel(new EmptyEditPanel(this));
    UpdateTabName();

    connect(m_file_open, SIGNAL(clicked()), this, SLOT(OnOpen()));
    connect(m_file_save, SIGNAL(clicked()), this, SLOT(OnSave()));
    connect(new_act, SIGNAL(triggered()), this, SLOT(OnNew()));
    connect(saveas_act, SIGNAL(triggered()), this, SLOT(OnSaveAs()));
    connect(m_soc_tree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
        this, SLOT(OnSocItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
    connect(m_soc_tree, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
        this, SLOT(OnSocItemActivated(QTreeWidgetItem*, int)));
}
Exemplo n.º 4
0
void MainWindow::SetupUi()
{
	resize(600, 400);

	//set the main toolbar	
	mainToolbar = new QToolBar();
	mainToolbar->setEnabled(true);
	mainToolbar->setIconSize(QSize(16, 16));
	addToolBar(Qt::TopToolBarArea, mainToolbar);

	newAction = new QAction(QIcon(":/Resources/images/new.png"), tr("&New"), this);
	connect(newAction, SIGNAL(triggered()), this, SLOT(OnNew()));
	mainToolbar->addAction(newAction);

	openAction = new QAction(QIcon(":/Resources/images/open.png"), tr("&Open"), this);
	openAction->setShortcut(QKeySequence::Open);
	connect(openAction, SIGNAL(triggered()), this, SLOT(OnOpen()));
	mainToolbar->addAction(openAction);

	saveAction = new QAction(QIcon(":/Resources/images/save.png"), tr("&Save"), this);
	saveAction->setShortcut(QKeySequence::Save);
	connect(saveAction, SIGNAL(triggered()), this, SLOT(OnSave()));
	mainToolbar->addAction(saveAction);

	undoAction = new QAction(QIcon(":/Resources/images/undo.png"), tr("&Undo"), this);
	undoAction->setShortcut(QKeySequence::Undo);
	connect(undoAction, SIGNAL(triggered()), this, SLOT(OnUndo()));
	mainToolbar->addAction(undoAction);

	redoAction = new QAction(QIcon(":/Resources/images/redo.png"), tr("&Redo"), this);
	redoAction->setShortcut(QKeySequence::Redo);
	connect(redoAction, SIGNAL(triggered()), this, SLOT(OnRedo()));
	mainToolbar->addAction(redoAction);

	setWindowTitle(QApplication::translate("Natural Calculator", "Natural Calculator", 0, QApplication::UnicodeUTF8));
	QMetaObject::connectSlotsByName(this);

	QVariant p = settings.Load("NaturalCalculator", "position");
	move(p.toPoint());
	p = settings.Load("NaturalCalculator", "size");
	resize(p.toSize());
	
	//set the main window
	formulaWnd = new FormulaWnd(this);
	formulaWnd->setObjectName(QString::fromUtf8("formulaWnd"));
	formulaWnd->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);

	QWidget* c = new QWidget();
	
	QBoxLayout* layout = new QBoxLayout(QBoxLayout::LeftToRight);
	layout->addWidget(formulaWnd);

	c->setLayout(layout);
	setCentralWidget(c);
}
Exemplo n.º 5
0
//--------------------------------------------------------------------------------
void CIwASDAttrPanel::OnSwap(wxCommandEvent& e)
{
    OnSave(e);

    if (m_Layout->m_DataAttr!=NULL)
        m_Layout->SetData(m_Layout->m_DataAttr->m_File,true);
    else
        m_Layout->SetData(m_Layout->m_DataSource->m_File,false);

    OnReload(e);
}
Exemplo n.º 6
0
  /* virtual methods from ActionListener */
  virtual void OnAction(int id) override {
    switch (id) {
    case DEMO:
      OnDemo();
      break;

    case SAVE:
      OnSave();
      break;
    }
  }
Exemplo n.º 7
0
void COctopusStage545::OnTimer( UINT nIDEvent ) 
{
	if( nIDEvent == TIMER_STAGE ) 
	{
		if( first_tick ) 
		{
			OnStepSize3();

			first_tick = false;


			//Editing
			InitializeStage(); 
			GetPosition();

			//middlex	 = 100.0;
			//middley	 = 100.0;
			//middlez	 = 100.0;
			middlex	 = 12;//B.position_x;
			middley	 = 12;//B.position_y;
			middlez	 = 0;

			//m_gotox = 0;
			//m_gotoy = 0;


			range    = 24.975; //max is 25mm, but lets leave a little wiggle room

			savex    = 12;//middlex;
			savey    = 12;//middley;
			savez    = middlez;

			target_x = savex;
			target_y = savey;
			target_z = savez;
			//InitializeStage(); 


			StageCenter();

			OnSave(); 

			if ( glob_m_pLog != NULL ) 
				glob_m_pLog->Write(" PI 545 stage initialized ");
		}
		if( initialized ) 
		{
			GetPosition();
			ShowPosition();
		}
	}

	CDialog::OnTimer(nIDEvent);
}
Exemplo n.º 8
0
void CDialog_GeneralConfig::OnCommand( const char *cmd )
{
	if ( !Q_stricmp( cmd, "save" ) )
	{
		OnSave();
		Close();
	}
	else if ( !Q_stricmp( cmd, "close" ) )
	{
		Close();
	}
}
Exemplo n.º 9
0
bool Window::askToSave() {
	if (canvas->isModified()) {
		int out = wxMessageBox(_("Save unsaved data?"), wxMessageBoxCaptionStr, wxYES_NO|wxCANCEL);
		if (out == wxYES) {
			wxCommandEvent tmp;
			OnSave(tmp);
		} else if (out == wxCANCEL) {
			return false;
		}
	}
	return true;
}
Exemplo n.º 10
0
void EditorBase::InitActions()
{
    mNewAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
    mNewAct->setShortcut(tr("Ctrl+N"));
    mNewAct->setStatusTip(tr("Create a new file"));
    connect(mNewAct, SIGNAL(triggered()), this, SLOT(OnNew()));

    mOpenAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
    mOpenAct->setShortcut(tr("Ctrl+O"));
    mOpenAct->setStatusTip(tr("Open an existing file"));
    connect(mOpenAct, SIGNAL(triggered()), this, SLOT(OnOpen()));

    mSaveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this);
    mSaveAct->setShortcut(tr("Ctrl+S"));
    mSaveAct->setStatusTip(tr("Save the document to disk"));
    connect(mSaveAct, SIGNAL(triggered()), this, SLOT(OnSave()));

    mSaveAsAct = new QAction(tr("Save &As..."), this);
    mSaveAsAct->setStatusTip(tr("Save the document under a new name"));
    connect(mSaveAsAct, SIGNAL(triggered()), this, SLOT(OnSaveAs()));

    mExitAct = new QAction(tr("E&xit"), this);
    mExitAct->setShortcut(tr("Ctrl+Q"));
    mExitAct->setStatusTip(tr("Exit the application"));
    connect(mExitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));

    mCutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this);
    mCutAct->setShortcut(tr("Ctrl+X"));
    mCutAct->setStatusTip(tr("Cut the current selection's contents to the clipboard"));
    connect(mCutAct, SIGNAL(triggered()), this, SLOT(OnCut()));

    mCopyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this);
    mCopyAct->setShortcut(tr("Ctrl+C"));
    mCopyAct->setStatusTip(tr("Copy the current selection's contents to the clipboard"));
    connect(mCopyAct, SIGNAL(triggered()), this, SLOT(OnCopy()));

    mPasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this);
    mPasteAct->setShortcut(tr("Ctrl+V"));
    mPasteAct->setStatusTip(tr("Paste the clipboard's contents into the current selection"));
    connect(mPasteAct, SIGNAL(triggered()), this, SLOT(OnPaste()));

    mSeparatorAct = new QAction(this);
    mSeparatorAct->setSeparator(true);

    mAboutAct = new QAction(tr("&About"), this);
    mAboutAct->setStatusTip(tr("Show the application's About box"));
    connect(mAboutAct, SIGNAL(triggered()), this, SLOT(OnAbout()));

    mAboutQtAct = new QAction(tr("About &Qt"), this);
    mAboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
    connect(mAboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
Exemplo n.º 11
0
WdgAddStation::WdgAddStation(QWidget *parent) : QWidget(parent)
{
	ui.setupUi(this);
	connect(ui.pbSave, SIGNAL(clicked()), this, SLOT(OnSave()));

	Qt::WindowFlags flags = 0;

	flags = Qt::Tool;
	flags |= Qt::MSWindowsFixedSizeDialogHint;
	flags |= Qt::WindowStaysOnTopHint;

	setWindowFlags(flags);
}
Exemplo n.º 12
0
void CNoteDlg::CloseDialog(int nVal)
{
	m_bClosing = true;		// note is being closed

	// The app in not being closed so change the note's status to 'closed'
	if (!IsAppClosing())
		SetNoteStatus(Close);

	// Display a prompt dialog asking an user if a note should be saved
	// but only if the text has been modified in the edit control
	if (m_wndEdit.GetModify())
	{
		int nRet = MessageBox(_T("The text in the note has changed.\n\nDo you want to save the changes?"), 
								_T("StickyNotes"),
								MB_YESNOCANCEL|MB_ICONEXCLAMATION);

		if (nRet == IDCANCEL)	// 'Cancel' button - do not do anything 
			return;
		if (nRet == IDYES)		// 'Yes' button - save the note's text also
			OnSave(true);
		if (nRet == IDNO)		// 'No' button - only save the note's attributes
			OnSave(false);
	}
	else
		// Text has not been modified so save the note's attributes only
		OnSave(false);			

	// Add a note's text and a note's id to the collection of recently accessed notes
	if (GetNoteText().length() != 0)
	{
		(m_pWndParent->m_RecNotes).AddItemToCollection(GetNoteText(), GetNoteID());
	}

	// Remove it from the collection of the opened notes
	m_pWndParent->RemoveFromListOfOpenNotes(GetNoteID());

	// Destroy the Note dialog
	DestroyWindow();
}
Exemplo n.º 13
0
    void KUiFontManage::OnButtonClick(int nBtnId)
    {

	    switch(nBtnId)
	    {
            case IDC_WND_FONT_MANAGE_FONT_ADD:
                OnAdd();
                break;
            case IDC_WND_FONT_MANAGE_FONT_CHANGE:
                OnChange();
                break;
            case IDC_WND_FONT_MANAGE_FONT_SAVE:
                OnSave(m_szFontFileName);
                break;
            case IDC_WND_FONT_MANAGE_FONT_COLOR_SEL:
                OnChangeColor(0, 0);
                break;
            case IDC_WND_FONT_MANAGE_FONT_BCOLOR_SEL:
                OnChangeColor(1, 0);
                break;
			case IDC_WND_FONT_MANAGE_FONT_PCOLOR_SEL:
				OnChangeColor(2, 0);
				break;
            case IDC_WND_FONT_MANAGE_FONT_SEL:
                if (!m_bManage) 
                {
                    OnSave(m_szFontFileName);
                    m_bSel = TRUE;
                    PostMessage(m_hWnd, WM_CLOSE, 0, 0);
                }
                break;

            default:
                break;
	    }

    }
Exemplo n.º 14
0
	void MainMenu::OnMenuCtrlAccept(MyGUI::MenuControl* _sender, MyGUI::MenuItem* _item)
	{
		const std::string& id = _item->getItemId();

		if (id == "CTRL_Menu_Load")
			OnLoad();
		else if (id == "CTRL_Menu_Save")
			OnSave();
		else if (id == "CTRL_Menu_Import")
			OnImport();
		else if (id == "CTRL_Menu_Export")
			OnExport();
		else if (id == "CTRL_Menu_New")
			OnNew();
	}
Exemplo n.º 15
0
int KUiTaskNote_Personal::WndProc(unsigned int uMsg, unsigned int uParam, int nParam)
{
	int nResult = false;
	if (uMsg ==  WND_N_BUTTON_CLICK &&
		uParam == (unsigned int)(KWndWindow*)&m_BtnSave)
	{
		OnSave();
		nResult = true;
	}
	else
	{
		nResult = KWndPage::WndProc(uMsg, uParam, nParam);
	}
	return nResult;
}
Exemplo n.º 16
0
MainWindow::MainWindow()
	: QWidget()
{
	setMinimumSize( 512, 384 );

	menu_bar_= new QMenuBar( this );
	setContentsMargins( 0, menu_bar_->height(), 0, 0 );

	file_menu_= new QMenu( "File" );
	file_menu_->addAction( "Open", this, SLOT(OnLoad()) );
	file_menu_->addAction( "Save", this, SLOT(OnSave()) );
	file_menu_->addAction( "Quit", this, SLOT(close()) );
	menu_bar_->addMenu( file_menu_ );

	layout_= new QBoxLayout( QBoxLayout::TopToBottom, this );
	setLayout( layout_ );

	help_menu_= new QMenu( "Help" );
	help_menu_->addAction( "About", this, SLOT(OnAbout()) );
	menu_bar_->addMenu( help_menu_ );

	tool_bar_= new QToolBar("tools", this);
	layout_->addWidget( tool_bar_ );

	tool_bar_->addAction( "save", this, SLOT(OnSave()) );
	tool_bar_->addAction( "load", this, SLOT(OnLoad()) );
	tool_bar_->addAction( "build", this, SLOT(OnBuild()) );

	editor_= new QTextEdit( this );
	layout_->addWidget( editor_ );


	output_= new QTextEdit( this );
	output_->setEnabled( false );
	layout_->addWidget( output_ );
}
Exemplo n.º 17
0
void COverlappedWindow::OnClose()
{
    BOOL canExit = !isChanged;
    if( isChanged ) {
        int answer = MessageBox(handle, L"Do you want to save changes?", L"Save on exit", MB_YESNOCANCEL);
        if( answer == IDYES ) {
            canExit = OnSave();
        } else if( answer == IDNO ) {
            canExit = true;
        }
    }
    if( canExit ) {
        DestroyWindow(handle);
    }
}
Exemplo n.º 18
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
void tTripHistoryDialog::reject()
{
    if( m_NameChanged )
    {
        if( tMessageBox::SaveChanges( this, windowTitle() ) == tMessageBox::SAVE )
        {
            OnSave();
        }
        else
        {
            tDialog::reject();
        }
    }
    else
    {
        tDialog::reject();
    }
}
Exemplo n.º 19
0
int RE::ReClipWorkshop::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = ReBaseWidget<QWidget>::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: OnContextMenu((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 1: OnLoadImage(); break;
        case 2: OnImport(); break;
        case 3: OnSave(); break;
        case 4: OnSaveAs(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
Exemplo n.º 20
0
uint32 PlayerNodeGoto::EngineMessageFn( uint32 dwMsgId, void *pData, float fData )
{
	switch( dwMsgId )
	{
		case MID_PRECREATE:
		{
			// Let the GameBase handle the message first...
			uint32 dwRet = GameBase::EngineMessageFn( dwMsgId, pData, fData );

			ObjectCreateStruct	*pOCS = (ObjectCreateStruct*)pData;

			if( pOCS && (PRECREATE_SAVEGAME != fData) )
			{
				ReadProps( &pOCS->m_cProperties );
			}

			// Important!! - We already sent the message to the GameBase so DONT do it again.
			return dwRet;
		}
		break;

		case MID_OBJECTCREATED:
		{
			// Make sure the object is sent to the clients but never update on the server...
			g_pCommonLT->SetObjectFlags( m_hObject, OFT_Flags, FLAG_FORCECLIENTUPDATE, FLAG_FORCECLIENTUPDATE );
			SetNextUpdate( UPDATE_NEVER );
		}
		break;

		case MID_SAVEOBJECT:
		{
			OnSave( (ILTMessage_Write*)pData, (uint32)fData );
		}
		break;

		case MID_LOADOBJECT:
		{
			OnLoad( (ILTMessage_Read*)pData, (uint32)fData );
		}
		break;
	}

	return GameBase::EngineMessageFn( dwMsgId, pData, fData );
}
Exemplo n.º 21
0
void udCodeEditorPanel::OnKeyDown(wxKeyEvent& event)
{
	switch( event.GetKeyCode() )
	{
		case 's':
		case 'S':
			if( event.AltDown() && CanSave() )
			{
				wxCommandEvent evt;
				OnSave( evt );
			}
			else
				event.Skip();
			break;
			
		default:
			event.Skip();
	}
}
Exemplo n.º 22
0
void RTFEditor::OnSaveAs()
{
	mol::bstr p;

	static wchar_t  OutFilesFilter[] = _T("save as rtf *.rtf\0*.rtf\0save as file*.*\0*.*\0\0");


	mol::FilenameDlg ofn(*this);
	ofn.setFilter( OutFilesFilter );		
	ofn.fileName(filename_);

	if ( ofn.dlgSave( OFN_OVERWRITEPROMPT| OFN_NOTESTFILECREATE| OFN_NOVALIDATE) )
	{	
		filename_ = ofn.fileName();
		if ( ofn.index() == 1 )
		{
			
			OnSave();
		}
		else
		{
			std::string tmp;
			rtf_.streamOut(tmp);

			mol::filestream fs;

			if ( fs.open( mol::tostring(filename_)) )
			{
				fs.write( tmp.c_str(), tmp.size() );
				fs.flush();
				fs.close();
			}
			
			setText(filename_);
			statusBar()->status(_T("saved file"));
		}

		std::wostringstream oss;
		oss << "saved as " << filename_;
		statusBar()->status(oss.str());
		
	}
}
Exemplo n.º 23
0
qtDLGOption::qtDLGOption(QWidget *parent, Qt::WFlags flags)
    : QDialog(parent, flags)
{
    setupUi(this);
    this->setFixedSize(this->width(),this->height());
    this->setStyleSheet("background: rgb(230, 235, 230)");
    //this->setAttribute(Qt::WA_DeleteOnClose,true);

    tblCustomExceptions->insertRow(tblCustomExceptions->rowCount());
    tblCustomExceptions->setItem(tblCustomExceptions->rowCount() - 1,0,new QTableWidgetItem(""));
    tblCustomExceptions->setItem(tblCustomExceptions->rowCount() - 1,1,new QTableWidgetItem(""));

    OnLoad();

    // Events for the GUI
    connect(tblCustomExceptions,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(OnRightClickCustomException(const QPoint &)));
    connect(btnClose,SIGNAL(clicked()),this,SLOT(OnClose()));
    connect(btnReload,SIGNAL(clicked()),this,SLOT(OnReload()));
    connect(btnSave,SIGNAL(clicked()),this,SLOT(OnSave()));
}
Exemplo n.º 24
0
qtDLGOption::qtDLGOption(QWidget *parent, Qt::WFlags flags)
	: QDialog(parent, flags)
{
	setupUi(this);
	this->setFixedSize(this->width(),this->height());
	tblCustomExceptions->horizontalHeader()->setFixedHeight(21);

	m_pMainWindow = qtDLGNanomite::GetInstance();
	m_pSettings = clsAppSettings::SharedInstance();

#ifdef _AMD64_
	lblCurrentJIT->setText("x64");
	lblCurrentJITWOW64->setText("x86");
	lblDefaultJIT->setText("x64");
	lblDefaultJITWOW64->setText("x86");

#else
	lblCurrentJIT->setText("x86");
	lblCurrentJITWOW64->setText("x86");
	lblDefaultJIT->setText("x86");
	lblDefaultJITWOW64->setText("x86");

	lineCurrentWOW64->setEnabled(false);
	lineOrgWOW64->setEnabled(false);
#endif

	OnLoad();

	// Events for the GUI
	connect(cbLoadSym, SIGNAL(stateChanged(int)), this, SLOT(SetUseSym(int)));
	connect(cbMSSym, SIGNAL(stateChanged(int)), this, SLOT(OnMSSymWarning(int)));
	connect(tblCustomExceptions,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(OnRightClickCustomException(const QPoint &)));
	connect(btnClose,SIGNAL(clicked()),this,SLOT(OnClose()));
	connect(btnReload,SIGNAL(clicked()),this,SLOT(OnReload()));
	connect(btnSave,SIGNAL(clicked()),this,SLOT(OnSave()));
	connect(pbSetNanomite,SIGNAL(clicked()),this,SLOT(OnSetNanomiteDefault()));
	connect(pbRestoreOrg,SIGNAL(clicked()),this,SLOT(OnRestoreOrg()));
	connect(bpRegisterNDB,SIGNAL(clicked()),this,SLOT(EnableNDBExtension()));
	connect(bpUnregisterNDB,SIGNAL(clicked()),this,SLOT(DisableNDBExtension()));
	connect(new QShortcut(QKeySequence(QKeySequence::Delete),this),SIGNAL(activated()),this,SLOT(OnExceptionRemove()));
}
Exemplo n.º 25
0
BOOL CProcessMgr::AskIsSave()
{
	//如果没有临时工作路径或没有打开建模页面,不需要询问
	if (!m_sWorkPath.IsEmpty())
	{
		VIEW_DATA * pView = theViewMgr.Find( g_lpszViewTitleModel );
		if ( pView != NULL )
		{
			CDlgSvg * pSvg = reinterpret_cast< CDlgSvg * >( pView->m_dwExData );
			if ( pSvg != NULL )
			{
				if (GetProcessStateNeedSave())
				{
					int nRet = MessageBox(theApp.m_pMainWnd->GetSafeHwnd(), "是否保存当前正在编辑的设计过程", g_lpszAppTitle, MB_YESNOCANCEL|MB_ICONQUESTION);
					switch (nRet)
					{
					case IDYES:
						if (!OnSave())
						{
							//保存不成功时,中断后续操作
							return FALSE;
						}
						break;
					case IDNO:
						break;
					case IDCANCEL:
						//用户取消当前操作时,后续也不进行
						return FALSE;
						break;
					default:
						break;
					}
				}
			}
		}
	}

	//保存成功或者不保存时,都继续后续操作,新建或打开
	return TRUE;
}
Exemplo n.º 26
0
/*
 * Manual page at function.def
 */
INT16 CGEN_PROTECTED CFunction::OnSave()
{
  // Delegate to running function                                               // ------------------------------------
  FNC_DELEGATE OnSave();                                                        // Use a weird macro (see function.def)

  // Get arguments                                                              // ------------------------------------
  CDlpObject* iInst = GetActiveInstance();                                      // Get first instance argument
  if (m_nStackLen<=0)                                                           // Stack at least to contain file name
    return IERROR(this,FNC_STACKUNDERFLOW," on method ","-save",0);             //   Not so? Error!
  if (m_aStack[0].nType==T_INSTANCE) PopInstance(1);                            // Pop the active instance
  const char* lpsFilename = PopString(2);                                       // Get the file name

  // Prevent from saving other than the root function                           // ------------------------------------
  if (iInst && iInst->IsKindOf("function") && iInst!=GetRootFnc())              // Saving a function other than root
    return IERROR(this,FNC_NOTALLOWED,"-save","for non-root functions",0);      //   No go!

  // Do save                                                                    // ------------------------------------
  INT16 nFormat = 0;                                                            // The file format
  if (m_bXml) nFormat |= SV_XML;                                                // /xml selected
  if (m_bDn3) nFormat |= SV_DN3;                                                // /dn3 selected
  if (m_bZip) nFormat |= SV_ZIP;                                                // /zip selected
  return CDlpObject_Save(iInst,lpsFilename,nFormat);                            // Save the instance
}
Exemplo n.º 27
0
qtDLGExceptionEdit::qtDLGExceptionEdit(QWidget *parent, Qt::WFlags flags, DWORD exceptionCode, int handleException)
	: QDialog(parent, flags)
{
	setupUi(this);
	this->setFixedSize(this->width(),this->height());
	this->setStyleSheet(clsHelperClass::LoadStyleSheet());

	connect(pbSave,SIGNAL(clicked()),this,SLOT(OnSave()));
	connect(pbCancel,SIGNAL(clicked()),this,SLOT(OnCancel()));

	if(exceptionCode != NULL && handleException != -1)
	{
		leExceptionCode->setText(QString("%1").arg(exceptionCode,8,16,QChar('0')));
		leExceptionCode->setEnabled(false);

		switch(handleException)
		{
		case 0:
			cbHandleException->setCurrentIndex(0);
			break;
		case 1:
			cbHandleException->setCurrentIndex(1);
			break;
		case 2:
			cbHandleException->setCurrentIndex(2);
			break;
		default:
			cbHandleException->setCurrentIndex(0);
			break;
		}		
	}
	else
	{
		QStringList exceptionList = LoadExceptionList();
		leExceptionCode->setCompleter(new QCompleter(exceptionList,this));
	}
}
PageRecord::PageRecord(MainWindow* main_window)
	: QWidget(main_window->centralWidget()) {

	m_main_window = main_window;

	m_page_started = false;
	m_input_started = false;
	m_output_started = false;
	m_previewing = false;

	m_last_error_sound = std::numeric_limits<int64_t>::min();

	QGroupBox *groupbox_recording = new QGroupBox(tr("Recording"), this);
	{
		m_pushbutton_start_pause = new QPushButton(groupbox_recording);

		m_checkbox_hotkey_enable = new QCheckBox(tr("Enable recording hotkey"), groupbox_recording);
		m_checkbox_sound_notifications_enable = new QCheckBox(tr("Enable sound notifications"), groupbox_recording);
		QLabel *label_hotkey = new QLabel(tr("Hotkey:"), groupbox_recording);
		m_checkbox_hotkey_ctrl = new QCheckBox(tr("Ctrl +"), groupbox_recording);
		m_checkbox_hotkey_shift = new QCheckBox(tr("Shift +"), groupbox_recording);
		m_checkbox_hotkey_alt = new QCheckBox(tr("Alt +"), groupbox_recording);
		m_checkbox_hotkey_super = new QCheckBox(tr("Super +"), groupbox_recording);
		m_combobox_hotkey_key = new QComboBox(groupbox_recording);
		m_combobox_hotkey_key->setToolTip(tr("The key that you have to press (combined with the given modifiers) to start or pause recording.\n"
											 "The program that you are recording will not receive the key press."));
		// Note: The choice of keys is currently rather limited, because capturing key presses session-wide is a bit harder than it looks.
		// For example, applications are not allowed to capture the F1-F12 keys (on Ubuntu at least). The A-Z keys don't have this limitation apparently.
		for(unsigned int i = 0; i < 26; ++i) {
			m_combobox_hotkey_key->addItem(QString('A' + i));
		}

		connect(m_pushbutton_start_pause, SIGNAL(clicked()), this, SLOT(OnRecordStartPause()));
		connect(m_checkbox_hotkey_enable, SIGNAL(clicked()), this, SLOT(OnUpdateHotkeyFields()));
		connect(m_checkbox_sound_notifications_enable, SIGNAL(clicked()), this, SLOT(OnUpdateSoundNotifications()));
		connect(m_checkbox_hotkey_ctrl, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_shift, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_alt, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_super, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_combobox_hotkey_key, SIGNAL(activated(int)), this, SLOT(OnUpdateHotkey()));

		QVBoxLayout *layout = new QVBoxLayout(groupbox_recording);
		layout->addWidget(m_pushbutton_start_pause);
		{
			QHBoxLayout *layout2 = new QHBoxLayout();
			layout->addLayout(layout2);
			layout2->addWidget(m_checkbox_hotkey_enable);
			layout2->addWidget(m_checkbox_sound_notifications_enable);
		}
		{
			QHBoxLayout *layout2 = new QHBoxLayout();
			layout->addLayout(layout2);
			layout2->addWidget(label_hotkey);
			layout2->addWidget(m_checkbox_hotkey_ctrl);
			layout2->addWidget(m_checkbox_hotkey_shift);
			layout2->addWidget(m_checkbox_hotkey_alt);
			layout2->addWidget(m_checkbox_hotkey_super);
			layout2->addWidget(m_combobox_hotkey_key);
		}
	}
	QSplitter *splitter_vertical = new QSplitter(Qt::Vertical, this);
	{
		QSplitter *splitter_horizontal = new QSplitter(Qt::Horizontal, splitter_vertical);
		{
			QGroupBox *groupbox_information = new QGroupBox(tr("Information"), splitter_horizontal);
			{
				QLabel *label_total_time = new QLabel(tr("Total time:"), groupbox_information);
				m_label_info_total_time = new QLabel(groupbox_information);
				QLabel *label_frame_rate_in = new QLabel(tr("FPS in:"), groupbox_information);
				m_label_info_frame_rate_in = new QLabel(groupbox_information);
				QLabel *label_frame_rate_out = new QLabel(tr("FPS out:"), groupbox_information);
				m_label_info_frame_rate_out = new QLabel(groupbox_information);
				QLabel *label_size_in = new QLabel(tr("Size in:"), groupbox_information);
				m_label_info_size_in = new QLabel(groupbox_information);
				QLabel *label_size_out = new QLabel(tr("Size out:"), groupbox_information);
				m_label_info_size_out = new QLabel(groupbox_information);
				QLabel *label_file_name = new QLabel(tr("File name:"), groupbox_information);
				m_label_info_file_name = new ElidedLabel(QString(), Qt::ElideMiddle, groupbox_information);
				m_label_info_file_name->setMinimumWidth(100);
				QLabel *label_file_size = new QLabel(tr("File size:"), groupbox_information);
				m_label_info_file_size = new QLabel(groupbox_information);
				QLabel *label_bit_rate = new QLabel(tr("Bit rate:"), groupbox_information);
				m_label_info_bit_rate = new QLabel(groupbox_information);

				QGridLayout *layout = new QGridLayout(groupbox_information);
				layout->addWidget(label_total_time, 0, 0);
				layout->addWidget(m_label_info_total_time, 0, 1);
				layout->addWidget(label_frame_rate_in, 1, 0);
				layout->addWidget(m_label_info_frame_rate_in, 1, 1);
				layout->addWidget(label_frame_rate_out, 2, 0);
				layout->addWidget(m_label_info_frame_rate_out, 2, 1);
				layout->addWidget(label_size_in, 3, 0);
				layout->addWidget(m_label_info_size_in, 3, 1);
				layout->addWidget(label_size_out, 4, 0);
				layout->addWidget(m_label_info_size_out, 4, 1);
				layout->addWidget(label_file_name, 5, 0);
				layout->addWidget(m_label_info_file_name, 5, 1);
				layout->addWidget(label_file_size, 6, 0);
				layout->addWidget(m_label_info_file_size, 6, 1);
				layout->addWidget(label_bit_rate, 7, 0);
				layout->addWidget(m_label_info_bit_rate, 7, 1);
				layout->setColumnStretch(1, 1);
				layout->setRowStretch(8, 1);
			}
			QGroupBox *groupbox_preview = new QGroupBox(tr("Preview"), splitter_horizontal);
			{
				m_preview_page1 = new QWidget(groupbox_preview);
				{
					QLabel *label_preview_frame_rate = new QLabel(tr("Preview frame rate:"), m_preview_page1);
					m_spinbox_preview_frame_rate = new QSpinBox(m_preview_page1);
					m_spinbox_preview_frame_rate->setRange(1, 1000);
					m_spinbox_preview_frame_rate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
					QLabel *label_preview_note = new QLabel(tr("Note: Previewing requires extra CPU time (especially at high frame rates)."), m_preview_page1);
					label_preview_note->setWordWrap(true);
					label_preview_note->setAlignment(Qt::AlignLeft | Qt::AlignTop);
					label_preview_note->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::MinimumExpanding);

					QGridLayout *layout = new QGridLayout(m_preview_page1);
					layout->setMargin(0);
					layout->addWidget(label_preview_frame_rate, 0, 0);
					layout->addWidget(m_spinbox_preview_frame_rate, 0, 1);
					layout->addWidget(label_preview_note, 1, 0, 1, 2);
				}
				m_preview_page2 = new QWidget(groupbox_preview);
				{
					m_video_previewer = new VideoPreviewer(m_preview_page2);
					m_label_mic_icon = new QLabel(m_preview_page2);
					m_label_mic_icon->setPixmap(QIcon::fromTheme("audio-input-microphone").pixmap(24, 24));
					m_audio_previewer = new AudioPreviewer(m_preview_page2);

					QVBoxLayout *layout = new QVBoxLayout(m_preview_page2);
					layout->setMargin(0);
					layout->addWidget(m_video_previewer);
					{
						QHBoxLayout *layout2 = new QHBoxLayout();
						layout->addLayout(layout2);
						layout2->addStretch();
						layout2->addWidget(m_label_mic_icon);
						layout2->addWidget(m_audio_previewer);
						layout2->addStretch();
					}
				}
				m_pushbutton_preview_start_stop = new QPushButton(groupbox_preview);

				connect(m_pushbutton_preview_start_stop, SIGNAL(clicked()), this, SLOT(OnPreviewStartStop()));

				QVBoxLayout *layout = new QVBoxLayout(groupbox_preview);
				{
					m_stacked_layout_preview = new QStackedLayout();
					layout->addLayout(m_stacked_layout_preview);
					m_stacked_layout_preview->addWidget(m_preview_page1);
					m_stacked_layout_preview->addWidget(m_preview_page2);
				}
				layout->addWidget(m_pushbutton_preview_start_stop);
			}

			splitter_horizontal->addWidget(groupbox_information);
			splitter_horizontal->addWidget(groupbox_preview);
			splitter_horizontal->setStretchFactor(0, 1);
			splitter_horizontal->setStretchFactor(1, 3);
		}
		QGroupBox *groupbox_log = new QGroupBox(tr("Log"), splitter_vertical);
		{
			m_textedit_log = new QTextEditSmall(groupbox_log);
			m_textedit_log->setReadOnly(true);

			QVBoxLayout *layout = new QVBoxLayout(groupbox_log);
			layout->addWidget(m_textedit_log);
		}

		splitter_vertical->addWidget(splitter_horizontal);
		splitter_vertical->addWidget(groupbox_log);
		splitter_vertical->setStretchFactor(0, 3);
		splitter_vertical->setStretchFactor(1, 1);
	}

	QPushButton *button_cancel = new QPushButton(QIcon::fromTheme("process-stop"), tr("Cancel recording"), this);
	QPushButton *button_save = new QPushButton(QIcon::fromTheme("document-save"), tr("Save recording"), this);

	if(g_option_systray) {
		m_systray_icon = new QSystemTrayIcon(g_icon_ssr, m_main_window);
		QMenu *menu = new QMenu(m_main_window);
		m_systray_action_start_pause = menu->addAction(QString(), this, SLOT(OnRecordStartPause()));
		m_systray_action_save = menu->addAction(tr("Save recording"), this, SLOT(OnSave()));
		m_systray_action_cancel = menu->addAction(tr("Cancel recording"), this, SLOT(OnCancel()));
		menu->addSeparator();
		menu->addAction("Quit", m_main_window, SLOT(close()));
		m_systray_icon->setContextMenu(menu);
	} else {
		m_systray_icon = NULL;
	}

	connect(button_cancel, SIGNAL(clicked()), this, SLOT(OnCancel()));
	connect(button_save, SIGNAL(clicked()), this, SLOT(OnSave()));
	if(m_systray_icon != NULL)
		connect(m_systray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), m_main_window, SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason)));

	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->addWidget(groupbox_recording);
	layout->addWidget(splitter_vertical);
	{
		QHBoxLayout *layout2 = new QHBoxLayout();
		layout->addLayout(layout2);
		layout2->addWidget(button_cancel);
		layout2->addWidget(button_save);
	}

	UpdateSysTray();
	UpdateRecordPauseButton();
	UpdatePreview();

	m_timer_update_info = new QTimer(this);
	connect(m_timer_update_info, SIGNAL(timeout()), this, SLOT(OnUpdateInformation()));
	connect(&m_hotkey_start_pause, SIGNAL(Triggered()), this, SLOT(OnRecordStartPause()));
	connect(Logger::GetInstance(), SIGNAL(NewLine(Logger::enum_type,QString)), this, SLOT(OnNewLogLine(Logger::enum_type,QString)), Qt::QueuedConnection);

	if(m_systray_icon != NULL)
		m_systray_icon->show();

}
Exemplo n.º 29
0
EditorDialog::EditorDialog(QWidget * parent, osm::EditableMapObject & emo)
  : QDialog(parent), m_feature(emo)
{
  QGridLayout * grid = new QGridLayout();
  int row = 0;

  {  // Coordinates.
    ms::LatLon const ll = emo.GetLatLon();
    grid->addWidget(new QLabel("Latitude/Longitude:"), row, 0);
    QHBoxLayout * coords = new QHBoxLayout();
    coords->addWidget(new QLabel(QString::fromStdString(strings::to_string_dac(ll.lat, 7) + " " +
                                                        strings::to_string_dac(ll.lon, 7))));
    grid->addLayout(coords, row++, 1);
  }

  {  // Feature types.
    grid->addWidget(new QLabel("Type:"), row, 0);
    string localized = m_feature.GetLocalizedType();
    string const raw = DebugPrint(m_feature.GetTypes());
    if (!strings::EqualNoCase(localized, raw))
      localized += " (" + raw + ")";
    QLabel * label = new QLabel(QString::fromStdString(localized));
    label->setTextInteractionFlags(Qt::TextSelectableByMouse);
    grid->addWidget(label, row++, 1);
  }

  if (emo.IsNameEditable())
  {  // Names.
    char const * defaultLangStr =
        StringUtf8Multilang::GetLangByCode(StringUtf8Multilang::kDefaultCode);
    // Default name editor is always displayed, even if feature name is empty.
    grid->addWidget(new QLabel(QString("Name:")), row, 0);
    QLineEdit * defaultName = new QLineEdit();
    defaultName->setObjectName(defaultLangStr);
    QGridLayout * namesGrid = new QGridLayout();
    int namesRow = 0;
    namesGrid->addWidget(defaultName, namesRow++, 0, 1, 0);

    auto const namesDataSource = emo.GetNamesDataSource();

    for (auto const & ln : namesDataSource.names)
    {
      if (ln.m_code == StringUtf8Multilang::kDefaultCode)
      {
        defaultName->setText(QString::fromStdString(ln.m_name));
      }
      else
      {
        char const * langStr = StringUtf8Multilang::GetLangByCode(ln.m_code);
        namesGrid->addWidget(new QLabel(ln.m_lang), namesRow, 0);
        QLineEdit * lineEditName = new QLineEdit(QString::fromStdString(ln.m_name));
        lineEditName->setReadOnly(!emo.IsNameEditable());
        lineEditName->setObjectName(langStr);
        namesGrid->addWidget(lineEditName, namesRow++, 1);
      }
    }
    grid->addLayout(namesGrid, row++, 1);
  }

  if (emo.IsAddressEditable())
  {  // Address rows.
    auto nearbyStreets = emo.GetNearbyStreets();
    grid->addWidget(new QLabel(kStreetObjectName), row, 0);
    QComboBox * cmb = new QComboBox();
    cmb->setEditable(true);

    if (emo.GetStreet().m_defaultName.empty())
      cmb->addItem("");

    for (int i = 0; i < nearbyStreets.size(); ++i)
    {
      string street = nearbyStreets[i].m_defaultName;
      if (!nearbyStreets[i].m_localizedName.empty())
        street += " / " + nearbyStreets[i].m_localizedName;
      cmb->addItem(street.c_str());
      if (emo.GetStreet() == nearbyStreets[i])
        cmb->setCurrentIndex(i);
    }
    cmb->setObjectName(kStreetObjectName);
    grid->addWidget(cmb, row++, 1);

    grid->addWidget(new QLabel(kHouseNumberObjectName), row, 0);
    QLineEdit * houseLineEdit = new QLineEdit(emo.GetHouseNumber().c_str());
    houseLineEdit->setObjectName(kHouseNumberObjectName);
    grid->addWidget(houseLineEdit, row++, 1);

    grid->addWidget(new QLabel(kPostcodeObjectName), row, 0);
    QLineEdit * postcodeEdit = new QLineEdit(QString::fromStdString(emo.GetPostcode()));
    postcodeEdit->setObjectName(kPostcodeObjectName);
    grid->addWidget(postcodeEdit, row++, 1);
  }

  // Editable metadata rows.
  for (osm::Props const prop : emo.GetEditableProperties())
  {
    string v;
    switch (prop)
    {
    case osm::Props::Phone: v = emo.GetPhone(); break;
    case osm::Props::Fax: v = emo.GetFax(); break;
    case osm::Props::Email: v = emo.GetEmail(); break;
    case osm::Props::Website: v = emo.GetWebsite(); break;
    case osm::Props::Internet:
      {
        grid->addWidget(new QLabel(kInternetObjectName), row, 0);
        QComboBox * cmb = new QComboBox();
        string const values[] = {DebugPrint(osm::Internet::Unknown), DebugPrint(osm::Internet::Wlan),
                                 DebugPrint(osm::Internet::Wired), DebugPrint(osm::Internet::Yes),
                                 DebugPrint(osm::Internet::No)};
        for (auto const & v : values)
          cmb->addItem(v.c_str());
        cmb->setCurrentText(DebugPrint(emo.GetInternet()).c_str());
        cmb->setObjectName(kInternetObjectName);
        grid->addWidget(cmb, row++, 1);
      }
      continue;
    case osm::Props::Cuisine: v = strings::JoinStrings(emo.GetLocalizedCuisines(), ", "); break;
    case osm::Props::OpeningHours: v = emo.GetOpeningHours(); break;
    case osm::Props::Stars: v = strings::to_string(emo.GetStars()); break;
    case osm::Props::Operator: v = emo.GetOperator(); break;
    case osm::Props::Elevation:
      {
        double ele;
        if (emo.GetElevation(ele))
          v = strings::to_string_dac(ele, 2);
      }
      break;
    case osm::Props::Wikipedia: v = emo.GetWikipedia(); break;
    case osm::Props::Flats: v = emo.GetFlats(); break;
    case osm::Props::BuildingLevels: v = emo.GetBuildingLevels(); break;
    }
    QString const fieldName = QString::fromStdString(DebugPrint(prop));
    grid->addWidget(new QLabel(fieldName), row, 0);
    QLineEdit * lineEdit = new QLineEdit(QString::fromStdString(v));
    // Mark line editor to query it's text value when editing is finished.
    lineEdit->setObjectName(fieldName);
    grid->addWidget(lineEdit, row++, 1);
  }

  {  // Dialog buttons.
    QDialogButtonBox * buttonBox =
        new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Save);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(OnSave()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    // Delete button should send custom int return value from dialog.
    QPushButton * deletePOIButton = new QPushButton("Delete POI");
    QSignalMapper * signalMapper = new QSignalMapper();
    connect(deletePOIButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
    signalMapper->setMapping(deletePOIButton, QDialogButtonBox::DestructiveRole);
    connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(done(int)));
    buttonBox->addButton(deletePOIButton, QDialogButtonBox::DestructiveRole);
    grid->addWidget(buttonBox, row++, 1);
  }

  setLayout(grid);
  setWindowTitle("OSM Editor");
}
Exemplo n.º 30
0
    void KUiFontManage::OnListNotify(LPNMHDR pNotify)
    {
	    switch(pNotify->code)
	    {
	    case LVN_ITEMACTIVATE:
	    case NM_CLICK:
		    {
			    LPNMITEMACTIVATE pActive = (LPNMITEMACTIVATE)pNotify;
			    if (pActive->iItem >= 0)
			    {
                    m_nCurrentItemNum = pActive->iItem;

                    char szName[8] = "";
                    char szValue[32] = "";
                    int  nValue = 0;
                    sprintf(szName, "%d", pActive->iItem);
                    if (m_pFontIni == NULL) 
                        break;
                    m_pFontIni->GetString(szName, "Name", "", szValue, sizeof(szValue));
                    ::SetDlgItemText(m_hWnd, IDC_WND_FONT_MANAGE_FONT_NAME, szValue);
                    m_pFontIni->GetString(szName, "Color", "", szValue, sizeof(szValue));
                    ::SetDlgItemText(m_hWnd, IDC_WND_FONT_MANAGE_FONT_COLOR, szValue);
                    m_pFontIni->GetString(szName, "BorderColor", "", szValue, sizeof(szValue));
                    ::SetDlgItemText(m_hWnd, IDC_WND_FONT_MANAGE_FONT_BCOLOR, szValue);
					m_pFontIni->GetString(szName, "ProjectionColor", "", szValue, sizeof(szValue));
					::SetDlgItemText(m_hWnd, IDC_WND_FONT_MANAGE_FONT_PCOLOR, szValue);
                    m_pFontIni->GetInteger(szName, "Size", 0, &nValue);
                    ::SetDlgItemInt(m_hWnd, IDC_WND_FONT_MANAGE_FONT_SIZE, nValue, false);
                    m_pFontIni->GetInteger(szName, "BorderSize", 0, &nValue);
                    ::SetDlgItemInt(m_hWnd, IDC_WND_FONT_MANAGE_FONT_BSIZE, nValue, false);
					m_pFontIni->GetInteger(szName, "ProjectionSize", 0, &nValue);
					::SetDlgItemInt(m_hWnd, IDC_WND_FONT_MANAGE_FONT_PSIZE, nValue, false);
                    m_pFontIni->GetInteger(szName, "FontID", 0, &nValue);
                    ::SetDlgItemInt(m_hWnd, IDC_WND_FONT_MANAGE_FONT_TYPE, nValue, false);


                    DRAWITEMSTRUCT stDrawItem;
                    stDrawItem.hDC = GetDC(m_hListWnd);
                    stDrawItem.itemID = pActive->iItem;
                    stDrawItem.itemState = ODS_SELECTED;
                    stDrawItem.CtlType = ODT_LISTVIEW;
                    stDrawItem.hwndItem = m_hListWnd;
                    SendMessage(GetParent(m_hListWnd), WM_DRAWITEM, (WPARAM)m_hListWnd, (LPARAM)&stDrawItem);
                  
			    }
		    }
		    break;
        case NM_RCLICK:
            {
			    LPNMITEMACTIVATE pActive = (LPNMITEMACTIVATE)pNotify;
			    if (pActive->iItem >= 0)
			    {
                    m_nCurrentItemNum = pActive->iItem;

                    char szName[8] = "";
                    char szValue[32] = "";
                    int  nValue = 0;
                    sprintf(szName, "%d", pActive->iItem);
                    if (m_pFontIni == NULL) 
                        break;
					m_pFontIni->GetString(szName, "Name", "", szValue, sizeof(szValue));
					::SetDlgItemText(m_hWnd, IDC_WND_FONT_MANAGE_FONT_NAME, szValue);
					m_pFontIni->GetString(szName, "Color", "", szValue, sizeof(szValue));
					::SetDlgItemText(m_hWnd, IDC_WND_FONT_MANAGE_FONT_COLOR, szValue);
					m_pFontIni->GetString(szName, "BorderColor", "", szValue, sizeof(szValue));
					::SetDlgItemText(m_hWnd, IDC_WND_FONT_MANAGE_FONT_BCOLOR, szValue);
					m_pFontIni->GetString(szName, "ProjectionColor", "", szValue, sizeof(szValue));
					::SetDlgItemText(m_hWnd, IDC_WND_FONT_MANAGE_FONT_PCOLOR, szValue);
					m_pFontIni->GetInteger(szName, "Size", 0, &nValue);
					::SetDlgItemInt(m_hWnd, IDC_WND_FONT_MANAGE_FONT_SIZE, nValue, false);
					m_pFontIni->GetInteger(szName, "BorderSize", 0, &nValue);
					::SetDlgItemInt(m_hWnd, IDC_WND_FONT_MANAGE_FONT_BSIZE, nValue, false);
					m_pFontIni->GetInteger(szName, "ProjectionSize", 0, &nValue);
					::SetDlgItemInt(m_hWnd, IDC_WND_FONT_MANAGE_FONT_PSIZE, nValue, false);
					m_pFontIni->GetInteger(szName, "FontID", 0, &nValue);
					::SetDlgItemInt(m_hWnd, IDC_WND_FONT_MANAGE_FONT_TYPE, nValue, false);


                    DRAWITEMSTRUCT stDrawItem;
                    stDrawItem.hDC = GetDC(m_hListWnd);
                    stDrawItem.itemID = pActive->iItem;
                    stDrawItem.itemState = ODS_SELECTED;
                    stDrawItem.CtlType = ODT_LISTVIEW;
                    stDrawItem.hwndItem = m_hListWnd;
                    SendMessage(GetParent(m_hListWnd), WM_DRAWITEM, (WPARAM)m_hListWnd, (LPARAM)&stDrawItem);

                    if (pActive->iSubItem == 1) 
                    {
                        OnChangeColor(0, 1);
                        SendMessage(GetParent(m_hListWnd), WM_DRAWITEM, (WPARAM)m_hListWnd, (LPARAM)&stDrawItem);
                    }

                    if (pActive->iSubItem == 2) 
                    {
                        OnChangeColor(1, 1);
                        SendMessage(GetParent(m_hListWnd), WM_DRAWITEM, (WPARAM)m_hListWnd, (LPARAM)&stDrawItem);
                    }

					if (pActive->iSubItem == 3) 
					{
						OnChangeColor(2, 1);
						SendMessage(GetParent(m_hListWnd), WM_DRAWITEM, (WPARAM)m_hListWnd, (LPARAM)&stDrawItem);
					}
                   
			    }
		    }
            break;
        case NM_DBLCLK:
            {
			    LPNMITEMACTIVATE pActive = (LPNMITEMACTIVATE)pNotify;
			    if (pActive->iItem >= 0 && pActive->iItem < ListView_GetItemCount(m_hListWnd) && !m_bManage)
			    {
                    m_nCurrentItemNum = pActive->iItem;
                    OnSave(m_szFontFileName);
                    m_bSel = TRUE;
                    PostMessage(m_hWnd, WM_CLOSE, 0, 0);
                }
            }
            break;

	    }
    }