Browse Source

UI stuff and sign .dmg on build.

Adam Ierymenko 11 years ago
parent
commit
351b7f3a09

+ 2 - 7
ZeroTierUI/ZeroTierUI.pro

@@ -36,19 +36,18 @@ SOURCES += main.cpp \
     ../node/PacketDecoder.cpp \
     ../node/Peer.cpp \
     ../node/Poly1305.cpp \
+    ../node/RoutingTable.cpp \
     ../node/Salsa20.cpp \
     ../node/Service.cpp \
     ../node/SHA512.cpp \
     ../node/SocketManager.cpp \
     ../node/SoftwareUpdater.cpp \
     ../node/Switch.cpp \
-    ../node/SysEnv.cpp \
     ../node/TcpSocket.cpp \
     ../node/Topology.cpp \
     ../node/UdpSocket.cpp \
     ../node/Utils.cpp \
     ../ext/lz4/lz4.c \
-    ../ext/lz4/lz4hc.c \
     ../node/Dictionary.cpp
 
 HEADERS  += mainwindow.h \
@@ -99,20 +98,16 @@ HEADERS  += mainwindow.h \
     ../node/SocketManager.hpp \
     ../node/SoftwareUpdater.hpp \
     ../node/Switch.hpp \
-    ../node/SysEnv.hpp \
+    ../node/RoutingTable.hpp \
     ../node/TcpSocket.hpp \
     ../node/Thread.hpp \
     ../node/Topology.hpp \
     ../node/UdpSocket.hpp \
     ../node/Utils.hpp \
     ../ext/lz4/lz4.h \
-    ../ext/lz4/lz4hc.h \
     ../node/EthernetTap.hpp \
     ../node/EthernetTapFactory.hpp
 
-win32:SOURCES += ../node/WindowsEthernetTap.cpp
-mac:SOURCES += ../node/UnixEthernetTap.cpp
-
 FORMS    += mainwindow.ui \
 		aboutwindow.ui \
 		networkwidget.ui \

+ 14 - 11
ZeroTierUI/mainwindow.cpp

@@ -216,8 +216,9 @@ void MainWindow::timerEvent(QTimerEvent *event) // event can be null since code
 	}
 
 	if (++this->cyclesSinceResponseFromService >= 3) {
-		if (this->cyclesSinceResponseFromService == 3)
+		if (this->cyclesSinceResponseFromService == 3) {
 			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);
@@ -255,8 +256,8 @@ void MainWindow::customEvent(QEvent *event)
 		std::map< std::string,std::vector<std::string> > newNetworks;
 		for(unsigned long i=1;i<m->ztMessage.size();++i) {
 			std::vector<std::string> l(ZeroTier::Node::NodeControlClient::splitLine(m->ztMessage[i]));
-			// 200 listnetworks <nwid> <name> <status> <config age> <type> <dev> <ips>
-			if ((l.size() == 9)&&(l[2].length() == 16))
+			// 200 listnetworks <nwid> <name> <mac> <status> <config age> <type> <dev> <ips>
+			if ((l.size() == 10)&&(l[2].length() == 16))
 				newNetworks[l[2]] = l;
 		}
 
@@ -283,10 +284,11 @@ void MainWindow::customEvent(QEvent *event)
 					alreadyDisplayed.insert(nw->networkId());
 					std::vector<std::string> &l = networks[nw->networkId()];
 					nw->setNetworkName(l[3]);
-					nw->setStatus(l[4],l[5]);
-					nw->setNetworkType(l[6]);
-					nw->setNetworkDeviceName(l[7]);
-					nw->setIps(l[8]);
+					nw->setMAC(l[4]);
+					nw->setStatus(l[5],l[6]);
+					nw->setNetworkType(l[7]);
+					nw->setNetworkDeviceName(l[8]);
+					nw->setIps(l[9]);
 				}
 			}
 			for(std::map< std::string,std::vector<std::string> >::iterator nwdata(networks.begin());nwdata!=networks.end();++nwdata) {
@@ -294,10 +296,11 @@ void MainWindow::customEvent(QEvent *event)
 					std::vector<std::string> &l = nwdata->second;
 					NetworkWidget *nw = new NetworkWidget((QWidget *)0,nwdata->first);
 					nw->setNetworkName(l[3]);
-					nw->setStatus(l[4],l[5]);
-					nw->setNetworkType(l[6]);
-					nw->setNetworkDeviceName(l[7]);
-					nw->setIps(l[8]);
+					nw->setMAC(l[4]);
+					nw->setStatus(l[5],l[6]);
+					nw->setNetworkType(l[7]);
+					nw->setNetworkDeviceName(l[8]);
+					nw->setIps(l[9]);
 					QListWidgetItem *item = new QListWidgetItem();
 					item->setSizeHint(nw->sizeHint());
 					ui->networkListWidget->addItem(item);

+ 7 - 2
ZeroTierUI/networkwidget.cpp

@@ -53,8 +53,8 @@ NetworkWidget::NetworkWidget(QWidget *parent,const std::string &nwid) :
 
 	QFontMetrics fm(ui->ipListWidget->font());
 	int lineHeight = ui->ipListWidget->spacing() + fm.height();
-	ui->ipListWidget->setMinimumHeight(lineHeight * 4);
-	ui->ipListWidget->setMaximumHeight(lineHeight * 4);
+	ui->ipListWidget->setMinimumHeight(lineHeight * 6);
+	ui->ipListWidget->setMaximumHeight(lineHeight * 6);
 
 #ifdef __APPLE__
 	QWidgetList widgets = this->findChildren<QWidget*>();
@@ -145,6 +145,11 @@ void NetworkWidget::setIps(const std::string &commaSeparatedList)
 	}
 }
 
