more foreach, less pointers

This commit is contained in:
Mathias Panzenböck
2014-02-15 05:53:28 +01:00
parent 29a51606ff
commit 133d5b8547
7 changed files with 81 additions and 134 deletions

View File

@ -16,11 +16,11 @@ Button::~Button() {
//delete timer;
}
bool Button::read( QTextStream* stream ) {
bool Button::read( QTextStream &stream ) {
// at this point, toDefault() has just been called.
//read in a line of text and break it into words
QString input = stream->readLine().toLower();
QString input = stream.readLine().toLower();
QRegExp regex("[\\s,]+");
QStringList words = input.split(regex);
@ -61,11 +61,16 @@ bool Button::read( QTextStream* stream ) {
return true;
}
void Button::write( QTextStream* stream ) {
*stream << "\t" << getName() << ": ";
if (rapidfire) *stream << "rapidfire, ";
if (sticky) *stream << "sticky, ";
*stream << (useMouse?"mouse ":"key ") << (useMouse?mousecode:keycode) << "\n";
void Button::write( QTextStream &stream ) {
stream << "\t" << getName() << ": ";
if (rapidfire) stream << "rapidfire, ";
if (sticky) stream << "sticky, ";
if (useMouse) {
stream << "mouse " << mousecode << "\n";
}
else {
stream << "key " << keycode << "\n";
}
}
void Button::release() {