mirror of
https://github.com/ChronosX88/Influence-cjdns.git
synced 2024-11-23 15:42:18 +00:00
Now the application does not start if it does not find ip, which starts with "fc" (ie, before starting the messenger, you need to run the cjdns daemon)
This commit is contained in:
parent
3b58f486ec
commit
5231302217
@ -37,11 +37,19 @@ void Network::processTheDatagram()
|
|||||||
QString Network::localIPv6()
|
QString Network::localIPv6()
|
||||||
{
|
{
|
||||||
QHostAddress address;
|
QHostAddress address;
|
||||||
|
QString addressString;
|
||||||
foreach (address, QNetworkInterface::allAddresses()) {
|
foreach (address, QNetworkInterface::allAddresses()) {
|
||||||
if (address.protocol() == QAbstractSocket::IPv6Protocol && address != QHostAddress(QHostAddress::LocalHostIPv6) && (address.toString()).contains("fc"))
|
if (address.protocol() == QAbstractSocket::IPv6Protocol && address != QHostAddress(QHostAddress::LocalHostIPv6) && (address.toString()).contains("fc"))
|
||||||
|
{
|
||||||
|
addressString = address.toString();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return(address.toString());
|
else
|
||||||
|
{
|
||||||
|
addressString = "null";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(addressString);
|
||||||
}
|
}
|
||||||
|
|
||||||
Network::~Network()
|
Network::~Network()
|
||||||
|
@ -5,6 +5,10 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
|
if(w.doQuit())
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
@ -5,8 +5,13 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::MainWindow)
|
ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
|
||||||
network = new Network(false);
|
network = new Network(false);
|
||||||
|
if(*network->myIPv6 == "null")
|
||||||
|
{
|
||||||
|
QMessageBox::critical(parent, tr("Cjdns is not running!"), tr("Cjdns is not running, so the application will be closed."));
|
||||||
|
mDoQuit = true;
|
||||||
|
}
|
||||||
|
ui->setupUi(this);
|
||||||
handler = new Handler();
|
handler = new Handler();
|
||||||
timer = new QTimer();
|
timer = new QTimer();
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(slotTimerAlarm()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(slotTimerAlarm()));
|
||||||
|
@ -25,6 +25,7 @@ class MainWindow : public QMainWindow
|
|||||||
QVector<ChatWindow*> pChatWindows;
|
QVector<ChatWindow*> pChatWindows;
|
||||||
void setButtonToWaiting();
|
void setButtonToWaiting();
|
||||||
void setButtonToConnect();
|
void setButtonToConnect();
|
||||||
|
inline bool doQuit() const { return mDoQuit; }
|
||||||
public slots:
|
public slots:
|
||||||
void peerReceiverAvailable();
|
void peerReceiverAvailable();
|
||||||
private slots:
|
private slots:
|
||||||
@ -42,4 +43,5 @@ class MainWindow : public QMainWindow
|
|||||||
Network *network;
|
Network *network;
|
||||||
Handler *handler;
|
Handler *handler;
|
||||||
bool receive = false;
|
bool receive = false;
|
||||||
|
bool mDoQuit = false;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user