void PreferencesDialog::removePath(bool checked)
{
  int row = m_searchPaths->currentRow();
  if (row != -1)
  {
    QStringList searchPaths = GetPreferences()->getSearchPaths();
    searchPaths.removeAt(row);
    GetPreferences()->setSearchPaths(searchPaths);
    
    // Could use takeItem() and delete here.
    m_searchPaths->clear();
    m_searchPaths->addItems(searchPaths);
  }
}
Example #2
0
// if successful, will set displayedScene and displayedSceneName
bool Viewer::loadScene( const QString & fileName )
{
  if ( ! fileName.isEmpty() && ( fileName != m_displayedSceneName ) )
  {
    if ( !m_viewerPlugInCallback )
    {
      m_viewerPlugInCallback = new viewerPlugInCallback();
    }
    m_viewState.reset();    // clear the current scene before loading the next one!
    try
    {
      m_viewState = dp::sg::io::loadScene( fileName.toStdString(), GetPreferences()->getSearchPathsAsStdVector(), m_viewerPlugInCallback.get() );
      if ( m_viewState )
      {
        LogMessage( "Loading Scene: '%s' - SUCCESS\n", fileName.toStdString().c_str() );
        m_displayedSceneName = fileName;
      }
      else
      {
        LogError( "Loading Scene: '%s' - FAILED\n", fileName.toStdString().c_str() );
        m_displayedSceneName.clear();
      }
    }
    catch ( std::exception const & e )
    {
      LogError( e.what() );
      m_displayedSceneName.clear();
    }
    emit sceneChanged();
    m_sceneStateUndoStack.clear();
    m_parameterUndoStack.clear();
    outputStatistics();
  }
  return( !!m_viewState );
}
void PreferencesDialog::moveDownPath(bool checked)
{
  int row = m_searchPaths->currentRow();
  if (row != -1 && row < m_searchPaths->count() - 1)
  {
    QStringList searchPaths = GetPreferences()->getSearchPaths();
    QString path = searchPaths.at(row);
    searchPaths.removeAt(row);
    searchPaths.insert(row + 1, path);
    GetPreferences()->setSearchPaths(searchPaths);
    
    m_searchPaths->clear();
    m_searchPaths->addItems(searchPaths);
    m_searchPaths->setCurrentRow(row + 1);
  }
}
Example #4
0
bool StocksResyncEntry(StocksEntry& e, ulong_t skipPortfolio)
{
    const StocksPrefs& prefs = GetPreferences()->stocksPrefs;

    ulong_t pc = prefs.portfolioCount();
    for (ulong_t  j = 0; j < pc; ++j)
    {
        if (j == skipPortfolio)
            continue;
             
        const StocksPortfolio& pp = prefs.portfolio(j);
        ulong_t ss = pp.size();
        for (ulong_t k = 0; k < ss; ++k)
        {
            const StocksEntry& ee = pp.entry(k);
            if (StrEquals(e.symbol, ee.symbol))
            {
                e.change = ee.change;
                e.percentChange = ee.percentChange;
                e.trade = ee.trade;
                return true;
            }   
        }
    }
    return false;
}
Example #5
0
	MainFrame::~MainFrame ()
	{
#if defined(TC_UNIX) && !defined(TC_MACOSX)
		if (ShowRequestFifo != -1)
		{
			try
			{
				close (ShowRequestFifo);
				remove (string (GetShowRequestFifoPath()).c_str());
			}
			catch (...) { }
		}
#endif

		Core->VolumeMountedEvent.Disconnect (this);
		Core->VolumeDismountedEvent.Disconnect (this);
		Gui->OpenVolumeSystemRequestEvent.Disconnect (this);
		Gui->PreferencesUpdatedEvent.Disconnect (this);

		VolumeHistory::DisconnectComboBox (VolumePathComboBox);

#ifdef TC_WINDOWS
		Hotkey::UnregisterList (this, GetPreferences().Hotkeys);
#endif
	}
