Changeset 840

Show
Ignore:
Timestamp:
08/19/08 11:00:04 (3 months ago)
Author:
liamstask
Message:

- make sure config file is compared/loaded at the appropriate moment
- adjust Builder and MainWindow? to reflect changes

Location:
mcbuilder/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • mcbuilder/trunk/include/ProjectInfo.h

    r833 r840  
    7979    int tcpSockets() { return tcpSocketEdit->text().toInt(); } 
    8080    int tcpServers() { return tcpServerEdit->text().toInt(); } 
    81     bool load(); 
     81    bool load( QString projectPath ); 
    8282    bool diffProjects( QString newProjectPath, bool saveUiToFile = false ); 
    83      
    84   public slots: 
    85     bool loadAndShow(); 
    8683   
    8784  signals: 
  • mcbuilder/trunk/src/Builder.cpp

    r839 r840  
    5252  loadDependencies(LIBRARIES_DIR, currentProjectPath);      // this loads up the list of libraries this project depends on 
    5353  if(compareConfigFile(currentProjectPath)) 
    54   { 
    5554    createConfigFile(currentProjectPath);      // create a config file based on the Properties for this project 
    56     qDebug("builder - creating/updating config file"); 
    57   } 
    5855  createMakefile(currentProjectPath);        // create a Makefile for this project, given the dependencies 
    5956  buildStep = BUILD; 
     
    6562  start(makePath + "make"); 
    6663  QString buildmsg("***************************************************************\n"); 
    67   buildmsg += "  mcbuilder - building " + dir.dirName() + "\n"; 
     64  buildmsg += tr("  mcbuilder - building ") + dir.dirName() + "\n"; 
    6865  buildmsg += QDateTime::currentDateTime().toString("  MMM d, yyyy h:m ap") + "\n"; 
    6966  buildmsg += "***************************************************************"; 
     
    7673void Builder::clean(QString projectName) 
    7774{ 
    78   currentProjectPath = projectName; 
    79   QDir buildDir(ensureBuildDirExists(currentProjectPath)); 
     75  QDir buildDir(ensureBuildDirExists(projectName)); 
    8076  setWorkingDirectory(buildDir.path()); 
    81   if(!buildDir.exists("Makefile")) 
    82     createMakefile(currentProjectPath); 
     77  if(compareConfigFile(projectName)) 
     78    createConfigFile(projectName);      // create a config file based on the Properties for this project 
     79  createMakefile(currentProjectPath); 
    8380  buildStep = CLEAN; 
    8481  QStringList args = QStringList() << "clean"; 
     
    345342  if(configFile.open(QIODevice::WriteOnly|QFile::Text)) 
    346343  { 
     344    qDebug("builder - creating/updating config file"); 
    347345    QTextStream tofile(&configFile); 
    348346    tofile << "/*****************************************************************************************" << endl << endl; 
  • mcbuilder/trunk/src/MainWindow.cpp

    r834 r840  
    528528    setWindowTitle( projectName + "[*] - mcbuilder"); 
    529529    updateRecentProjects(projectPath); 
    530     if(projInfo->diffProjects(projectPath)) 
     530    // diff projects before loading the new one in 
     531    bool clean = projInfo->diffProjects(projectPath); 
     532    projInfo->load(projectPath); // but load the new one in before we clean, so the proper config and Makefiles are created 
     533    if(clean) 
    531534      builder->clean(projectPath); 
    532     projInfo->load(); 
    533535    buildLog->clear(); 
    534536  } 
     
    778780  if(currentProject.isEmpty()) 
    779781    return statusBar()->showMessage( tr("Open a project first, or create a new one from the File menu."), 3500 ); 
    780   if( !projInfo->loadAndShow() ) 
     782  if( !projInfo->load(currentProject) ) 
    781783  { 
    782784    QDir dir(currentProject); 
    783785    return statusBar()->showMessage( tr("Couldn't find/open project properties for ") + dir.dirName(), 3500 ); 
    784786  } 
     787  else 
     788    projInfo->show(); 
    785789} 
    786790 
  • mcbuilder/trunk/src/ProjectInfo.cpp

    r833 r840  
    6161 
    6262/* 
    63   Read the project ProjectInfo from the project profile, load them into 
    64   the ProjectInfo dialog and show it. 
    65 */ 
    66 bool ProjectInfo::loadAndShow( ) 
    67 { 
    68   load(); 
    69   show(); 
    70   return true; 
    71 } 
    72  
    73 /* 
    7463  Read the project's ProjectInfo from the project file 
    7564  and load them into the UI. 
    7665*/   
    77 bool ProjectInfo::load() 
    78 { 
    79   QString proj = mainWindow->currentProjectPath(); 
    80   if(proj.isEmpty()) 
     66bool ProjectInfo::load( QString projectPath ) 
     67{ 
     68  if(projectPath.isEmpty()) 
    8169    return false; 
    82   QDir projectDir(proj); 
    83   QString projectName = projectDir.dirName(); 
    84   setWindowTitle(projectName + " - Project Info"); 
     70  QDir projectDir(projectPath); 
     71  setWindowTitle(projectDir.dirName() + " - Project Info"); 
    8572   
    8673  // read the ProjectInfo file 
    87   QFile file(projectFilePath(proj)); 
     74  QFile file(projectFilePath(projectPath)); 
    8875  if(file.open(QIODevice::ReadOnly|QFile::Text)) 
    8976  {