SessionConfigWindow::SessionConfigWindow() :
    LxQt::ConfigDialog(tr("LXQt Session Settings"), new LxQt::Settings("session"), 0)
{
    BasicSettings* basicSettings = new BasicSettings(mSettings, this);
    addPage(basicSettings, tr("Basic Settings"), "preferences-desktop-display-color");
    connect(basicSettings, SIGNAL(needRestart()), SLOT(setRestart()));
    connect(this, SIGNAL(reset()), basicSettings, SLOT(restoreSettings()));
    connect(this, SIGNAL(save()), basicSettings, SLOT(save()));

    DefaultApps* defaultApps = new DefaultApps(this);
    addPage(defaultApps, tr("Default Applications"), "preferences-desktop-filetype-association");

    AutoStartPage* autoStart = new AutoStartPage(this);
    addPage(autoStart, tr("Autostart"), "preferences-desktop-launch-feedback");
    connect(this, SIGNAL(reset()), autoStart, SLOT(restoreSettings()));
    connect(this, SIGNAL(save()), autoStart, SLOT(save()));

    EnvironmentPage* environmentPage = new EnvironmentPage(mSettings, this);
    addPage(environmentPage, tr("Environment (Advanced)"), "preferences-system-session-services");
    connect(environmentPage, SIGNAL(needRestart()), SLOT(setRestart()));
    connect(this, SIGNAL(reset()), environmentPage, SLOT(restoreSettings()));
    connect(this, SIGNAL(save()), environmentPage, SLOT(save()));

    // sync Default Apps and Environment
    connect(environmentPage, SIGNAL(envVarChanged(QString,QString)),
            defaultApps, SLOT(updateEnvVar(QString,QString)));
    connect(defaultApps, SIGNAL(defaultAppChanged(QString,QString)),
            environmentPage, SLOT(updateItem(QString,QString)));
    environmentPage->restoreSettings();
    connect(this, SIGNAL(reset()), SLOT(clearRestart()));
    m_restart = false;
}
Example #2
0
DesktopConfigWindow::DesktopConfigWindow()
    : QMainWindow(),
      m_restart(false)
{
    setupUi(this);

    // pages
    new QListWidgetItem(XdgIcon::fromTheme("preferences-desktop"), tr("Basic Settings"), listWidget);
    new QListWidgetItem(XdgIcon::fromTheme("show-menu"), tr("Menu Configuration"), listWidget);
    new QListWidgetItem(XdgIcon::fromTheme("preferences-desktop-personal"), tr("WM Native Desktop"), listWidget);
    listWidget->setCurrentRow(0);
    
    desktopTypeComboBox->addItem("Razor Desktop", "razor");
    desktopTypeComboBox->addItem("Window Manager Native", "wm_native");
    
    m_settings = new RazorSettings("desktop", this);
    m_cache = new RazorSettingsCache(m_settings);
    restoreSettings();
    
    connect(desktopTypeComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(desktopTypeComboBox_currentIndexChanged(int)));
    // UI stuff
    connect(chooseMenuFilePB, SIGNAL(clicked()), this, SLOT(chooseMenuFile()));
    //
    connect(nativeWallpaperButton, SIGNAL(clicked()), this, SLOT(nativeWallpaperButton_clicked()));
    //
    // notify it needs restart
    connect(singleclickButton, SIGNAL(clicked()), this, SLOT(setRestart()));
    connect(doubleclickButton, SIGNAL(clicked()), this, SLOT(setRestart()));
    connect(nativeIconsCheckBox, SIGNAL(clicked()), this, SLOT(setRestart()));
    connect(nativeWallpaperEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setRestart()));
    connect(wheelDesktopCheckBox, SIGNAL(toggled(bool)), this, SLOT(setRestart()));
    //
    connect(buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*)));
}
/*!
 * The Check button controlling whether page numbering should be restarted at
 * section has been changed.
 */