QmitkExternalProgramsPreferencePage::QmitkExternalProgramsPreferencePage()
  : m_Preferences(GetPreferences()),
    m_Ui(new Ui::QmitkExternalProgramsPreferencePage),
    m_Control(NULL),
    m_GnuplotProcess(NULL)
{
}
QmitkExternalProgramsPreferencePage::QmitkExternalProgramsPreferencePage()
  : m_Preferences(GetPreferences()),
    m_Ui(new Ui::QmitkExternalProgramsPreferencePage),
    m_Control(nullptr),
    m_FFmpegProcess(nullptr),
    m_GnuplotProcess(nullptr)
{
}
Example #8
0
status_t HoroscopeFetch(uint_t index)
{
    assert(index < horoscopesSignCount);
    HoroscopesPrefs& prefs = GetPreferences()->horoscopesPrefs;
    prefs.pendingSign = index; 
    const char* name = signNames[index];
    return HoroscopeFetch(name);
}
Example #9
0
ProjectGenerator::ProjectGenerator()
: nuiSimpleContainer(), mEventSink(this)
{
  SetObjectName(_T("ProjectGenerator"));
  mpTimer = NULL;
  
  GetPreferences().GetString(PREFERENCES_PROJECTGENERATOR, _T("nuiSourcePath"), mNuiSourcePath);
  if (!GetPreferences().GetString(PREFERENCES_PROJECTGENERATOR, _T("nuiTargetPath"), mProjectTargetPath))
  {
    nglPath userPath(ePathUser);
    mProjectTargetPath = userPath.GetPathName();    
  }
  mProjectTargetPath.Append(_T("/newNuiProject"));
  
  
  
  nuiVBox* pVBox = new nuiVBox(0);
  pVBox->SetExpand(nuiExpandShrinkAndGrow);
  AddChild(pVBox);
  
  pVBox->AddCell(BuildBlocSourceDirectory());

  pVBox->AddCell(new nuiSeparator(nuiHorizontal));
  
  pVBox->AddCell(BuildBlocProjectDirectory());

  pVBox->AddCell(new nuiSeparator(nuiHorizontal));
  
  pVBox->AddCell(BuildBlocOptions());

  pVBox->AddCell(new nuiSeparator(nuiHorizontal));
  
  pVBox->AddCell(BuildBlocButtons());
  
  
  
  
  mpTimer = new nuiTimer(0.5 /*0.5s*/);
  mEventSink.Connect(mpTimer->Tick, &ProjectGenerator::OnTimerTick);
  
  if (mNuiSourcePath != nglString::Null)
  {
    nuiEvent event;
    OnTimerTick(event);
  }
}
Example #10
0
 QString getLastFileOpenPath() const
 {
   berry::IPreferences::Pointer prefs = GetPreferences();
   if(prefs.IsNotNull())
   {
     return prefs->Get("LastFileOpenPath", "");
   }
   return QString();
 }
Example #11
0
 void setLastFileOpenPath(const QString& path) const
 {
   berry::IPreferences::Pointer prefs = GetPreferences();
   if(prefs.IsNotNull())
   {
     prefs->Put("LastFileOpenPath", path);
     prefs->Flush();
   }
 }
Example #12
0
 bool GetOpenEditor() const
 {
   berry::IPreferences::Pointer prefs = GetPreferences();
   if(prefs.IsNotNull())
   {
     return prefs->GetBool("OpenEditor", true);
   }
   return true;
 }
Example #13
0
void PreferencesDialog::restore()
{
  Preferences *preferences = GetPreferences();

  preferences->setSearchPaths( m_restoreSearchPaths );
  preferences->setEnvironmentEnabled( m_restoreEnvironmentEnabled );
  preferences->setEnvironmentTextureName( m_restoreEnvironmentTextureName );
  preferences->setMaterialCatalogPath( m_restoreMaterialCatalogPath );
}
Example #14
0
void PreferencesDialog::selectEnvironmentMap( bool checked )
{
  QString textureFile = GetApp()->getMainWindow()->getTextureFile( dp::fx::PT_SAMPLER_2D );
  if ( ! textureFile.isEmpty() )
  {
    m_environmentMapLabel->setText( textureFile );
    GetPreferences()->setEnvironmentTextureName( textureFile );
  }
}
Example #15
0
struct GroupData *ServerDB::GroupDB::GenerateGroup() const {
    struct GroupData *ret = new struct GroupData();
    ret->UID = GenerateUID();

    LoadGroup(ret, GetPreferences());

