Skip to content
This repository has been archived by the owner on Aug 26, 2020. It is now read-only.

Commit

Permalink
v0.8.7
Browse files Browse the repository at this point in the history
- Modified pocket expansion to only occur for status messages, since
  people are too often sending free-form messages to intel with the
  word "pocket" in them.  This will stop the entire pocket from going
  red and us all getting an earful of red alert.

- Changed the parser to not ignore two letter words as potentially
  being part of a pilots name.  At least one red created an alt with
  a two char first and two char last name to fly under the
  radar.

- Preliminary work to support HTTP links.
  • Loading branch information
3vi1 committed May 19, 2017
1 parent 7dd4edc commit 011d280
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 68 deletions.
14 changes: 14 additions & 0 deletions docs/RELEASES
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
0.8.7 - Fixed avatars not showing for some users on Windows due to missing
DLLs.

Modified pocket expansion to only occur for status messages, since
people are too often sending free-form messages to intel with the
word "pocket" in them. This will stop the entire pocket from going
red and us all getting an earful of red alert.

Changed the parser to not ignore two letter words as potentially
being part of a pilots name. At least one red created an alt with
a two char first and two char last name to fly under the
radar.

0.8.6 - Fixed message view colors when resetting style to "-None-".

Fixed initialization of jump bridges when bridgemap has changed
Expand Down Expand Up @@ -239,6 +252,7 @@
Coming soon:

- fix display of messages with backslashes.
- add support for hyperlinks in message list.
- additional sound/volume options for alerts, dependant on jump distance.
- better memory cache/cleanup.
- investigate crash on region change.
8 changes: 5 additions & 3 deletions src/imp.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = imp
TEMPLATE = app

VERSION = 0.8.6
VERSION = 0.8.7
QMAKE_TARGET_COMPANY = EternalDusk
QMAKE_TARGET_DESCRIPTION = Eve Online Intelligence Management Program
QMAKE_TARGET_COPYRIGHT = (c) Copyright 2016-2017 Jesse Litton
Expand Down Expand Up @@ -44,7 +44,8 @@ SOURCES += \
findmessagesdialog.cpp \
abstract_os.cpp \
themecustomizationdialog.cpp \
msgstyle.cpp
msgstyle.cpp \
utility.cpp

HEADERS += \
mainwindow.h \
Expand All @@ -70,7 +71,8 @@ HEADERS += \
findmessagesdialog.h \
abstract_os.h \
themecustomizationdialog.h \
msgstyle.h
msgstyle.h \
utility.h

FORMS += \
mainwindow.ui \
Expand Down
27 changes: 27 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,17 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->mapView, &SvgMapView::sendOpacity,
this, &MainWindow::gotOpacity);


// Load pocket definitions
QStringList pocketsList = fromFile("pockets");
foreach(QString pocket, pocketsList)
{
QStringList pocketList = pocket.split(",");
QString pocketName = pocketList[0];
pocketList.removeFirst();
pockets.insert(pocketName.trimmed(),pocketList);
}

ui->mapView->show();
}

Expand Down Expand Up @@ -1065,6 +1076,10 @@ void MainWindow::fileChanged(const QString &absoluteFilePath)
case MessageFlag::MOTD:
break;

case MessageFlag::POCKET:
// Handled by STATUS.
break;

case MessageFlag::QUERY:
case MessageFlag::STATUS:
{
Expand All @@ -1073,6 +1088,14 @@ void MainWindow::fileChanged(const QString &absoluteFilePath)
break;
}

// Expand pockets, if necessary
if (message.flags.contains(MessageFlag::POCKET) &&
message.systems.count() >= 1 &&
pockets.contains(message.systems[0]))
{
message.systems.append(pockets[message.systems[0]]);
}

bool play = false;
foreach (QString system, message.systems)
{
Expand Down Expand Up @@ -1184,6 +1207,10 @@ void MainWindow::fileChanged(const QString &absoluteFilePath)
}
break;

case MessageFlag::LINK:
toBeAddedToList = true;
break;

default:
qDebug() << "Unhandled flag " << flag << " found for message: " << message.text;
break;
Expand Down
4 changes: 3 additions & 1 deletion src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "parser.h"
#include "theme.h"
#include "themedialog.h"
#include "utility.h"

namespace Ui {
class MainWindow;
Expand Down Expand Up @@ -113,7 +114,6 @@ private slots:
void on_action_Frameless_Window_triggered();
void on_action_Menu_Toggle_triggered();
void on_action_Messages_triggered();
//void on_dockWidget_visibilityChanged(bool visible);

private:
void initParsing();
Expand Down Expand Up @@ -203,6 +203,8 @@ private slots:

LogInfo impLogInfo = { "*IMP*", QFileInfo(), "Khasm Kaotiqa", "None", 0 };

QMap<QString, QStringList> pockets;

// Used to restore system rotation until I take the time to figure out
// how to pull it out of the transform matrix and level systems at
// restart.
Expand Down
4 changes: 2 additions & 2 deletions src/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ static const struct Version
{
Version(){}

QString release = "0.8.6"; //VERSION;
QString name = "Nah Loopy Just Lupine.";
QString release = "0.8.7"; //VERSION;
QString name = "Lupine Fresh Scent";

QString styleHeader1 = "<span style=\" color:#0000ff;\">";
QString styleFooter1 = "</span>";
Expand Down
70 changes: 14 additions & 56 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "parser.h"
#include "abstract_os.h"
#include "utility.h"

#include <QApplication>
#include <QDebug>
Expand All @@ -33,7 +34,7 @@ using namespace std;

Parser::Parser(QObject *parent) : QObject(parent)
{
ignoreChars = "[\\\\_=!@#$%^&\\*,\\./\\[\\]\\(\\)\\{\\}\\?]"; // "\\_=!@#$%^&*,./[](){}?"
ignoreChars = "[\\\\_=!@#$%^&\\*,\\.\\[\\]\\(\\)\\{\\}\\?]"; // "\\_=!@#$%^&*,./[](){}?"

// Load words, channels, and ships from files
ignoreWords = QSet<QString>::fromList(fromFile("common"));
Expand All @@ -43,53 +44,13 @@ Parser::Parser(QObject *parent) : QObject(parent)
statusWords = QSet<QString>::fromList(fromFile("status"));
ships = QSet<QString>::fromList(fromFile("ships"));

QStringList pocketsList = fromFile("pockets");
foreach(QString pocket, pocketsList)
{
QStringList pocketList = pocket.split(",");
QString pocketName = pocketList[0];
pocketList.removeFirst();
pockets.insert(pocketName.trimmed(),pocketList);
}
}

void Parser::setMap(Map &map)
{
regionMap = &map;
}

QStringList Parser::fromFile(const QString& fileName)
{
QStringList stringList;

QFile file(appFilesPath() + "/dictionaries/" + fileName);

if(!file.open(QIODevice::ReadOnly))
{
QMessageBox::critical(NULL, "Error Opening File", "Could not open file " +
appFilesPath() + "/dictionaries/" + fileName +
".");
QApplication::exit(1);
}
else
{
QTextStream in(&file);
QString all = in.readAll();
stringList = all.split('\n');
stringList.removeAll("");

for(int i=stringList.length()-1; i>=0; i--)
{
if(stringList[i].trimmed()[0]=='#')
{
// Discard comments
stringList.removeAt(i);
}
}
}

return stringList;
}

QSet<QString> Parser::getLocalChannels()
{
Expand Down Expand Up @@ -229,10 +190,6 @@ MessageInfo Parser::parseLine(const QString& line)
messageInfo.flags.append(MessageFlag::SYSTEM_CHANGE);
return messageInfo;
}
else
{
//qDebug() << " is not a system change message.";
}

// Test to see if this is a MOTD message:

Expand Down Expand Up @@ -339,10 +296,19 @@ void Parser::identifyObjects(MessageInfo& messageInfo)
messageInfo.markedUpText += words[i];
messageInfo.markedUpText += "<info>";
}
else if(lowerWord.startsWith("http://"))
else if(lowerWord == "pocket")
{
//hhh
messageInfo.flags.append(MessageFlag::POCKET);
}
/* Coming soon...
* else if(lowerWord.contains(QRegExp("^.{3,5}://.+")))
{
messageInfo.markedUpText += "<a href=" + words[i] + ">";
messageInfo.markedUpText += words[i];
messageInfo.markedUpText += "</a>";
messageInfo.flags.append(MessageFlag::LINK);
} */
else
{
QString systemName = regionMap->getSystemByAbbreviation(words[i].toUpper());
Expand Down Expand Up @@ -376,7 +342,7 @@ void Parser::identifyObjects(MessageInfo& messageInfo)
messageInfo.markedUpText += "<info>";
}
}
else if(lowerWord.length() >= 3)
else if(lowerWord.length() >= 2)
{
messageInfo.possiblePilots.append(words[i]);
messageInfo.markedUpText += "<info>";
Expand All @@ -394,12 +360,4 @@ void Parser::identifyObjects(MessageInfo& messageInfo)
messageInfo.systems = theseSystems;
messageInfo.ships = theseShips;
messageInfo.gates = theseGates;

// If this message pertains to a pocket, expand the systems.
if(messageInfo.text.toLower().contains("pocket") &&
messageInfo.systems.length() == 1)
{
messageInfo.systems.append(pockets[messageInfo.systems[0]]);
}

}
10 changes: 4 additions & 6 deletions src/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
#include "map.h"

