Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
hrngultekin committed Nov 3, 2015
1 parent 2bf6e3e commit 54f011e
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 59 deletions.
2 changes: 1 addition & 1 deletion YAPILACAKLAR
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Yapılacaklar :

(*) pspecxml düzenleme eklenecek

(X) Pakete simge eklemek için buton eklenecek ve okuması sağlanacak
(*) Pakete simge eklemek için buton eklenecek ve okuması sağlanacak

(*) docker için log fonksiyonu düzenlenecek

Expand Down
69 changes: 30 additions & 39 deletions cpp/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,17 @@ MainWindow::MainWindow(QWidget *parent) :
w_terminal->setWorkingDirectory(workspace_dir.absolutePath());
w_terminal->changeDir(workspace_dir.absolutePath());

//docker_daemon_terminal
docker_daemon_terminal= new QTermWidget(1, ui->dockWidgetContents);
docker_daemon_terminal->setTerminalFont(terminal_font);
//w_terminal->setColorScheme(COLOR_SCHEME_WHITE_ON_BLACK);
docker_daemon_terminal->setScrollBarPosition(QTermWidget::ScrollBarRight);
docker_daemon_terminal->setWorkingDirectory(workspace_dir.absolutePath());
docker_daemon_terminal->changeDir(workspace_dir.absolutePath());

ui->horizontalLayout_12->addWidget(docker_daemon_terminal);
//docker_daemon_terminal

ui->le_package_name->setFocus();

first_run=true;
Expand Down Expand Up @@ -1795,10 +1806,7 @@ void MainWindow::call_pisi_build_command(const QString &build_step)
command = QString("pisi build '%1' %2 --output-dir %3 \n")
.arg(pspec_file)
.arg(build_step)
.arg(output_dir.absolutePath())
;
if (!is_root)
command="pkexec -u root "+command;
.arg(output_dir.absolutePath());
}
w_terminal->sendText(command);

Expand Down Expand Up @@ -1859,15 +1867,15 @@ void MainWindow::time_elapsed(){
.arg(elapsed_time%60, 2, 10, QChar('0')));