    return ret;

}
Example #16
0
void PreferencesDialog::addPath(bool checked)
{
  // Open folder selection dialog.
  QString path = QFileDialog::getExistingDirectory(this, "Add Search Path");
  if (!path.isEmpty())
  {
    // Append it to the preferences search paths if it doesn't exist already.
    QStringList searchPaths = GetPreferences()->getSearchPaths();
    if (!searchPaths.contains(path))
    {
      searchPaths.append(path);
      GetPreferences()->setSearchPaths(searchPaths);

      // Add it to the search path QListWidget
      m_searchPaths->addItem(path);
    }
  }
}
Example #17
0
void PreferencesDialog::selectMaterialCatalogPath( bool checked )
{
  QString directory = QFileDialog::getExistingDirectory( this, "Select the path for the Material Catalog", GetPreferences()->getMaterialCatalogPath()
                                                       , QFileDialog::ShowDirsOnly | QFileDialog::HideNameFilterDetails );
  if ( !directory.isEmpty() )
  {
    m_materialCatalogLabel->setText( directory );
    GetPreferences()->setMaterialCatalogPath( directory );
  }
}
Example #18
0
void ProjectGenerator::OnSourceSelected(const nuiEvent& rEvent)
{
  nuiDialogSelectDirectory* pDialog = (nuiDialogSelectDirectory*)rEvent.mpUser;
  mNuiSourcePath = pDialog->GetSelectedDirectory();
  mpNuiSource->SetText(mNuiSourcePath);
  
  OnTimerTick(rEvent);

  GetPreferences().SetString(PREFERENCES_PROJECTGENERATOR, _T("nuiSourcePath"), mNuiSourcePath);
}
Example #19
0
bool StocksUpdateFromUDF(const UniversalDataFormat& udf)
{
    StocksPrefs& prefs = GetPreferences()->stocksPrefs;
    StocksPortfolio& p = prefs.portfolio(prefs.currentPortfolio);
    ulong_t len = udf.getItemsCount();
    assert(len == p.size()); 
    for (ulong_t i = 0; i < len; ++i)
    {
        StocksEntry& e = p.entry(i);
        assert(udf.getItemElementsCount(i) >= 2);
        
        free(e.url);
        e.url = StringCopy(udf.getItemData(i, stocksListItemUrlIndex));
        if (NULL == e.url)
            return false;
            
        const char_t* symbol = udf.getItemText(i, stocksListItemSymbolIndex);

        if (equalsIgnoreCase(symbol, e.symbol))
        {
            assert(stocksListElementsCount == udf.getItemElementsCount(i));
            e.status = e.statusReady;
            const char* trade = udf.getItemData(i, stocksListItemTradeIndex);
            const char* change = udf.getItemData(i, stocksListItemChangeIndex);
            const char* percent = udf.getItemData(i, stocksListItemPercentChangeIndex);
            if (errNone != numericValue(trade, -1, e.trade))
                return false;
            if (errNone != numericValue(change, -1, e.change))
                return false;
            ulong_t len = Len(percent);
            if (0 == len || '%' != percent[len - 1])
                return false;
            if (errNone != numericValue(percent, len - 1, e.percentChange))
                return false; 
        } 
        else if (equalsIgnoreCase(symbol, _T("?")))
        {
            assert(stocksListNotFoundElementsCount == udf.getItemElementsCount(i));
            e.status = e.statusAmbiguous;
        }
        else
        {
            assert(stocksListNotFoundElementsCount == udf.getItemElementsCount(i));
            free(e.data);
            e.data = StringCopy(symbol);
            if (NULL == e.data)
                return false;
            e.status = e.statusChanged; 
        }
    }  
    return true;
}
Example #20
0
	MainFrame::MainFrame (wxWindow* parent) : MainFrameBase (parent),
		ListItemRightClickEventPending (false),
		SelectedItemIndex (-1),
		SelectedSlotNumber (0),
		ShowRequestFifo (-1)
	{
		wxBusyCursor busy;

		SetName (Application::GetName());
		SetTitle (Application::GetName());
		SetIcon (Resources::GetTrueCrypt64Icon());

#if defined(TC_UNIX) && !defined(TC_MACOSX)
		try
		{
			string fifoPath = GetShowRequestFifoPath();

			remove (fifoPath.c_str());
			throw_sys_if (mkfifo (fifoPath.c_str(), S_IRUSR | S_IWUSR) == -1);

			ShowRequestFifo = open (fifoPath.c_str(), O_RDONLY | O_NONBLOCK);
			throw_sys_if (ShowRequestFifo == -1);
		}
		catch (...)
		{
#ifdef DEBUG
			throw;
#endif
		}
#endif

		InitControls();
		InitPreferences();
		InitTaskBarIcon();
		InitEvents();
		InitMessageFilter();

		if (!GetPreferences().SecurityTokenModule.IsEmpty() && !SecurityToken::IsInitialized())
		{
			try
			{
				Gui->InitSecurityTokenLibrary();
			}
			catch (exception &e)
			{
				Gui->ShowError (e);
			}
		}
	}
