@ -136,6 +136,7 @@ MainWindow::MainWindow(QWidget *parent) :
qDebug ( ) < < " Created RPC " ;
setupMiningTab ( ) ;
setupDebugLogTab ( ) ;
restoreSavedStates ( ) ;
}
@ -1984,6 +1985,49 @@ void MainWindow::setupMiningTab() {
// Mining tab currently only enabled for DragonX
}
}
void MainWindow : : setupDebugLogTab ( ) {
ui - > debugLog - > setReadOnly ( true ) ;
ui - > debugLog - > setPlainText ( " Some debug stuff " ) ;
# ifdef Q_OS_LINUX
QFile file ( QDir : : homePath ( ) + " /.hush/HUSH3/debug.log " ) ;
# elif defined(Q_OS_DARWIN)
QFile file ( QDir : : homePath ( ) + " /Library/Application Support/Hush/HUSH3/debug.log " ) ;
# elif defined(Q_OS_WIN64)
QFile file ( QDir : : homePath ( ) + " /AppData/Roaming/Hush/HUSH3/debug.log " ) ;
# else
// Bless Your Heart, You Like Danger!
QFile file ( " ~/.hush/HUSH3/debug.log " ) ;
# endif // Q_OS_LINUX
if ( file . exists ( ) ) {
DEBUG ( " : Found debug.log at " < < file ) ;
} else {
DEBUG ( " No debug.log found! " ) ;
return ;
}
if ( file . open ( QIODevice : : ReadOnly ) )
{
qint64 fileSize = file . size ( ) ;
DEBUG ( " debug.log size= " < < fileSize ) ;
file . seek ( file . size ( ) - 1 ) ;
int count = 0 ;
int lines = 100 ;
while ( ( count < lines ) & & ( file . pos ( ) > 0 ) )
{
QString ch = file . read ( 1 ) ;
file . seek ( file . pos ( ) - 2 ) ;
if ( ch = = " \n " )
count + + ;
}
file . seek ( file . pos ( ) + 2 ) ;
QString debugText = file . readAll ( ) ;
ui - > debugLog - > setPlainText ( debugText ) ;
}
}
void MainWindow : : setupPeersTab ( ) {
qDebug ( ) < < __FUNCTION__ ;
// Set up context menu on peers tab
@ -2134,33 +2178,8 @@ void MainWindow::setupPeersTab() {
menu . exec ( ui - > peersTable - > viewport ( ) - > mapToGlobal ( pos ) ) ;
} ) ;
/*
//grep 'BAN THRESHOLD EXCEEDED' ~/.hush/HUSH3/debug.log
//grep Disconnected ...
QFile debuglog = " " ;
# ifdef Q_OS_LINUX
debuglog = " ~/.hush/HUSH3/debug.log " ;
# elif defined(Q_OS_DARWIN)
debuglog = " ~/Library/Application Support/Hush/HUSH3/debug.log " ;
# elif defined(Q_OS_WIN64)
// "C:/Users/<USER>/AppData/Roaming/<APPNAME>",
// TODO: get current username
debuglog = " C:/Users/<USER>/AppData/Roaming/Hush/HUSH3/debug.log " ;
# else
// Bless Your Heart, You Like Danger!
// There are open bounties to port HUSH softtware to OpenBSD and friends:
// git.hush.is/hush/tasks
debuglog = " ~/.hush/HUSH3/debug.log " ;
# endif // Q_OS_LINUX
if ( debuglog . exists ( ) ) {
qDebug ( ) < < __func__ < < " : Found debuglog at " < < debuglog ;
} else {
qDebug ( ) < < __func__ < < " : No debug.log found " ;
}
*/
//ui->recentlyBannedPeers = "Could not open " + debuglog;
}