first qt gui steps
This commit is contained in:
		
							
								
								
									
										38
									
								
								src/gui/MainWindow.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/gui/MainWindow.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
//
 | 
			
		||||
// Created by lukas on 09.05.20.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include "MainWindow.h"
 | 
			
		||||
#include "ui_mainwindow.h"
 | 
			
		||||
 | 
			
		||||
MainWindow::MainWindow(QWidget *parent) :
 | 
			
		||||
        QMainWindow(parent), ui(new Ui::MainWindow) {
 | 
			
		||||
 | 
			
		||||
    ui->setupUi(this);
 | 
			
		||||
    ui->textLog->
 | 
			
		||||
 | 
			
		||||
//    ui->labelCurrentIP->setText("currently is nothing to do");
 | 
			
		||||
//    ui->labelConfig->setText("blabliblub");
 | 
			
		||||
//    ui->textfieldname->setText("hangover");
 | 
			
		||||
 | 
			
		||||
    connect(ui->buttonCheckConfig, SIGNAL(clicked()), this, SLOT(checkConfigBtn()));
 | 
			
		||||
    connect(ui->buttonRefreshIP, SIGNAL(clicked()), this, SLOT(refreshIPBtn()));
 | 
			
		||||
 | 
			
		||||
    connect(this, SIGNAL(appendLogField(QString)), ui->textLog, SLOT(appendPlainText(QString)));
 | 
			
		||||
//    connect(this, SIGNAL(setProgressBarValue(int)), ui->progressmanual, SLOT(setValue(int)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MainWindow::~MainWindow() {
 | 
			
		||||
    delete ui;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::checkConfigBtn() {
 | 
			
		||||
    std::cout << "btn clicked!" << std::endl;
 | 
			
		||||
 | 
			
		||||
    appendLogField("btn clicked! \n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::refreshIPBtn() {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										31
									
								
								src/gui/MainWindow.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/gui/MainWindow.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
//
 | 
			
		||||
// Created by lukas on 09.05.20.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <QtWidgets/QMainWindow>
 | 
			
		||||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
    class MainWindow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class MainWindow : public QMainWindow{
 | 
			
		||||
Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    explicit MainWindow(QWidget *parent = 0);
 | 
			
		||||
    ~MainWindow();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::MainWindow *ui;
 | 
			
		||||
private slots:
 | 
			
		||||
//    void startdownloadBtn();
 | 
			
		||||
void checkConfigBtn();
 | 
			
		||||
void refreshIPBtn();
 | 
			
		||||
signals:
 | 
			
		||||
    void appendLogField(QString);
 | 
			
		||||
//    void setInfoLabelText(QString);
 | 
			
		||||
//    void setProgressBarValue(int);
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										103
									
								
								src/gui/mainwindow.ui
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								src/gui/mainwindow.ui
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,103 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<ui version="4.0">
 | 
			
		||||
 <class>MainWindow</class>
 | 
			
		||||
 <widget class="QMainWindow" name="MainWindow">
 | 
			
		||||
  <property name="geometry">
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>823</width>
 | 
			
		||||
    <height>618</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>MainWindow</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <widget class="QWidget" name="centralwidget">
 | 
			
		||||
   <widget class="QPushButton" name="buttonRefreshIP">
 | 
			
		||||
    <property name="geometry">
 | 
			
		||||
     <rect>
 | 
			
		||||
      <x>290</x>
 | 
			
		||||
      <y>300</y>
 | 
			
		||||
      <width>91</width>
 | 
			
		||||
      <height>33</height>
 | 
			
		||||
     </rect>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="text">
 | 
			
		||||
     <string>Refresh IP</string>
 | 
			
		||||
    </property>
 | 
			
		||||
   </widget>
 | 
			
		||||
   <widget class="QLabel" name="labelCurrentIP">
 | 
			
		||||
    <property name="geometry">
 | 
			
		||||
     <rect>
 | 
			
		||||
      <x>40</x>
 | 
			
		||||
      <y>60</y>
 | 
			
		||||
      <width>161</width>
 | 
			
		||||
      <height>17</height>
 | 
			
		||||
     </rect>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="text">
 | 
			
		||||
     <string>Your current global IP:</string>
 | 
			
		||||
    </property>
 | 
			
		||||
   </widget>
 | 
			
		||||
   <widget class="QPlainTextEdit" name="textLog">
 | 
			
		||||
    <property name="enabled">
 | 
			
		||||
     <bool>true</bool>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="geometry">
 | 
			
		||||
     <rect>
 | 
			
		||||
      <x>40</x>
 | 
			
		||||
      <y>410</y>
 | 
			
		||||
      <width>691</width>
 | 
			
		||||
      <height>191</height>
 | 
			
		||||
     </rect>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="cursor" stdset="0">
 | 
			
		||||
     <cursorShape>IBeamCursor</cursorShape>
 | 
			
		||||
    </property>
 | 
			
		||||
   </widget>
 | 
			
		||||
   <widget class="QLabel" name="label_2">
 | 
			
		||||
    <property name="geometry">
 | 
			
		||||
     <rect>
 | 
			
		||||
      <x>40</x>
 | 
			
		||||
      <y>380</y>
 | 
			
		||||
      <width>64</width>
 | 
			
		||||
      <height>17</height>
 | 
			
		||||
     </rect>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="text">
 | 
			
		||||
     <string>Log:</string>
 | 
			
		||||
    </property>
 | 
			
		||||
   </widget>
 | 
			
		||||
   <widget class="QPushButton" name="buttonCheckConfig">
 | 
			
		||||
    <property name="geometry">
 | 
			
		||||
     <rect>
 | 
			
		||||
      <x>270</x>
 | 
			
		||||
      <y>140</y>
 | 
			
		||||
      <width>91</width>
 | 
			
		||||
      <height>33</height>
 | 
			
		||||
     </rect>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="text">
 | 
			
		||||
     <string>Check Config</string>
 | 
			
		||||
    </property>
 | 
			
		||||
   </widget>
 | 
			
		||||
   <widget class="QLabel" name="labelConfig">
 | 
			
		||||
    <property name="geometry">
 | 
			
		||||
     <rect>
 | 
			
		||||
      <x>270</x>
 | 
			
		||||
      <y>180</y>
 | 
			
		||||
      <width>141</width>
 | 
			
		||||
      <height>17</height>
 | 
			
		||||
     </rect>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="text">
 | 
			
		||||
     <string>Config is: undefined</string>
 | 
			
		||||
    </property>
 | 
			
		||||
   </widget>
 | 
			
		||||
  </widget>
 | 
			
		||||
  <widget class="QStatusBar" name="statusbar"/>
 | 
			
		||||
 </widget>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
							
								
								
									
										17
									
								
								src/maingui.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/maingui.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
//
 | 
			
		||||
// Created by lukas on 09.05.20.
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#include <QApplication>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include "gui/MainWindow.h"
 | 
			
		||||
 | 
			
		||||
int main(int argc, char *argv[]) {
 | 
			
		||||
    std::cout << "gui here!" << std::endl;
 | 
			
		||||
 | 
			
		||||
    QApplication a(argc, argv);
 | 
			
		||||
    MainWindow w;
 | 
			
		||||
    w.show();
 | 
			
		||||
 | 
			
		||||
    return QApplication::exec();
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user