+void NetworkWidget::setMAC(const std::string &mac)
+{
+	ui->macLabel->setText(QString(mac.c_str()));
+}
+
 const std::string &NetworkWidget::networkId()
 {
 	return networkIdStr;

+ 1 - 0
ZeroTierUI/networkwidget.h

@@ -50,6 +50,7 @@ public:
 	void setNetworkType(const std::string &type);
 	void setNetworkDeviceName(const std::string &dev);
 	void setIps(const std::string &commaSeparatedList);
+	void setMAC(const std::string &mac);
 
 	const std::string &networkId();
 

+ 63 - 4
ZeroTierUI/networkwidget.ui

@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="sizePolicy">
-   <sizepolicy hsizetype="Expanding" vsizetype="Maximum">
+   <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
     <horstretch>0</horstretch>
     <verstretch>0</verstretch>
    </sizepolicy>
@@ -40,6 +40,12 @@
    </property>
    <item>
     <widget class="QWidget" name="leftWidget" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
      <layout class="QVBoxLayout" name="verticalLayout_2">
       <property name="spacing">
        <number>2</number>
@@ -57,7 +63,13 @@
        <number>0</number>
       </property>
       <item>
-       <widget class="QWidget" name="widget" native="true">
+       <widget class="QWidget" name="networkInfoWidget" native="true">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
         <layout class="QHBoxLayout" name="horizontalLayout">
          <property name="leftMargin">
           <number>0</number>
@@ -178,6 +190,12 @@
       </item>
       <item>
        <widget class="QWidget" name="networkStatsWidget" native="true">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
         <layout class="QFormLayout" name="formLayout">
          <property name="fieldGrowthPolicy">
           <enum>QFormLayout::ExpandingFieldsGrow</enum>
@@ -291,7 +309,7 @@
            </property>
           </widget>
          </item>
-         <item row="4" column="0">
+         <item row="5" column="0">
           <widget class="QLabel" name="label_4">
            <property name="font">
             <font>
@@ -306,7 +324,7 @@
            </property>
           </widget>
          </item>
-         <item row="4" column="1">
+         <item row="5" column="1">
           <widget class="QLabel" name="deviceLabel">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -332,6 +350,44 @@
            </property>
           </widget>
          </item>
+         <item row="4" column="0">
+          <widget class="QLabel" name="label_7">
+           <property name="font">
+            <font>
+             <pointsize>12</pointsize>
+            </font>
+           </property>
+           <property name="text">
+            <string>MAC:</string>
+           </property>
+           <property name="textFormat">
+            <enum>Qt::PlainText</enum>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="1">
+          <widget class="QLabel" name="macLabel">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="font">
+            <font>
+             <pointsize>12</pointsize>
+             <weight>75</weight>
+             <bold>true</bold>
+            </font>
+           </property>
+           <property name="text">
+            <string>?</string>
+           </property>
+           <property name="textFormat">
+            <enum>Qt::PlainText</enum>
+           </property>
+          </widget>
+         </item>
         </layout>
        </widget>
       </item>
@@ -340,6 +396,9 @@
         <property name="orientation">
          <enum>Qt::Vertical</enum>
         </property>
+        <property name="sizeType">
+         <enum>QSizePolicy::Expanding</enum>
+        </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>20</width>

+ 5 - 1
make-mac.mk

@@ -69,12 +69,16 @@ official: FORCE
 	make -j 4 ZT_OFFICIAL_RELEASE=1
 	make mac-ui ZT_OFFICIAL_RELEASE=1
 	./buildinstaller.sh
-	mkdir build-ZeroTierOne-dmg
+	make mac-dmg ZT_OFFICIAL_RELEASE=1
+
+mac-dmg:	FORCE
+	mkdir -p build-ZeroTierOne-dmg
 	cd build-ZeroTierOne-dmg ; ln -sf /Applications Applications
 	cp -a "build-ZeroTierUI-release/ZeroTier One.app" build-ZeroTierOne-dmg/
 	rm -f /tmp/tmp.dmg
 	hdiutil create /tmp/tmp.dmg -ov -volname "ZeroTier One" -fs HFS+ -srcfolder ./build-ZeroTierOne-dmg
 	hdiutil convert /tmp/tmp.dmg -format UDZO -o "ZeroTier One.dmg"
+	$(CODESIGN) -f -s $(CODESIGN_CERT) "ZeroTier One.dmg"
 	rm -f /tmp/tmp.dmg
 
 # For those building from source -- installs signed binary tap driver in system ZT home