Skip to content

Commit

Permalink
extend Welcome.html; add directory dialog to rawr import
Browse files Browse the repository at this point in the history
git-svn-id: https://simulationcraft.googlecode.com/svn/trunk@3454 3b4652a1-8050-0410-ac47-3d40261b0f8b
  • Loading branch information
natehieter committed Oct 5, 2009
1 parent 329928a commit 9aa7935
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 43 deletions.
55 changes: 50 additions & 5 deletions Welcome.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Welcome to SimulationCraft</title>
</head>

<body>
<br />
<center><h1>Welcome to SimulationCraft</h1></center>
<br />
<h2>Table of Contents</h2>
<ul>
<li> <a href="#overview"> Overview </a>
<li> <a href="#how_this_interface_works"> How This Interface Works </a>
<li> <a href="#navigation"> Navigation </a>
<li> <a href="#tips_and_tricks"> Tips and Tricks </a>
<li> <a href="#global_parameters"> Global Parameters </a>
<li> <a href="#scale_factors"> Scale Factors </a>
<li> <a href="#importing_from_the_armory"> Importing from the Armory </a>
<li> <a href="#importing_from_wowhead"> Importing from Wowhead </a>
<li> <a href="#importing_from_chardev"> Importing from CharDev </a>
<li> <a href="#importing_from_warcrafter"> Importing from Warcrafter </a>
<li> <a href="#importing_from_rawr"> Importing from Rawr </a>
<li> <a href="#saving_results"> Saving Results </a>
<li> <a href="#priority_lists_not_rotations"> Priority Lists, Not Rotations </a>
<li> <a href="#modeling_raid_events"> Modeling Raid Events </a>
</ul>
<dl>
<dt><h4>Overview</h4></dt>
<dt><a name="overview" /><h2>Overview</h2></dt>
<dd>SimulationCraft is a tool to explore combat mechanics in the popular MMO RPG World of Warcraft.
It is a multi-player event-driven simulator written in C++ that models raid damage. Increasing class
synergy and the prevalence of proc-based combat modifiers have eroded the accuracy of traditional
calculators that rely upon closed-form approximations to model very complex mechanics. The goal of
this simulator is to close the accuracy gap while maintaining a performance level high enough to
calculate relative stat weights to aid gear selection.</dd>
<dt><h4>How This Interface Works</h4></dt>
<dt><a name="how_this_interface_works" /><h2>How This Interface Works</h2></dt>
<dd>At its core, SimulationCraft is a parameter-driven batch simulation tool. This interface is a
very light-weight wrapper that simply helps you build configuration scripts, pass them to the
simulator, and then evaluate the results. It relies upon existing character profile management
Expand All @@ -27,7 +43,7 @@
<li> Evaluate your results.
</ol>
</dd>
<dt><h4>Navigation</h4></dt>
<dt><a name="navigation" /><h2>Navigation</h2></dt>
<dd>In general the flow is from left to right across the main tabs at the top of the window.
At <i>Globals</i> you set common high-level directives. At <i>Import</i> you load your character
profile from a variety of sources. At <i>Simulate</i> you make character-specific tweaks.
Expand All @@ -37,6 +53,35 @@
At <i>Results</i> you will find HTML output generated by the simulator. <b>Please note that the
behavior of the command line and the buttons to either side are context-sensitive. Their function
and labels may change as you navigate the main tabs.</b></dd>
<dt><a name="tips_and_tricks" /><h2>Tips and Tricks</h2></dt>
<dd>
<ul>
<li> button name change
<li> progress bar
<li> back/forward buttons
<li> up/down buttons
</ul>
</dd>
<dt><a name="global_parameters" /><h2>Global Parameters</h2></dt>
<dd>text incoming</dd>
<dt><a name="scale_factors" /><h2>Scale Factors</h2></dt>
<dd>text incoming</dd>
<dt><a name="importing_from_the_armory" /><h2>Importing from the Armory</h2></dt>
<dd>text incoming</dd>
<dt><a name="importing_from_wowhead" /><h2>Importing from Wowhead</h2></dt>
<dd>text incoming</dd>
<dt><a name="importing_from_chardev" /><h2>Importing from CharDev</h2></dt>
<dd>text incoming</dd>
<dt><a name="importing_from_warcrafter" /><h2>Importing from Warcrafter</h2></dt>
<dd>text incoming</dd>
<dt><a name="importing_from_rawr" /><h2>Importing from Rawr</h2></dt>
<dd>text incoming</dd>
<dt><a name="saving_results" /><h2>Saving Results</h2></dt>
<dd>text incoming</dd>
<dt><a name="priority_lists_not_rotations" /><h2>Priority Lists, Not Rotations</h2></dt>
<dd>text incoming</dd>
<dt><a name="modeling_raid_events" /><h2>Modeling Raid Events</h2></dt>
<dd>text incoming</dd>
</dl>
</body>
</html>
110 changes: 78 additions & 32 deletions qt/sc_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ void SimcraftWindow::createWelcomeTab()
}

