mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-18 17:00:17 +00:00
Qt GUI now builds and runs on Windows. On Windows it can (via its manifest) automatically request admin rights on launch, which plugs it nicely into Windows' admin rights system without requiring file copies and such.
This commit is contained in:
parent
434ce96f2c
commit
b65f7f7895
@ -3,105 +3,107 @@ TARGET = "ZeroTier One"
|
||||
TEMPLATE = app
|
||||
|
||||
win32:RC_FILE = ZeroTierUI.rc
|
||||
win32:LIBS += winhttp.lib Iphlpapi.lib ws2_32.lib advapi32.lib Shell32.lib Rpcrt4.lib
|
||||
win32:QMAKE_LFLAGS += /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\"
|
||||
|
||||
mac:ICON = zt1icon.icns
|
||||
mac:QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
|
||||
mac:QMAKE_INFO_PLIST = Info.plist
|
||||
mac:LIBS += -framework Cocoa
|
||||
|
||||
SOURCES += main.cpp\
|
||||
mainwindow.cpp \
|
||||
aboutwindow.cpp \
|
||||
../node/C25519.cpp \
|
||||
../node/CertificateOfMembership.cpp \
|
||||
../node/Defaults.cpp \
|
||||
../node/Demarc.cpp \
|
||||
../node/EthernetTap.cpp \
|
||||
../node/HttpClient.cpp \
|
||||
../node/Identity.cpp \
|
||||
../node/InetAddress.cpp \
|
||||
../node/Logger.cpp \
|
||||
../node/Multicaster.cpp \
|
||||
../node/Network.cpp \
|
||||
../node/NetworkConfig.cpp \
|
||||
../node/Node.cpp \
|
||||
../node/NodeConfig.cpp \
|
||||
../node/Packet.cpp \
|
||||
../node/PacketDecoder.cpp \
|
||||
../node/Peer.cpp \
|
||||
../node/Poly1305.cpp \
|
||||
../node/Salsa20.cpp \
|
||||
../node/Service.cpp \
|
||||
../node/SHA512.cpp \
|
||||
../node/SoftwareUpdater.cpp \
|
||||
../node/Switch.cpp \
|
||||
../node/SysEnv.cpp \
|
||||
../node/Topology.cpp \
|
||||
../node/UdpSocket.cpp \
|
||||
../node/Utils.cpp \
|
||||
../ext/lz4/lz4.c \
|
||||
../ext/lz4/lz4hc.c \
|
||||
networkwidget.cpp \
|
||||
installdialog.cpp \
|
||||
SOURCES += main.cpp \
|
||||
mainwindow.cpp \
|
||||
aboutwindow.cpp \
|
||||
../node/C25519.cpp \
|
||||
../node/CertificateOfMembership.cpp \
|
||||
../node/Defaults.cpp \
|
||||
../node/Demarc.cpp \
|
||||
../node/EthernetTap.cpp \
|
||||
../node/HttpClient.cpp \
|
||||
../node/Identity.cpp \
|
||||
../node/InetAddress.cpp \
|
||||
../node/Logger.cpp \
|
||||
../node/Multicaster.cpp \
|
||||
../node/Network.cpp \
|
||||
../node/NetworkConfig.cpp \
|
||||
../node/Node.cpp \
|
||||
../node/NodeConfig.cpp \
|
||||
../node/Packet.cpp \
|
||||
../node/PacketDecoder.cpp \
|
||||
../node/Peer.cpp \
|
||||
../node/Poly1305.cpp \
|
||||
../node/Salsa20.cpp \
|
||||
../node/Service.cpp \
|
||||
../node/SHA512.cpp \
|
||||
../node/SoftwareUpdater.cpp \
|
||||
../node/Switch.cpp \
|
||||
../node/SysEnv.cpp \
|
||||
../node/Topology.cpp \
|
||||
../node/UdpSocket.cpp \
|
||||
../node/Utils.cpp \
|
||||
../ext/lz4/lz4.c \
|
||||
../ext/lz4/lz4hc.c \
|
||||
networkwidget.cpp \
|
||||
installdialog.cpp \
|
||||
licensedialog.cpp
|
||||
|
||||
HEADERS += mainwindow.h \
|
||||
aboutwindow.h \
|
||||
../node/Node.hpp \
|
||||
../node/Utils.hpp \
|
||||
../node/Defaults.hpp \
|
||||
../node/Address.hpp \
|
||||
../node/Array.hpp \
|
||||
../node/AtomicCounter.hpp \
|
||||
../node/BandwidthAccount.hpp \
|
||||
../node/Buffer.hpp \
|
||||
../node/C25519.hpp \
|
||||
../node/CertificateOfMembership.hpp \
|
||||
../node/CMWC4096.hpp \
|
||||
../node/Condition.hpp \
|
||||
../node/Constants.hpp \
|
||||
../node/Demarc.hpp \
|
||||
../node/Dictionary.hpp \
|
||||
../node/EthernetTap.hpp \
|
||||
../node/HttpClient.hpp \
|
||||
../node/Identity.hpp \
|
||||
../node/InetAddress.hpp \
|
||||
../node/Logger.hpp \
|
||||
../node/MAC.hpp \
|
||||
../node/Multicaster.hpp \
|
||||
../node/MulticastGroup.hpp \
|
||||
../node/Mutex.hpp \
|
||||
../node/Network.hpp \
|
||||
../node/NetworkConfig.hpp \
|
||||
../node/NodeConfig.hpp \
|
||||
../node/NonCopyable.hpp \
|
||||
../node/Packet.hpp \
|
||||
../node/PacketDecoder.hpp \
|
||||
../node/Peer.hpp \
|
||||
../node/Poly1305.hpp \
|
||||
../node/RuntimeEnvironment.hpp \
|
||||
../node/Salsa20.hpp \
|
||||
../node/Service.hpp \
|
||||
../node/SHA512.hpp \
|
||||
../node/SharedPtr.hpp \
|
||||
../node/SoftwareUpdater.hpp \
|
||||
../node/Switch.hpp \
|
||||
../node/SysEnv.hpp \
|
||||
../node/Thread.hpp \
|
||||
../node/Topology.hpp \
|
||||
../node/UdpSocket.hpp \
|
||||
../ext/lz4/lz4.h \
|
||||
../ext/lz4/lz4hc.h \
|
||||
networkwidget.h \
|
||||
installdialog.h \
|
||||
mac_doprivileged.h \
|
||||
aboutwindow.h \
|
||||
../node/Node.hpp \
|
||||
../node/Utils.hpp \
|
||||
../node/Defaults.hpp \
|
||||
../node/Address.hpp \
|
||||
../node/Array.hpp \
|
||||
../node/AtomicCounter.hpp \
|
||||
../node/BandwidthAccount.hpp \
|
||||
../node/Buffer.hpp \
|
||||
../node/C25519.hpp \
|
||||
../node/CertificateOfMembership.hpp \
|
||||
../node/CMWC4096.hpp \
|
||||
../node/Condition.hpp \
|
||||
../node/Constants.hpp \
|
||||
../node/Demarc.hpp \
|
||||
../node/Dictionary.hpp \
|
||||
../node/EthernetTap.hpp \
|
||||
../node/HttpClient.hpp \
|
||||
../node/Identity.hpp \
|
||||
../node/InetAddress.hpp \
|
||||
../node/Logger.hpp \
|
||||
../node/MAC.hpp \
|
||||
../node/Multicaster.hpp \
|
||||
../node/MulticastGroup.hpp \
|
||||
../node/Mutex.hpp \
|
||||
../node/Network.hpp \
|
||||
../node/NetworkConfig.hpp \
|
||||
../node/NodeConfig.hpp \
|
||||
../node/NonCopyable.hpp \
|
||||
../node/Packet.hpp \
|
||||
../node/PacketDecoder.hpp \
|
||||
../node/Peer.hpp \
|
||||
../node/Poly1305.hpp \
|
||||
../node/RuntimeEnvironment.hpp \
|
||||
../node/Salsa20.hpp \
|
||||
../node/Service.hpp \
|
||||
../node/SHA512.hpp \
|
||||
../node/SharedPtr.hpp \
|
||||
../node/SoftwareUpdater.hpp \
|
||||
../node/Switch.hpp \
|
||||
../node/SysEnv.hpp \
|
||||
../node/Thread.hpp \
|
||||
../node/Topology.hpp \
|
||||
../node/UdpSocket.hpp \
|
||||
../ext/lz4/lz4.h \
|
||||
../ext/lz4/lz4hc.h \
|
||||
networkwidget.h \
|
||||
installdialog.h \
|
||||
mac_doprivileged.h \
|
||||
licensedialog.h \
|
||||
main.h
|
||||
|
||||
FORMS += mainwindow.ui \
|
||||
aboutwindow.ui \
|
||||
networkwidget.ui \
|
||||
installdialog.ui \
|
||||
aboutwindow.ui \
|
||||
networkwidget.ui \
|
||||
installdialog.ui \
|
||||
licensedialog.ui
|
||||
|
||||
RESOURCES += \
|
||||
|
@ -134,7 +134,7 @@
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
|
@ -59,6 +59,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
#ifdef __APPLE__
|
||||
{
|
||||
// Put QSettings here because this is one of the writable directories allowed
|
||||
// in Apple's app store sandbox specs. We might end up in app store someday.
|
||||
QString zt1AppSupport(QDir::homePath() + "/Library/Application Support/ZeroTier/One");
|
||||
QDir::root().mkpath(zt1AppSupport);
|
||||
settings = new QSettings(zt1AppSupport + "/ui.ini",QSettings::IniFormat);
|
||||
|
@ -99,13 +99,19 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
if (ui->networkListWidget->verticalScrollBar())
|
||||
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
|
||||
|
||||
#ifdef __APPLE__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets)
|
||||
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||
ui->noNetworksLabel->setText("Connecting to Service..."); // changed when result is received
|
||||
#endif
|
||||
|
||||
ui->noNetworksLabel->setVisible(true);
|
||||
ui->noNetworksLabel->setText("Connecting to Service...");
|
||||
ui->bottomContainerWidget->setVisible(false);
|
||||
ui->networkListWidget->setVisible(false);
|
||||
|
||||
this->pollServiceTimerId = this->startTimer(1000);
|
||||
this->setEnabled(false); // gets enabled when updates are received
|
||||
this->cyclesSinceResponseFromService = 0;
|
||||
}
|
||||
|
||||
@ -173,19 +179,25 @@ void MainWindow::timerEvent(QTimerEvent *event)
|
||||
#endif
|
||||
|
||||
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
|
||||
QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One. (Did you enter your password correctly?)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultSystemPath().c_str(),authToken)) {
|
||||
QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One. (Did you enter your password correctly?)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zeroTierClient = new ZeroTier::Node::LocalClient(authToken.c_str(),0,&handleZTMessage,this);
|
||||
}
|
||||
|
||||
// TODO: do something more user-friendly here... or maybe try to restart
|
||||
// the service?
|
||||
if (++this->cyclesSinceResponseFromService == 4)
|
||||
QMessageBox::critical(this,"No Response from Service","The ZeroTier One service does not appear to be running.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
if (++this->cyclesSinceResponseFromService >= 4) {
|
||||
if (this->cyclesSinceResponseFromService == 4)
|
||||
QMessageBox::warning(this,"Service Not Running","Can't Connect to the ZeroTier One service. Is it running?",QMessageBox::Ok);
|
||||
ui->noNetworksLabel->setVisible(true);
|
||||
ui->noNetworksLabel->setText("Connecting to Service...");
|
||||
ui->bottomContainerWidget->setVisible(false);
|
||||
ui->networkListWidget->setVisible(false);
|
||||
}
|
||||
|
||||
zeroTierClient->send("info");
|
||||
zeroTierClient->send("listnetworks");
|
||||
@ -281,6 +293,11 @@ void MainWindow::customEvent(QEvent *event)
|
||||
ui->noNetworksLabel->setVisible(true);
|
||||
} else ui->noNetworksLabel->setVisible(false);
|
||||
|
||||
if (!ui->bottomContainerWidget->isVisible())
|
||||
ui->bottomContainerWidget->setVisible(true);
|
||||
if (!ui->networkListWidget->isVisible())
|
||||
ui->networkListWidget->setVisible(true);
|
||||
|
||||
if (this->myAddress.size())
|
||||
ui->addressButton->setText(this->myAddress);
|
||||
else ui->addressButton->setText(" ");
|
||||
@ -292,14 +309,6 @@ void MainWindow::customEvent(QEvent *event)
|
||||
st += QString::number(this->numPeers);
|
||||
st += " direct links to peers";
|
||||
ui->statusLabel->setText(st);
|
||||
|
||||
if (this->myStatus == "ONLINE") {
|
||||
if (!this->isEnabled())
|
||||
this->setEnabled(true);
|
||||
} else {
|
||||
if (this->isEnabled())
|
||||
this->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_joinNetworkButton_clicked()
|
||||
|
@ -36,43 +36,6 @@
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="noNetworksLabel">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="64">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="64">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>127</red>
|
||||
<green>127</green>
|
||||
<blue>127</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
@ -267,7 +230,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>668</width>
|
||||
<height>22</height>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
|
@ -80,6 +80,11 @@ QLabel.networkName {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#noNetworksLabel {
|
||||
background: transparent;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#networkListWidget {
|
||||
background: palette(dark);
|
||||
margin: 0 0 2px 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user