* nandExtract:: add svn identification stuff

This commit is contained in:
giantpune 2011-05-31 03:53:03 +00:00
parent 7b998b5422
commit 52c732489a
2 changed files with 52 additions and 40 deletions

View File

@ -28,3 +28,13 @@ FORMS += nandwindow.ui \
RESOURCES += \ RESOURCES += \
rc.qrc rc.qrc
# create new svnrev.h
unix {
system( chmod 755 ../tools/makesvnrev.sh )
system( ../tools/makesvnrev.sh )
}
win32 {
system( "..\\tools\\SubWCRev.exe" "." "..\\tools\\svnrev_template.h" ".\\svnrev.h" )
}

View File

@ -1,4 +1,5 @@
#include "nandwindow.h" #include "nandwindow.h"
#include "svnrev.h"
#include "ui_nandwindow.h" #include "ui_nandwindow.h"
#include "boot2infodialog.h" #include "boot2infodialog.h"
#include "../WiiQt/tools.h" #include "../WiiQt/tools.h"
@ -6,7 +7,8 @@
NandWindow::NandWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::NandWindow ), nThread( this ) NandWindow::NandWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::NandWindow ), nThread( this )
{ {
ui->setupUi( this ); ui->setupUi( this );
ui->mainToolBar->setVisible( false ); ui->mainToolBar->setVisible( false );
this->setWindowTitle( "NAND Extract r" + CleanSvnStr( SVN_REV_STR ) );
//setup the block map //setup the block map
SetUpBlockMap(); SetUpBlockMap();
@ -15,7 +17,7 @@ NandWindow::NandWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::N
ui->progressBar->setVisible( false ); ui->progressBar->setVisible( false );
ui->statusBar->addPermanentWidget( ui->progressBar, 0 ); ui->statusBar->addPermanentWidget( ui->progressBar, 0 );
LoadSettings(); LoadSettings();
QFontMetrics fm( fontMetrics() ); QFontMetrics fm( fontMetrics() );
ui->treeWidget->header()->resizeSection( 0, fm.width( QString( 22, 'W' ) ) );//name ui->treeWidget->header()->resizeSection( 0, fm.width( QString( 22, 'W' ) ) );//name
@ -36,40 +38,40 @@ NandWindow::NandWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::N
NandWindow::~NandWindow() NandWindow::~NandWindow()
{ {
SaveSettings(); SaveSettings();
delete ui; delete ui;
} }
void NandWindow::SaveSettings() void NandWindow::SaveSettings()
{ {
QSettings s( QSettings::IniFormat, QSettings::UserScope, "WiiQt", "examples", this ); QSettings s( QSettings::IniFormat, QSettings::UserScope, "WiiQt", "examples", this );
s.beginGroup( "nandExtract" ); s.beginGroup( "nandExtract" );
//window geometry //window geometry
s.setValue( "size", size() ); s.setValue( "size", size() );
s.setValue( "pos", pos() ); s.setValue( "pos", pos() );
s.setValue( "usage", ui->actionShow_Usage->isChecked() ); s.setValue( "usage", ui->actionShow_Usage->isChecked() );
//if the usage is visible, remember its size //if the usage is visible, remember its size
int uSize = ui->splitter->sizes().at( 0 ) + 23;//WTF? why do i need to add 20ish here int uSize = ui->splitter->sizes().at( 0 ) + 23;//WTF? why do i need to add 20ish here
if( ui->actionShow_Usage->isChecked() ) if( ui->actionShow_Usage->isChecked() )
s.setValue( "usage_size", uSize ); s.setValue( "usage_size", uSize );
s.endGroup(); s.endGroup();
} }
void NandWindow::LoadSettings() void NandWindow::LoadSettings()
{ {
QSettings s( QSettings::IniFormat, QSettings::UserScope, "WiiQt", "examples", this ); QSettings s( QSettings::IniFormat, QSettings::UserScope, "WiiQt", "examples", this );
//settings specific to this program //settings specific to this program
s.beginGroup( "nandExtract" ); s.beginGroup( "nandExtract" );
resize( s.value("size", QSize( 1180, 654 ) ).toSize() ); resize( s.value("size", QSize( 1180, 654 ) ).toSize() );
move( s.value("pos", QPoint( 2, 72 ) ).toPoint() ); move( s.value("pos", QPoint( 2, 72 ) ).toPoint() );
int top = s.value( "usage_size", 200 ).toInt(); int top = s.value( "usage_size", 200 ).toInt();
ui->splitter->setSizes( QList< int >() << top << ( height() - top ) ); ui->splitter->setSizes( QList< int >() << top << ( height() - top ) );
ui->actionShow_Usage->setChecked( s.value( "usage", true ).toBool() ); ui->actionShow_Usage->setChecked( s.value( "usage", true ).toBool() );
s.endGroup(); s.endGroup();
} }
void NandWindow::SetUpBlockMap() void NandWindow::SetUpBlockMap()
@ -372,28 +374,28 @@ void NandWindow::on_actionShow_Usage_triggered()
QList<quint16>badOnes; QList<quint16>badOnes;
for( quint16 i = 0; i < 0x8000; i++ ) for( quint16 i = 0; i < 0x8000; i++ )
{ {
quint16 fat = GetFAT( i ); quint16 fat = GetFAT( i );
if( 0xfffc == fat ) if( 0xfffc == fat )
reserved++; reserved++;
else if( 0xfffd == fat ) else if( 0xfffd == fat )
{ {
badBlocks++; badBlocks++;
if( i % 8 == 0 ) if( i % 8 == 0 )
{ {
badOnes << ( i / 8 ); badOnes << ( i / 8 );
} }
} }
else if( 0xfffe == fat ) else if( 0xfffe == fat )
freeBlocks++; freeBlocks++;
} }
if( badBlocks ) if( badBlocks )
badBlocks /= 8; badBlocks /= 8;
if( reserved ) if( reserved )
reserved /= 8; reserved /= 8;
if( freeBlocks ) if( freeBlocks )
freeBlocks /= 8;*/ freeBlocks /= 8;*/
} }
//some item in the nand tree was clicked //some item in the nand tree was clicked
@ -459,5 +461,5 @@ void NandWindow::on_actionBoot2_triggered()
void NandWindow::on_actionFix_Names_For_FAT_triggered( bool checked ) void NandWindow::on_actionFix_Names_For_FAT_triggered( bool checked )
{ {
nThread.SetFixNamesForFat( checked ); nThread.SetFixNamesForFat( checked );
} }