Created
December 29, 2016 01:56
-
-
Save tlewiscpp/6e0d9e005160f842b2a79554f80b0302 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "initalprompt.h" | |
#include "ui_initalprompt.h" | |
#include "mainwindow.h" | |
#include "ui_mainwindow.h" | |
#include <QLineEdit> | |
#include <QCloseEvent> | |
#include <QMessageBox> | |
InitalPrompt::InitalPrompt(QWidget *parent) : | |
QDialog(parent), | |
ui(new Ui::InitalPrompt) | |
{ | |
ui->setupUi(this); | |
} | |
InitalPrompt::~InitalPrompt() | |
{ | |
delete ui; | |
} | |
void InitalPrompt::keyPressEvent(QKeyEvent *qke) | |
{ | |
if (qke->key() == Qt::Key_Return) { | |
emit (passInputReturnPressed()); | |
} | |
} | |
void InitalPrompt::on_passInput_returnPressed() | |
{ | |
pass = ui->passInput->text(); | |
this->hide(); | |
//ui->passInput->setText("it actually does work property messed it up"); | |
} | |
void InitalPrompt::reject() | |
{ | |
QMessageBox::StandardButton resBtn = QMessageBox::Yes; | |
bool changes = false; | |
if (changes) { | |
resBtn = QMessageBox::question( this, "APP_NAME", | |
tr("Are you sure?\n"), | |
QMessageBox::Cancel | QMessageBox::No | QMessageBox::Yes, | |
QMessageBox::Yes); | |
} | |
if (resBtn == QMessageBox::Yes) { | |
QDialog::reject(); | |
} | |
// the only issue is with the statment below don't know why | |
copy->close(); | |
} | |
void InitalPrompt::catcher(MainWindow *ui) | |
{ | |
copy = ui; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef INITALPROMPT_H | |
#define INITALPROMPT_H | |
#include "mainwindow.h" | |
#include <QDialog> | |
#include <QKeyEvent> | |
namespace Ui { | |
class InitalPrompt; | |
class MainWindow; | |
} | |
class InitalPrompt : public QDialog | |
{ | |
Q_OBJECT | |
public: | |
explicit InitalPrompt(QWidget *parent = 0); | |
~InitalPrompt(); | |
void catcher(MainWindow *ui); | |
QString pass; | |
void keyPressEvent(QKeyEvent *qke); | |
private slots: | |
public slots: | |
virtual void reject(); | |
void on_passInput_returnPressed(); | |
signals: | |
void clickme(); | |
void passInputReturnPressed(); | |
private: | |
Ui::InitalPrompt *ui; | |
MainWindow *copy; | |
}; | |
#endif // INITALPROMPT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mainwindow.h" | |
#include "initalprompt.h" | |
#include <QApplication> | |
int main(int argc, char *argv[]) | |
{ | |
QApplication a(argc, argv); | |
MainWindow w; | |
InitalPrompt i; | |
//w.show(); | |
i.catcher(&w); | |
i.setModal(true); | |
//QObject::connect(&i, i.reject(), &w, w.close()); | |
QObject::connect(&i, SIGNAL(clickme()), &i, SLOT(reject())); | |
QObject::connect(&i, SIGNAL(passInputReturnPressed()), &i, SLOT(on_passInput_returnPressed())); | |
QObject::connect(&i, SIGNAL(passInputReturnPressed()), &w, SLOT(initalizer())); | |
i.exec(); | |
// get the statement above to work and you should be golden | |
//QObject::connect(&i, SIGNAL(clicked()), &w, SLOT(close())); | |
return a.exec(); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MAINWINDOW_H | |
#define MAINWINDOW_H | |
#include <QMainWindow> | |
namespace Ui { | |
class MainWindow; | |
} | |
class MainWindow : public QMainWindow | |
{ | |
Q_OBJECT | |
public: | |
explicit MainWindow(QWidget *parent = 0); | |
~MainWindow(); | |
//static int num; | |
private slots: | |
void initalizer(); | |
void on_Defrag_clicked(); | |
void on_clean_reg_clicked(); | |
void on_junk_files_clicked(); | |
public: | |
Ui::MainWindow *ui; | |
}; | |
#endif // MAINWINDOW_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment