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

Commit

Permalink
0.9.3 - Multi-Alarm!
Browse files Browse the repository at this point in the history
  • Loading branch information
3vi1 committed Jul 14, 2017
1 parent 510ec97 commit e213f9f
Show file tree
Hide file tree
Showing 34 changed files with 1,335 additions and 252 deletions.
17 changes: 12 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,26 @@ You will need the following dependencies (Ubuntu, Debian):

# Compiling on Linux

1. Change into the out-of-tree build subdirectory of the source tree:
1. Clone source and dependencies

mkdir IMP/build; cd IMP/build
git clone https://...
cd IMP
git submodule init
git submodule update

2. Create the makefile via qmake:
2. Change into the out-of-tree build subdirectory of the source tree:

mkdir build; cd build

3. Create the makefile via qmake:

qmake --qt=5 ../src/imp.pro

3. Build the binary:
4. Build the binary:

make

4. For the easiest install, just run make install to automatically set up the shared data and desktop launcher.
5. For the easiest install, just run make install to automatically set up the shared data and desktop launcher.

sudo make install

Expand Down
1 change: 1 addition & 0 deletions data/dictionaries/dumbnames
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
R3 Clear
29 changes: 26 additions & 3 deletions docs/RELEASES
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
0.9.3 - Fixed false KOS results when CVA checker has a partial name match
0.9.3 - New feature: Instead of one alert sound, you can now configure
differing sounds (or the same sound) at differing (or the same)
volumes for each jump away you wish to be alerted. If you've
previously configured alerts, IMP will set the proximity
configuration to give you the same results. New users get two
defaults (for zero and one jump) that they can amend.

Fixed false KOS results when CVA checker has a partial name match
or if a pilot's name matches an Alliance/Corp.

Parser improvements for when people are saying a system is *not*
or are just saying a gate is clear.
clear or are just saying a gate is clear.

No longer warns new users that rules file doesn't exist. Instead
it creates one default rule that plays a sound if someone says
things like " red" or "kos!" in local.

Updated Linux build instructions to include submodules.

0.9.2 - Fixed parser bug where questions where not being marked as such.

Expand Down Expand Up @@ -314,7 +327,17 @@

Coming soon:

- kos msg for red by last should show person and corp.
- fix display of messages with backslashes.
- additional sound/volume options for alerts, dependant on jump distance.
- better pilot cache/cleanup.
- if at war, and going hisec, play a "bad idea" sound.
- theme customization for system images
- TTS support
- Maybe an option to auto-change region?
- Poll/repoll pilots option
- WH icon for system (xxx-xx contains/has a wh|wormhole|hole)
- Clear wh: (xxx-xx wh closed|collapsed|gone)
- Make mini militia faction count (RBL npc corps)?
- Add some intelligence to handle dumb names like R3 Clear
- Add option to autobuild jumpbridge list from dotlan instead of files.
- Break follow transistion mode on screen reposition.
240 changes: 240 additions & 0 deletions src/alarmmodel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
/*
* 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 <QComboBox>
#include "alarmmodel.h"

AlarmModel::AlarmModel(QObject *parent)
: QAbstractTableModel(parent)
{
}

QVariant AlarmModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role == Qt::DisplayRole)
{
if (orientation == Qt::Horizontal) {
switch (section)
{
case 0:
return QString("Jumps");
case 1:
return QString("Alarm");
case 2:
return QString("Volume");
case 3:
return QString("Play");
}
}
else
{
return section + 1;
}
}
return QVariant();
}

int AlarmModel::rowCount(const QModelIndex& /*&parent*/) const
{
return alarms.count();
}

int AlarmModel::columnCount(const QModelIndex& /*&parent*/) const
{
return 4;
}

QVariant AlarmModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();

switch(role)
{
case Qt::TextAlignmentRole:
switch(index.column())
{
case 0:
return Qt::AlignRight;
default:
return Qt::AlignHCenter;
}
break;

case Qt::DisplayRole:
case Qt::EditRole:
if (index.row() < alarms.count())
{
switch (index.column())
{
case 0:
return alarms[index.row()].jumps;
case 1:
return alarms[index.row()].file;
case 2:
return alarms[index.row()].volume;
default:
break;
}
}
break;

case Qt::CheckStateRole:
if (index.row() < alarms.count())
{
switch (index.column())
{
default:
break;
}
}
break;

case Qt::ToolTipRole:
switch (index.column())
{
case 0:
return QString("Number of jumps away");
case 1:
return QString("Sound file to play on alarm");
case 2:
return QString("Volume level of the alarm");
case 3:
return QString("Test the sound/volume");
default:
break;
}
}

return QVariant();
}

bool AlarmModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (role == Qt::EditRole)
{
switch (index.column())
{
case 0:
alarms[index.row()].jumps = value.toInt();
break;
case 1:
alarms[index.row()].file = value.toString();
break;
case 2:
alarms[index.row()].volume = value.toFloat();
break;
default:
break;
}

emit dataChanged(index, index, QVector<int>() << role);
return true;
}

return false;
}

Qt::ItemFlags AlarmModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return Qt::NoItemFlags;

if (index.column() == 0 || index.column() == 3)
{
return Qt::ItemIsEnabled | QAbstractTableModel::flags(index);
}
else
{
return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
}
}

bool AlarmModel::insertRows(int row, int count, const QModelIndex &parent)
{
if(row < 0)
row = alarms.count();

beginInsertRows(parent, row, row + count - 1);

alarms.insert(row, Alarm{(uint)row, "red-alert.wav", 1.0});
for(int i = 0; i < alarms.count(); i++)
{
alarms[i].jumps = i;
}

endInsertRows();
return true;
}

bool AlarmModel::removeRows(int row, int count, const QModelIndex &parent)
{
if(row < 0)
row = alarms.count() - 1;

beginRemoveRows(parent, row, row + count - 1);
if(row == 0 && count == alarms.count())
{
alarms.clear();
}
else
{
for(int i = 0; i < count; i++)
{
alarms.removeAt(row);
}
}

for(int i = 0; i < alarms.count(); i++)
{
alarms[i].jumps = i;
}

endRemoveRows();

return true;
}

void AlarmModel::insertAlarm(QString filename, float volume)
{
beginInsertRows(QModelIndex(), alarms.count(), alarms.count());

alarms.insert(alarms.count(), Alarm{(uint)alarms.count(), filename, volume});

endInsertRows();
}

QList<Alarm> AlarmModel::getAlarms()
{
return alarms;
}

void AlarmModel::setAlarms(QList<Alarm> newAlarms)
{
if(newAlarms.count() <= 0)
return;

beginRemoveRows(QModelIndex(), 0, alarms.count()-1);
alarms.clear();
endRemoveRows();
beginInsertRows(QModelIndex(), 0, newAlarms.count()-1);
alarms = newAlarms;
endInsertRows();
}
76 changes: 76 additions & 0 deletions src/alarmmodel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* 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 ALARMMODEL_H
#define ALARMMODEL_H

#include <QComboBox>
#include <QAbstractTableModel>

struct Alarm
{
uint jumps;
QString file;
float volume;
};

class AlarmModel : public QAbstractTableModel
{
Q_OBJECT

public:
explicit AlarmModel(QObject *parent = 0);

const Alarm& at(int distance) {return alarms[distance];}
int count() {return alarms.count();}

// Header:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;

// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;

QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

// Editable:
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole) override;

Qt::ItemFlags flags(const QModelIndex& index) const override;

// Add data:
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;

// Remove data:
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;

void insertAlarm(QString filename, float volume);
//void removeAlarm(const QModelIndexList indexList);
QList<Alarm> getAlarms();
void setAlarms(QList<Alarm> newAlarms);

QList<QComboBox> alarmCombos;

private:
QList<Alarm> alarms;
};

#endif // AlarmModel_H
Loading

0 comments on commit e213f9f

Please sign in to comment.