enum MessageFlag { UNKNOWN = 0, CLEAR, ESS,
LEFT, LOCATION, MOTD, POCKET, QUERY,
STATUS, SYSTEM_CHANGE, WARNING };
LEFT, LINK, LOCATION,
MOTD, POCKET, QUERY,
STATUS, SYSTEM_CHANGE, WARNING
};

struct LogInfo
{
Expand Down Expand Up @@ -65,7 +67,6 @@ struct MessageInfo
QStringList possiblePilots;

QList<MessageFlag> flags;

};

class Parser : public QObject
Expand Down Expand Up @@ -100,9 +101,6 @@ public slots:
QMap<QString, LogInfo> fileMap;
Map* regionMap;

QMap<QString, QStringList> pockets;

QStringList fromFile(const QString& fileName);
void loadSet(QSet<QString>& set, QString& string);
void identifyObjects(MessageInfo& messageInfo);
QString systemAbbreviation(const QString& word);
Expand Down
60 changes: 60 additions & 0 deletions src/utility.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Imp: Copyright 2016, 2017 Jesse Litton ([email protected])
*
* This file is part of Imp.
*
* Imp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Imp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Imp. If not, see <http://www.gnu.org/licenses/>.
*
*/

#include <QApplication>
#include <QFile>
#include <QMessageBox>
#include <QTextStream>

#include "utility.h"
#include "abstract_os.h"

QStringList fromFile(const QString& fileName)
{
QStringList stringList;

QFile file(appFilesPath() + "/dictionaries/" + fileName);

if(!file.open(QIODevice::ReadOnly))
{
QMessageBox::critical(NULL, "Error Opening File", "Could not open file " +
appFilesPath() + "/dictionaries/" + fileName +
".");
QApplication::exit(1);
}
else
{
QTextStream in(&file);
QString all = in.readAll();
stringList = all.split('\n');
stringList.removeAll("");

for(int i=stringList.length()-1; i>=0; i--)
{
if(stringList[i].trimmed()[0]=='#')
{
// Discard comments
stringList.removeAt(i);
}
}
}

return stringList;
}
28 changes: 28 additions & 0 deletions src/utility.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Imp: Copyright 2016, 2017 Jesse Litton ([email protected])
*
* This file is part of Imp.
*
* Imp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Imp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Imp. If not, see <http://www.gnu.org/licenses/>.
*
*/

#ifndef UTILITY_H
#define UTILITY_H

#include <QString>

QStringList fromFile(const QString& fileName);

#endif // UTILITY_H

0 comments on commit 011d280

Please sign in to comment.