void AP_UnixDialog_HdrFtr::RestartChanged(void)
{
	UT_sint32 RestartValue = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(m_wSpin));
	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (m_wRestartButton)))
	{
		gtk_widget_set_sensitive(m_wRestartLabel,TRUE);
		gtk_widget_set_sensitive(m_wSpin,TRUE);
		setRestart(true, RestartValue, true);
	}
	else
	{
		gtk_widget_set_sensitive(m_wRestartLabel,FALSE);
		gtk_widget_set_sensitive(m_wSpin,FALSE);
		setRestart(false, RestartValue, true);
	}
}
Example #4
0
BOOL AP_Win32Dialog_HdrFtr::_onCommand(HWND hWnd, WPARAM wParam, LPARAM /*lParam*/)
{
	WORD wNotifyCode = HIWORD(wParam);
	WORD wId = LOWORD(wParam);

	switch (wId)
	{
	case AP_RID_DIALOG_HDRFTR_BTN_CANCEL:
		setAnswer( a_CANCEL );
		EndDialog(hWnd,0);
		return 1;

	case AP_RID_DIALOG_HDRFTR_BTN_OK:
		{
			bool bHdrEven  = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_HDRFACING) != 0;
			bool bHdrFirst = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_HDRFIRST)  != 0;
			bool bHdrLast  = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_HDRLAST)   != 0;
			bool bFtrEven  = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_FTRFACING) != 0;
			bool bFtrFirst = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_FTRFIRST)  != 0;
			bool bFtrLast  = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_FTRLAST)   != 0;
 			bool bRestart  = _win32Dialog.isChecked(AP_RID_DIALOG_HDRFTR_CHK_SECTION)   != 0;
			UT_sint32 val  = _win32Dialog.getControlInt(AP_RID_DIALOG_HDRFTR_EBX_SECTION);

			setValue( HdrEven,  bHdrEven,  bHdrEven  != getValue(HdrEven)  );
			setValue( HdrFirst, bHdrFirst, bHdrFirst != getValue(HdrFirst) );
			setValue( HdrLast,  bHdrLast,  bHdrLast  != getValue(HdrLast)  );
			setValue( FtrEven,  bFtrEven,  bFtrEven  != getValue(FtrEven)  );
			setValue( FtrFirst, bFtrFirst, bFtrFirst != getValue(FtrFirst) );
			setValue( FtrLast,  bFtrLast,  bFtrLast  != getValue(FtrLast)  );
			setRestart( bRestart, val, (bRestart != isRestart() || val != getRestartValue()) );
		}
		setAnswer( a_OK );
		EndDialog(hWnd,0);
		return 1;

	case AP_RID_DIALOG_HDRFTR_CHK_SECTION:
		_win32Dialog.enableControl(AP_RID_DIALOG_HDRFTR_LBL_SECTION, _win32Dialog.isChecked(wId)!=0);
		_win32Dialog.enableControl(AP_RID_DIALOG_HDRFTR_EBX_SECTION, _win32Dialog.isChecked(wId)!=0);
		_win32Dialog.enableControl(AP_RID_DIALOG_HDRFTR_SPN_SECTION, _win32Dialog.isChecked(wId)!=0);	
		return 1;

	case AP_RID_DIALOG_HDRFTR_EBX_SECTION:
		if( wNotifyCode == EN_KILLFOCUS )
		{
			UT_sint32 value = _win32Dialog.getControlInt(AP_RID_DIALOG_HDRFTR_EBX_SECTION);
			_win32Dialog.setControlInt(AP_RID_DIALOG_HDRFTR_EBX_SECTION, value );
		}
		return 1;

	default:							// we did not handle this notification
		UT_DEBUGMSG(("WM_Command for id %ld\n",wId));
		return 0;						// return zero to let windows take care of it.
	}
}
/*!
 * Update the XP values of the spin button.
 */