if (start_process==false) {
QProcess *pkexec=new QProcess(0);
pkexec->start("pgrep",QStringList("pkexec"));
pkexec->waitForBytesWritten();
pkexec->waitForFinished();
QProcess *pgrep=new QProcess(0);
pgrep->start("pgrep",QStringList("pkexec"));
pgrep->waitForBytesWritten();
pgrep->waitForFinished();

QString pk_out=pkexec->readAll();
QString pk_out=pgrep->readAll();
//qDebug()<< QString("pkexec output : %1").arg(pk_out);

delete pkexec;
delete pgrep;

if(out !=""){
start_process=true;
Expand Down Expand Up @@ -2044,12 +2052,9 @@ void MainWindow::action_Find_docker_containers_triggered(){
QProcess *p=new QProcess(0);

QStringList argmnt;
argmnt << "--user"
<< "root"
<< "docker"
<< "ps"
argmnt << "ps"
<< "-a";
p->start("pkexec",argmnt);
p->start("docker",argmnt);
if(!p->isOpen())
qDebug() << "process is not open";

Expand Down Expand Up @@ -2121,40 +2126,26 @@ void MainWindow::on_action_Exit_Container_triggered(){

ui->tb_docker_container->setEnabled(true);
foreach (QAction *a, ui->tb_docker_container->actions()) {
if(a->text()=="Find Containers"){
ui->tb_docker_container->setDefaultAction(a);
continue;
}
ui->tb_docker_container->removeAction(a);
}
ui->tb_docker_container->setText(trUtf8("Containers"));
//ui->tb_docker_container->setText(trUtf8("Containers"));


QString command = QString("exit\n");
w_terminal->sendText(command);
}

void MainWindow::on_action_Root_triggered(){
ui->action_Root->setEnabled(false);
ui->action_Run_Docker->setEnabled(true);
is_root=true;

QString command=QString("pkexec -u root bash \n");
w_terminal->sendText(command);
action_Find_docker_containers_triggered();
}

void MainWindow::on_action_Start_Daemon_triggered(){
pid_t pid = fork();

if (pid == 0)
{
system("pkexec -u root docker -d -s overlay");
}
else if (pid > 0)
{

}
else
{
// fork failed
QMessageBox::warning(0,"Warning","Daemon is not start!\n");
return;
}
void MainWindow::on_action_Start_Daemon_triggered(){
QString command="docker -d -s overlay\n";
docker_daemon_terminal->sendText(command);
}

void MainWindow::on_action_Refresh_Container_triggered(){
Expand Down
5 changes: 3 additions & 2 deletions h/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private slots:
void on_action_Checkelf_triggered();

void on_action_Exit_Container_triggered();
void on_action_Root_triggered();

void on_action_Start_Daemon_triggered();
void on_action_Refresh_Container_triggered();
void on_actionRemove_Containers_triggered();
Expand All @@ -178,6 +178,7 @@ private slots:
QsciScintilla * actions_editor;
QsciLexerPython * python_lexer;
QTermWidget * w_terminal;
QTermWidget * docker_daemon_terminal;
QDomDocument dom_pspec;
Pisi pisi;

Expand Down Expand Up @@ -246,7 +247,7 @@ private slots:
void pisi_from_gui() throw (QString);
void save_package(int key);

bool Zoom,start_process,first_run,docker_is_running,is_root;
bool Zoom,start_process,first_run,docker_is_running;


};
Expand Down
2 changes: 1 addition & 1 deletion pisido.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.1.2, 2015-09-13T14:56:57. -->
<!-- Written by QtCreator 3.1.2, 2015-11-03T14:01:32. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
Expand Down
2 changes: 1 addition & 1 deletion resources/files/pisido.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Categories=Development;IDE;
Comment[tr]=Pisi paketi yapıcı
Comment=Pisi paketi yapıcı
Encoding=UTF-8
Exec=pisido
Exec=gksu -u root pisido
GenericName[tr]=Pisi paketi yapıcı
GenericName=Pisi paketi yapıcı
Icon=pisido.png
Expand Down
30 changes: 15 additions & 15 deletions ui/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>296</width>
<height>810</height>
<width>301</width>
<height>838</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
Expand Down Expand Up @@ -488,7 +488,7 @@ p, li { white-space: pre-wrap; }
<x>0</x>
<y>0</y>
<width>909</width>
<height>20</height>
<height>26</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand Down Expand Up @@ -539,7 +539,6 @@ p, li { white-space: pre-wrap; }
<property name="title">
<string>Docker</string>
</property>
<addaction name="action_Root"/>
<addaction name="action_Start_Daemon"/>
<addaction name="separator"/>
<addaction name="action_Run_Docker"/>
Expand Down Expand Up @@ -1596,7 +1595,6 @@ And than you can edit their properties in here</string>
<attribute name="toolBarBreak">
<bool>true</bool>
</attribute>
<addaction name="action_Root"/>
<addaction name="action_Start_Daemon"/>
<addaction name="separator"/>
<addaction name="action_Run_Docker"/>
Expand All @@ -1609,6 +1607,17 @@ And than you can edit their properties in here</string>
<addaction name="separator"/>
<addaction name="action_Exit_Container"/>
</widget>
<widget class="QDockWidget" name="dw_dd_terminal">
<property name="windowTitle">
<string>Docker Daemon</string>
</property>
<attribute name="dockWidgetArea">
<number>8</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QHBoxLayout" name="horizontalLayout_12"/>
</widget>
</widget>
<action name="actionExit">
<property name="icon">
<iconset resource="../resources/pisido.qrc">
Expand Down Expand Up @@ -1797,7 +1806,7 @@ And than you can edit their properties in here</string>
</action>
<action name="action_Run_Docker">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../resources/pisido.qrc">
Expand Down Expand Up @@ -1847,15 +1856,6 @@ And than you can edit their properties in here</string>
<string>Exit Container</string>
</property>
</action>
<action name="action_Root">
<property name="icon">
<iconset resource="../resources/pisido.qrc">
<normaloff>:/images/root.png</normaloff>:/images/root.png</iconset>
</property>
<property name="text">
<string>Root</string>
</property>
</action>
<action name="action_Start_Daemon">
<property name="text">
<string>Start Daemon</string>
Expand Down

0 comments on commit 54f011e

Please sign in to comment.