QTextBrowser* welcomeBanner = new QTextBrowser();
welcomeBanner->document()->setHtml( s );
welcomeBanner->setHtml( s );
welcomeBanner->moveCursor( QTextCursor::Start );
mainTab->addTab( welcomeBanner, "Welcome" );
}

Expand Down Expand Up @@ -254,11 +255,12 @@ void SimcraftWindow::createImportTab()
" formulation vs simulation. There are strengths and weaknesses to each"
" approach. Since they come from different directions, one can be confident"
" in the result when they arrive at the same destination.\n\n"
" SimulationCraft can import the character xml file written by Rawr:" );
" To aid comparison, SimulationCraft can import the character xml file written by Rawr." );
rawrLabel->setWordWrap( true );
rawrLayout->addWidget( rawrLabel );
rawrLayout->addWidget( rawrFile = new QLineEdit() );
rawrLayout->addWidget( new QLabel( "" ), 1 );
rawrLayout->addWidget( rawrButton = new QPushButton( "Change Directory" ) );
rawrLayout->addWidget( rawrDir = new QLabel( "" ) );
rawrLayout->addWidget( rawrList = new QListWidget(), 1 );
QGroupBox* rawrGroupBox = new QGroupBox();
rawrGroupBox->setLayout( rawrLayout );
importTab->addTab( rawrGroupBox, "Rawr" );
Expand All @@ -269,8 +271,10 @@ void SimcraftWindow::createImportTab()
historyList->setSortingEnabled( true );
importTab->addTab( historyList, "History" );

connect( rawrButton, SIGNAL(clicked(bool)), this, SLOT(rawrButtonClicked()) );
connect( rawrList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT( rawrDoubleClicked(QListWidgetItem*)) );
connect( historyList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(historyDoubleClicked(QListWidgetItem*)) );
connect( importTab, SIGNAL(currentChanged(int)), this, SLOT(importTabChanged(int)) );
connect( importTab, SIGNAL(currentChanged(int)), this, SLOT(importTabChanged(int)) );
}

void SimcraftWindow::createBestInSlotTab()
Expand Down Expand Up @@ -602,12 +606,16 @@ void ImportThread::importRawr()

void ImportThread::run()
{
if ( url.count( "us.wowarmory" ) ) importArmoryUs();
else if( url.count( "eu.wowarmory" ) ) importArmoryEu();
else if( url.count( "wowhead" ) ) importWowhead();
else if( url.count( "chardev" ) ) importChardev();
else if( url.count( "warcrafter" ) ) importWarcrafter();
else importRawr();
switch( tab )
{
case TAB_ARMORY_US: importArmoryUs(); break;
case TAB_ARMORY_EU: importArmoryEu(); break;
case TAB_WOWHEAD: importWowhead(); break;
case TAB_CHARDEV: importChardev(); break;
case TAB_WARCRAFTER: importWarcrafter(); break;
case TAB_RAWR: importRawr(); break;
default: assert(0);
}

if( player )
{
Expand All @@ -618,16 +626,22 @@ void ImportThread::run()
}
}

void SimcraftWindow::startImport( const QString& url )
void SimcraftWindow::startImport( int tab, const QString& url )
{
if( sim )
{
sim -> cancel();
return;
}
if( tab == TAB_RAWR )
{
rawrCmdLineHistory.add( url );
rawrFileText = "";
cmdLine->setText( rawrFileText );
}
simProgress = 0;
mainButton->setText( "Cancel!" );
importThread->start( initSim(), url );
importThread->start( initSim(), tab, url );
simulateText->document()->setPlainText( "# Profile will be downloaded into here." );
mainTab->setCurrentIndex( TAB_SIMULATE );
timer->start( 500 );
Expand Down Expand Up @@ -825,6 +839,7 @@ void SimcraftWindow::closeEvent( QCloseEvent* e )
chardevView->stop();
warcrafterView->stop();
QCoreApplication::quit();
e->accept();
}