void AP_UnixDialog_HdrFtr::RestartSpinChanged(void)
{
	UT_sint32 RestartValue = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(m_wSpin));
	setRestart(true, RestartValue, true);
}
Example #6
0
void System::handleMenu(MAEvent &event) {
  int menuId = event.optionsBoxButtonIndex;
  int fontSize = _output->getFontSize();
  int menuItem = _systemMenu[menuId];
  delete [] _systemMenu;
  _systemMenu = NULL;

  switch (menuItem) {
  case MENU_SOURCE:
    showSystemScreen(true);
    break;
  case MENU_CONSOLE:
    showSystemScreen(false);
    break;
  case MENU_KEYPAD:
    maShowVirtualKeyboard();
    break;
  case MENU_RESTART:
    setRestart();
    break;
  case MENU_BACK:
    setBack();
    break;
  case MENU_ZOOM_UP:
    if (_fontScale > FONT_MIN) {
      _fontScale -= FONT_SCALE_INTERVAL;
      fontSize = (_initialFontSize * _fontScale / 100);
    }
    break;
  case MENU_ZOOM_DN:
    if (_fontScale < FONT_MAX) {
      _fontScale += FONT_SCALE_INTERVAL;
      fontSize = (_initialFontSize * _fontScale / 100);
    }
    break;
  case MENU_COPY:
  case MENU_CUT:
    if (get_focus_edit() != NULL) {
      char *text = get_focus_edit()->copy(menuItem == MENU_CUT);
      if (text) {
        setClipboardText(text);
        free(text);
        _output->redraw();
      }
    }
    break;
  case MENU_PASTE:
    if (get_focus_edit() != NULL) {
      char *text = getClipboardText();
      get_focus_edit()->paste(text);
      _output->redraw();
      free(text);
    }
    break;
  case MENU_SELECT_ALL:
    if (get_focus_edit() != NULL) {
      get_focus_edit()->selectAll();
      _output->redraw();
    }
    break;
  case MENU_CTRL_MODE:
    if (get_focus_edit() != NULL) {
      bool controlMode = get_focus_edit()->getControlMode();
      get_focus_edit()->setControlMode(!controlMode);
    }
    break;
  case MENU_EDITMODE:
    opt_ide = (opt_ide == IDE_NONE ? IDE_INTERNAL : IDE_NONE);
    break;
  case MENU_AUDIO:
    opt_mute_audio = !opt_mute_audio;
    break;
  case MENU_SCREENSHOT:
    ::screen_dump();
    break;
  case MENU_UNDO:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_CTRL('z');
    break;
  case MENU_REDO:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_CTRL('y');
    break;
  case MENU_SAVE:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_CTRL('s');
    break;
  case MENU_RUN:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_F(9);
    break;
  case MENU_DEBUG:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_F(5);
    break;
  case MENU_OUTPUT:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_CTRL('o');
    break;
  case MENU_HELP:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_F(1);
    break;
  case MENU_SHORTCUT:
    if (!_activeFile.empty()) {
      addShortcut(_activeFile.c_str());
    }
    break;
  case MENU_SHARE:
    if (!_activeFile.empty()) {
      share(_activeFile.c_str());
    }
    break;
  case MENU_COMPLETION_0:
    completeKeyword(0);
    break;
  case MENU_COMPLETION_1:
    completeKeyword(1);
    break;
  case MENU_COMPLETION_2:
    completeKeyword(2);
    break;
  case MENU_COMPLETION_3:
    completeKeyword(3);
    break;
  }

  if (fontSize != _output->getFontSize()) {
    // restart the shell
    _output->setFontSize(fontSize);
    setRestart();
  }

  if (!isRunning()) {
    _output->flush(true);
  }
}
Example #7
0
void POD<TruthModelType>::fillPodMatrix( const wn_type& elements_set)
{
    if( M_use_solutions )
    {
        boost::mpi::timer timer;

        //M_bdf->setRestart( true );
        int K = M_bdf->timeValues().size()-1;
        M_pod_matrix.resize( K,K );

        auto bdfi = M_bdf->deepCopy();
        auto bdfj = M_bdf->deepCopy();

        bdfi->setRestart( true );
        bdfj->setRestart( true );
        bdfi->setTimeInitial( M_time_initial );
        bdfj->setTimeInitial( M_time_initial );
        bdfi->setRestartAtLastSave(false);
        bdfj->setRestartAtLastSave(false);
        for ( bdfi->restart(); !bdfi->isFinished(); bdfi->next() )
        {
            int i = bdfi->iteration()-1;
            bdfi->loadCurrent();

            //here is a barrier. For now, if this barrier is removed,
            //during the bdfj->restart() the program will wait and the memory increase.
            //during the init step in bdf, the metadata are read,
            //and it is during this step that the memory could increase dangerously.
            Environment::worldComm().barrier();

            for ( bdfj->restart(); !bdfj->isFinished() && ( bdfj->iteration() < bdfi->iteration() ); bdfj->next() )
            {
                int j = bdfj->iteration()-1;
                bdfj->loadCurrent();

                M_pod_matrix( i,j ) = M_model->scalarProductForPod( bdfj->unknown( 0 ), bdfi->unknown( 0 ) );
                M_pod_matrix( j,i ) = M_pod_matrix( i,j );
            }

            M_pod_matrix( i,i ) = M_model->scalarProductForPod( bdfi->unknown( 0 ), bdfi->unknown( 0 ) );
        }
        double time=timer.elapsed();
        if( Environment::worldComm().isMasterRank() )
        {
            std::cout<<"POD matrix filled in  "<<time<<" s"<<std::endl;
        }
    }//fill pod matrix with solutions
    else
    {
        //use elements given by CRB
        int size = elements_set.size();
        M_pod_matrix.resize( size , size );
        CHECK( size > 0 )<<" elements set doesn't conatin any element\n";
        for(int i=0; i<size; i++)
        {
            for(int j=i+1; j<size; j++)
            {
                M_pod_matrix( i,j ) = M_model->scalarProductForPod( elements_set[i], elements_set[j] );
                M_pod_matrix( j,i ) = M_pod_matrix( i,j );
            }
            M_pod_matrix( i,i ) = M_model->scalarProductForPod( elements_set[i] , elements_set[i] );
        }
    }
}//fillPodMatrix