void QmitkSegmentationView::ApplyDisplayOptions(mitk::DataNode* node)
{
  if (!node)
  {
    return;
  }

  mitk::BoolProperty::Pointer drawOutline = mitk::BoolProperty::New(GetPreferences()->GetBool("draw outline", true));
  mitk::BoolProperty::Pointer volumeRendering = mitk::BoolProperty::New(GetPreferences()->GetBool("volume rendering", false));
  mitk::LabelSetImage* labelSetImage = dynamic_cast<mitk::LabelSetImage*>(node->GetData());
  if (nullptr != labelSetImage)
  {
    // node is actually a multi label segmentation,
    // but its outline property can be set in the 'single label' segmentation preference page as well
    node->SetProperty("labelset.contour.active", drawOutline);
    node->SetProperty("opacity", mitk::FloatProperty::New(drawOutline->GetValue() ? 1.0f : 0.3f));
    node->SetProperty("volumerendering", volumeRendering);
    // force render window update to show outline
    node->GetData()->Modified();
  }
  else
  {
    // node is a 'single label' segmentation
    bool isBinary = false;
    node->GetBoolProperty("binary", isBinary);
    if (isBinary)
    {
      node->SetProperty("outline binary", drawOutline);
      node->SetProperty("outline width", mitk::FloatProperty::New(2.0));
      node->SetProperty("opacity", mitk::FloatProperty::New(drawOutline->GetValue() ? 1.0f : 0.3f));
      node->SetProperty("volumerendering", volumeRendering);
      // force render window update to show outline
      node->GetData()->Modified();
    }
  }
}
Example #22
0
status_t HoroscopeFetch(const char* query)
{
    HoroscopesPrefs& prefs = GetPreferences()->horoscopesPrefs;
    free(prefs.pendingQuery);
    prefs.pendingQuery = StringCopy(query);
    if (NULL == prefs.pendingQuery)
        return memErrNotEnoughSpace;
             
    char* url = StringCopy(urlSchemaHoroscope urlSeparatorSchemaStr);
    if (NULL == url || NULL == (url = StrAppend(url, -1, prefs.pendingQuery, -1)))
        return memErrNotEnoughSpace;
        
    status_t err = GetLookupManager()->fetchUrl(url);
    free(url);
    return err;
}
Example #23
0
void ProjectGenerator::OnTargetSelected(const nuiEvent& rEvent)
{
  nuiDialogSelectDirectory* pDialog = (nuiDialogSelectDirectory*)rEvent.mpUser;
  mProjectTargetPath = pDialog->GetSelectedDirectory();
  mpProjectTarget->SetText(mProjectTargetPath);
  
  nglPath path(mProjectTargetPath);
  
  OnTargetTextChanged(rEvent);
  if (!rEvent.IsCanceled())
  {
    rEvent.Cancel();
    return;
  }
  
  GetPreferences().SetString(PREFERENCES_PROJECTGENERATOR, _T("nuiTargetPath"), path.GetParent().GetPathName());  
}
Example #24
0
bool MoviesMainDialog::handleInitDialog(HWND fw, long ip)
{
    list_.attachControl(handle(), IDC_LIST);
    list_.setStyleEx(LVS_EX_GRADIENT | LVS_EX_FULLROWSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_NOHSCROLL);
    list_.setTextBkColor(CLR_NONE);
    LVCOLUMN col = {0};
    col.mask = LVCF_TEXT;
    col.pszText = _T("");
    list_.insertColumn(0, col);
    HIMAGELIST il = ImageList_LoadBitmap(GetInstance(), MAKEINTRESOURCE(IDB_MOVIES), 17, 1, RGB(255, 255, 255));
    if (NULL != il)
        list_.setImageList(il, LVSIL_SMALL);
    
    Rect r;
    innerBounds(r);
    renderer_.create(WS_TABSTOP, r, handle());
    renderer_.definition.setHyperlinkHandler(GetHyperlinkHandler());

    ModuleDialog::handleInitDialog(fw, ip);
    
    setDisplayMode(displayMode_);
    
    UniversalDataFormat* udf = UDF_ReadFromStream(moviesDataStream);
    if (NULL != udf)
    {
        udf_ = udf;
        prepareTheatresList();
        setDisplayMode(showTheatres);
    }
    
    Preferences& prefs = *GetPreferences();
    if (NULL == prefs.moviesLocation || 0 == Len(prefs.moviesLocation))
    {
        char_t* loc = NULL;
        if (IDOK == ChangeLocationDialog::showModal(loc, handle()))
        {
            free(prefs.moviesLocation);
            prefs.moviesLocation = loc;
            if (NULL != prefs.moviesLocation)
                MoviesFetchData();
        }
    }
        
    return false;
}
Example #25
0
long MoviesMainDialog::handleCommand(ushort nc, ushort id, HWND sender)
{
    switch (id) {
    case IDM_MOVIES_MOVIES:
    case ID_VIEW_MOVIES:
        if (NULL == udf_)
            return messageHandled;
        if (movies_.empty())
        {
            if (errNone != MoviesFromTheatres(movies_, *udf_))
            {
                Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
                return messageHandled;
            }
        }
        prepareMoviesList();
        setDisplayMode(showMovies);
        return messageHandled;
    case IDM_MOVIES_THEATERS:
    case ID_VIEW_THEATERS:
        if (NULL == udf_)
            return messageHandled;
        prepareTheatresList();
        setDisplayMode(showTheatres);
        return messageHandled;
    case ID_VIEW_UPDATE:
        if (errNone != MoviesFetchData())
            Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
        return messageHandled;
    case ID_VIEW_CHANGE_LOCATION:
    {
        Preferences& prefs = *GetPreferences();
        char_t* loc = StringCopy(prefs.moviesLocation);
        if (IDOK == ChangeLocationDialog::showModal(loc, handle()))
        {
            free(prefs.moviesLocation);
            prefs.moviesLocation = loc;
            if (errNone != MoviesFetchData())
                Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
        }
        return messageHandled;
    }
    }
    return ModuleDialog::handleCommand(nc, id, sender);
}
Example #26
0
status_t StocksUpdate(bool validate)
{
    const char* schema = (validate ? urlSchemaStocksValidate urlSeparatorSchemaStr : urlSchemaStocksList urlSeparatorSchemaStr);
    char* url = StringCopy(schema);
    if (NULL == url)
        return memErrNotEnoughSpace;  

    const StocksPrefs& prefs = GetPreferences()->stocksPrefs;
    
    //ulong_t size = prefs.portfolioCount();     
    //for (ulong_t i = 0; i < size; ++i)
    //{
    //    const StocksPortfolio& p = prefs.portfolio(i);
        const StocksPortfolio& p = prefs.portfolio(prefs.currentPortfolio); 
        ulong_t  s = p.size();
        for (ulong_t j = 0; j < s; ++j)
        { 
            bool first = ((j == 0)); // && (i == 0));
            if (!first && NULL == (url = StrAppend(url, -1, "; ", -1)))
                return memErrNotEnoughSpace;
            
            char* symbol = UTF8_FromNative(p.entry(j).symbol);
            if (NULL == symbol)
            {
                free(url);
                return memErrNotEnoughSpace; 
            }
            if (NULL == (url = StrAppend(url, -1, symbol, -1)))
            {
                free(symbol);
                return memErrNotEnoughSpace;
            }
            free(symbol); 
        }       
    //}
    LookupManager* lm = GetLookupManager();
    status_t err = lm->fetchUrl(url);
    free(url);
    return err;   
}
Example #27
0
bool MoviesMainDialog::handleLookupFinished(Event& event, const LookupFinishedEventData* data)
{
    LookupManager* lm = GetLookupManager();
    Preferences& prefs = *GetPreferences();
    switch (data->result)
    {
    case lookupResultMoviesData:
    {
        PassOwnership(lm->udf, udf_);
        assert(NULL != udf_);
        clearMovies();
        prepareTheatresList();
        setDisplayMode(showTheatres);
        return messageHandled;
    }
        
    case lookupResultLocationUnknown:
    {
        char_t* loc = StringCopy(prefs.moviesLocation);
        if (NULL == loc)
        {
            Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
            return messageHandled;
        }
        ModuleDialog::handleLookupFinished(event, data);
        if (IDOK == ChangeLocationDialog::showModal(loc, handle()))
        {
            free(prefs.moviesLocation);
            prefs.moviesLocation = loc;
            if (NULL != prefs.moviesLocation)
                MoviesFetchData();
        }
        return messageHandled;
    }

    }
    return ModuleDialog::handleLookupFinished(event, data);
}
Example #28
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)
{
    assert(GetInstance() == hInstance);

    TCHAR szTitle[MAX_LOADSTRING];		// title bar text
    TCHAR szWindowClass[MAX_LOADSTRING];	// main window class name


#ifdef WIN32_PLATFORM_PSPC
    // SHInitExtraControls should be called once during your application's initialization to initialize any
    // of the Pocket PC special controls such as CAPEDIT and SIPPREF.
    SHInitExtraControls();
#endif // WIN32_PLATFORM_PSPC

    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 
    LoadString(hInstance, IDC_INFOMAN, szWindowClass, MAX_LOADSTRING);

    //If it is already running, then focus on the window, and exit
    HWND hWnd = FindWindow(szWindowClass, szTitle);	
    if (hWnd) 
    {
        // set focus to foremost child window
        // The "| 0x00000001" is used to bring any owned windows to the foreground and
        // activate them.
        SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
        return 0;
    } 
   
    LogAddDebuggerLog(eLogAlways);

    status_t err = DataStoreInit();
    if (errNone != err)
    {
        if (memErrNotEnoughSpace == err)
            Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
        CleanUp();
        return FALSE;
    }

    if (NULL == GetPreferences() || NULL == GetHyperlinkHandler())
    {
        Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
        CleanUp();
        return FALSE;
    }

    StylePrepareStaticStyles();
    MainWindow* w = MainWindow::create(szTitle, szWindowClass);
    if (NULL == w)
    {
        // TODO: show some alert
        CleanUp();
        return FALSE;
    }

    w->show(nCmdShow);
    w->update();

    RunTests(w->handle());
    return TRUE;
}
Example #29
0
PreferencesDialog::PreferencesDialog( QWidget * parent )
  : QDialog( parent )
{
  Preferences *preferences = GetPreferences();
  m_restoreSearchPaths            = preferences->getSearchPaths();
  m_restoreEnvironmentEnabled     = preferences->getEnvironmentEnabled();
  m_restoreEnvironmentTextureName = preferences->getEnvironmentTextureName();
  m_restoreMaterialCatalogPath    = preferences->getMaterialCatalogPath();


  m_environmentMapLabel = new QLabel( m_restoreEnvironmentTextureName );
  m_environmentMapLabel->setFrameShadow( QFrame::Sunken );
  m_environmentMapLabel->setFrameShape( QFrame::StyledPanel );

  QPushButton * environmentMapButton = new QPushButton( "..." );
  connect( environmentMapButton, SIGNAL(clicked(bool)), this, SLOT(selectEnvironmentMap(bool)) );

  QHBoxLayout * environmentMapLayout = new QHBoxLayout();
  environmentMapLayout->addWidget( m_environmentMapLabel );
  environmentMapLayout->addWidget( environmentMapButton );

  QFormLayout * environmentLayout = new QFormLayout();
  environmentLayout->addRow( "Environment Map", environmentMapLayout );

  QGroupBox * environmentBox = new QGroupBox( "Environment" );
  environmentBox->setCheckable( true );
  environmentBox->setChecked( m_restoreEnvironmentEnabled );
  environmentBox->setLayout( environmentLayout );
  connect( environmentBox, SIGNAL(toggled(bool)), this, SLOT(toggledEnvironmentBox(bool)) );


  m_materialCatalogLabel = new QLabel( m_restoreMaterialCatalogPath );
  m_materialCatalogLabel->setFrameShadow( QFrame::Sunken );
  m_materialCatalogLabel->setFrameShape( QFrame::StyledPanel );

  QPushButton * materialCatalogButton = new QPushButton( "..." );
  connect( materialCatalogButton, SIGNAL(clicked(bool)), this, SLOT(selectMaterialCatalogPath(bool)) );

  QHBoxLayout * materialCatalogLayout = new QHBoxLayout();
  materialCatalogLayout->addWidget( m_materialCatalogLabel );
  materialCatalogLayout->addWidget( materialCatalogButton );

  QFormLayout * materialLayout = new QFormLayout();
  materialLayout->addRow( "Material Catalog", materialCatalogLayout );

  QGroupBox * materialBox = new QGroupBox( "Material" );
  materialBox->setLayout( materialLayout );


  m_searchPaths = new QListWidget();
  m_searchPaths->addItems( m_restoreSearchPaths );

  QPushButton * addPathButton = new QPushButton( "Add ..." );
  connect( addPathButton, SIGNAL(clicked(bool)), this, SLOT(addPath(bool)) );

  QPushButton * removePathButton = new QPushButton( "Remove" );
  connect( removePathButton, SIGNAL(clicked(bool)), this, SLOT(removePath(bool)) );

  QPushButton * moveUpPathButton = new QPushButton( "Move Up" );
  connect( moveUpPathButton, SIGNAL(clicked(bool)), this, SLOT(moveUpPath(bool)) );

  QPushButton * moveDownPathButton = new QPushButton( "Move Down" );
  connect( moveDownPathButton, SIGNAL(clicked(bool)), this, SLOT(moveDownPath(bool)) );

  QHBoxLayout * searchPathsButtons = new QHBoxLayout();
  searchPathsButtons->addWidget( addPathButton );
  searchPathsButtons->addWidget( removePathButton );
  searchPathsButtons->addWidget( moveUpPathButton );
  searchPathsButtons->addWidget( moveDownPathButton );

  QVBoxLayout * verticalLayout = new QVBoxLayout();
  verticalLayout->addWidget( m_searchPaths );
  verticalLayout->addLayout( searchPathsButtons );

  QGroupBox * searchPathsBox = new QGroupBox( "Search Paths" );
  searchPathsBox->setLayout( verticalLayout );

  QDialogButtonBox * buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
  connect( buttonBox, SIGNAL(accepted()), this, SLOT(accept()) );
  connect( buttonBox, SIGNAL(rejected()), this, SLOT(reject()) );

  verticalLayout = new QVBoxLayout();
  verticalLayout->addWidget( environmentBox );
  verticalLayout->addWidget( materialBox );
  verticalLayout->addWidget( searchPathsBox );
  verticalLayout->addWidget( buttonBox );

  setWindowTitle( "Preferences" );
  setLayout( verticalLayout );
}
Example #30
0
void ProjectGenerator::OnGenerateButton(const nuiEvent& rEvent)
{
  nglString source = mpNuiSource->GetText();
  nglString target = mpProjectTarget->GetText();
  source.Trim();
  target.Trim();
  
  if ((source == nglString::Null) || (target == nglString::Null))
  {
    nuiMessageBox* pMessageBox = new nuiMessageBox(GetMainWindow(), _T("Project Creator"), _T("source and target information can't be empty!"), eMB_OK);
    pMessageBox->QueryUser();   
    rEvent.Cancel();
    return;
  }

  nglPath sourcePath(source);
  if (!sourcePath.Exists())
  {
    nglString msg;
    msg.Format(_T("the nui source directory '%ls' does not exist!"), sourcePath.GetChars());
    nuiMessageBox* pMessageBox = new nuiMessageBox(GetMainWindow(), nglString(_T("Project Creator")), msg, eMB_OK);
    pMessageBox->QueryUser();     
    rEvent.Cancel();
    return;
  }
  
  if (!mNuiCheckProjectFile || !mNuiCheckTools)
  {
    nglString msg;
    msg.Format(_T("Parts of nui could not be found.\nCheck the nui source directory or checkout the complete nui sources from libnui.net!"));
    nuiMessageBox* pMessageBox = new nuiMessageBox(GetMainWindow(), nglString(_T("Project Creator")), msg, eMB_OK);
    pMessageBox->QueryUser();
    rEvent.Cancel();
    return;        
  }

  mNuiSourcePath = source;
  mProjectTargetPath = target;
  nglPath path = nglPath(target);
  mProjectName = path.GetNodeName();

  nglPath targetPath(target);
  nglString xcodeproj = mProjectName + _T(".xcodeproj");
  targetPath += nglPath(xcodeproj);
  if (targetPath.Exists())
  {
    nglString msg;
    msg.Format(_T("the following project exists already!\n'%ls'"), targetPath.GetChars());
    nuiMessageBox* pMessageBox = new nuiMessageBox(GetMainWindow(), nglString(_T("Project Creator")), msg, eMB_OK);
    pMessageBox->QueryUser();     
    rEvent.Cancel();
    return;
  }
  
  
  GetPreferences().Save();
  
  Make();
  
  rEvent.Cancel();
}