void SimcraftWindow::cmdLineTextEdited( const QString& s )
Expand All @@ -838,20 +853,14 @@ void SimcraftWindow::cmdLineTextEdited( const QString& s )
case TAB_EXAMPLES: cmdLineText = s; break;
case TAB_LOG: logFileText = s; break;
case TAB_RESULTS: resultsFileText = s; break;
case TAB_IMPORT: break;
case TAB_IMPORT: if( importTab->currentIndex() == TAB_RAWR ) rawrFileText = s; break;
}
}

void SimcraftWindow::cmdLineReturnPressed()
{
switch( mainTab->currentIndex() )
if( mainTab->currentIndex() == TAB_IMPORT )
{
case TAB_WELCOME: startSim(); break;
case TAB_GLOBALS: startSim(); break;
case TAB_SIMULATE: startSim(); break;
case TAB_OVERRIDES: startSim(); break;
case TAB_EXAMPLES: startSim(); break;
case TAB_IMPORT:
if( cmdLine->text().count( "us.wowarmory" ) )
{
armoryUsView->setUrl( QUrl( cmdLine->text() ) );
Expand All @@ -877,9 +886,14 @@ void SimcraftWindow::cmdLineReturnPressed()
warcrafterView->setUrl( QUrl( cmdLine->text() ) );
importTab->setCurrentIndex( TAB_WARCRAFTER );
}
break;
case TAB_LOG: saveLog(); break;
case TAB_RESULTS: saveResults(); break;
else
{
if( ! sim ) mainButtonClicked( true );
}
}
else
{
if( ! sim ) mainButtonClicked( true );
}
}

Expand All @@ -895,12 +909,12 @@ void SimcraftWindow::mainButtonClicked( bool checked )
case TAB_IMPORT:
switch( importTab->currentIndex() )
{
case TAB_ARMORY_US: startImport( armoryUsView->url().toString() ); break;
case TAB_ARMORY_EU: startImport( armoryEuView->url().toString() ); break;
case TAB_WOWHEAD: startImport( wowheadView->url().toString() ); break;
case TAB_CHARDEV: startImport( chardevView->url().toString() ); break;
case TAB_WARCRAFTER: startImport( warcrafterView->url().toString() ); break;
case TAB_RAWR: startImport( rawrFile->text() ); break;
case TAB_ARMORY_US: startImport( TAB_ARMORY_US, cmdLine->text() ); break;
case TAB_ARMORY_EU: startImport( TAB_ARMORY_EU, cmdLine->text() ); break;
case TAB_WOWHEAD: startImport( TAB_WOWHEAD, cmdLine->text() ); break;
case TAB_CHARDEV: startImport( TAB_CHARDEV, cmdLine->text() ); break;
case TAB_WARCRAFTER: startImport( TAB_WARCRAFTER, cmdLine->text() ); break;
case TAB_RAWR: startImport( TAB_RAWR, cmdLine->text() ); break;
}
break;
case TAB_LOG: saveLog(); break;
Expand Down Expand Up @@ -960,6 +974,25 @@ void SimcraftWindow::forwardButtonClicked( bool checked )
}
}

void SimcraftWindow::rawrButtonClicked( bool checked )
{
QFileDialog dialog( this );
dialog.setFileMode( QFileDialog::Directory );
dialog.setNameFilter( "Rawr Profiles (*.xml)" );
dialog.restoreState( rawrDialogState );
if( dialog.exec() )
{
rawrDialogState = dialog.saveState();
QDir dir = dialog.directory();
dir.setSorting( QDir::Name );
dir.setFilter( QDir::Files );
dir.setNameFilters( QStringList( "*.xml" ) );
rawrDir->setText( dir.absolutePath() + DIRECTORY_DELIMITER );
rawrList->clear();
rawrList->addItems( dir.entryList() );
}
}

void SimcraftWindow::mainTabChanged( int index )
{
visibleWebView = 0;
Expand Down Expand Up @@ -992,7 +1025,14 @@ void SimcraftWindow::importTabChanged( int index )
{
visibleWebView = 0;
progressBar->setValue( simProgress );
cmdLine->setText( "" );
if( index == TAB_RAWR )
{
cmdLine->setText( rawrFileText );
}
else
{
cmdLine->setText( "" );
}
}
else
{
Expand All @@ -1018,6 +1058,13 @@ void SimcraftWindow::resultsTabChanged( int index )
}
}

void SimcraftWindow::rawrDoubleClicked( QListWidgetItem* item )
{
rawrFileText = rawrDir->text();
rawrFileText += item->text();
cmdLine->setText( rawrFileText );
}

void SimcraftWindow::historyDoubleClicked( QListWidgetItem* item )
{
QString text = item->text();
Expand Down Expand Up @@ -1050,7 +1097,6 @@ void SimcraftWindow::historyDoubleClicked( QListWidgetItem* item )
}
else
{
rawrFile->setText( url );
importTab->setCurrentIndex( TAB_RAWR );
}
}
Expand Down
28 changes: 22 additions & 6 deletions qt/simcraftqt.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ class SimcraftWindow : public QWidget
SimcraftWebView* chardevView;
SimcraftWebView* warcrafterView;
SimcraftWebView* visibleWebView;
QLineEdit* rawrFile;
QPushButton* rawrButton;
QLabel* rawrDir;
QByteArray rawrDialogState;
QListWidget* rawrList;
QListWidget* historyList;
QTreeWidget* bisTree;
QPlainTextEdit* simulateText;
Expand All @@ -102,9 +105,6 @@ class SimcraftWindow : public QWidget
QPushButton* backButton;
QPushButton* forwardButton;
SimcraftCommandLine* cmdLine;
QString cmdLineText;
QString logFileText;
QString resultsFileText;
QProgressBar* progressBar;
QPushButton* mainButton;
QGroupBox* cmdLineGroupBox;
Expand All @@ -118,14 +118,20 @@ class SimcraftWindow : public QWidget
int simResults;
QStringList resultsHtml;

QString cmdLineText;
QString rawrFileText;
QString logFileText;
QString resultsFileText;

StringHistory simulateCmdLineHistory;
StringHistory logCmdLineHistory;
StringHistory resultsCmdLineHistory;
StringHistory rawrCmdLineHistory;
StringHistory globalsHistory;
StringHistory simulateTextHistory;
StringHistory overridesTextHistory;

void startImport( const QString& url );
void startImport( int tab, const QString& url );
void startSim();
sim_t* initSim();
void deleteSim();
Expand Down Expand Up @@ -166,6 +172,8 @@ private slots:
void mainTabChanged( int index );
void importTabChanged( int index );
void resultsTabChanged( int index );
void rawrButtonClicked( bool checked=false );
void rawrDoubleClicked( QListWidgetItem* item );
void historyDoubleClicked( QListWidgetItem* item );
void bisDoubleClicked( QTreeWidgetItem* item, int col );

Expand Down Expand Up @@ -195,6 +203,13 @@ class SimcraftCommandLine : public QLineEdit
mainWindow->cmdLineText = mainWindow->simulateCmdLineHistory.next( k );
setText( mainWindow->cmdLineText );
break;
case TAB_IMPORT:
if( mainWindow->importTab->currentIndex() == TAB_RAWR )
{
mainWindow->rawrFileText = mainWindow->rawrCmdLineHistory.next( k );
setText( mainWindow->rawrFileText );
}
break;
case TAB_LOG:
mainWindow->logFileText = mainWindow->logCmdLineHistory.next( k );
setText( mainWindow->logFileText );
Expand Down Expand Up @@ -276,6 +291,7 @@ class ImportThread : public QThread
sim_t* sim;

public:
int tab;
QString url;
QString profile;
player_t* player;
Expand All @@ -287,7 +303,7 @@ class ImportThread : public QThread
void importWarcrafter();
void importRawr();

void start( sim_t* s, const QString& u ) { sim=s; url=u; profile=""; player=0; QThread::start(); }
void start( sim_t* s, int t, const QString& u ) { sim=s; tab=t; url=u; profile=""; player=0; QThread::start(); }
virtual void run();
ImportThread( SimcraftWindow* mw ) : mainWindow(mw), sim(0), player(0) {}
};
Expand Down

0 comments on commit 9aa7935

Please sign in to comment.